A bunch of changers I neglected to commit earlier

Strange size things (i7 in llvm)
Hellp world in idris
A rolldice test
pppassword changes to add b
This commit is contained in:
Artemis Tosini 2018-12-09 23:54:13 +00:00
parent b3fa4050c1
commit cdab9d90a1
Signed by: artemist
GPG key ID: 094FBF1D31E6C1BB
8 changed files with 220 additions and 1 deletions

View file

@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdint.h>
int main(int argc, char **argv) {
uint8_t i = 72;
uint8_t j = 84;
uint8_t k = i + j;
printf("%d + %d = %d\n", i, j, k);
return 0;
}

View file

@ -0,0 +1,49 @@
; ModuleID = 'strange_size.c'
source_filename = "strange_size.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [14 x i8] c"%d + %d = %d\0A\00", align 1
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local i32 @main(i32, i8**) #0 {
%3 = alloca i32, align 4
%4 = alloca i32, align 4
%5 = alloca i8**, align 8
%6 = alloca i7, align 1
%7 = alloca i7, align 1
%8 = alloca i7, align 1
store i32 0, i32* %3, align 4
store i32 %0, i32* %4, align 4
store i8** %1, i8*** %5, align 8
store i7 72, i7* %6, align 1
store i7 84, i7* %7, align 1
%9 = load i7, i7* %6, align 1
%10 = zext i7 %9 to i32
%11 = load i7, i7* %7, align 1
%12 = zext i7 %11 to i32
%13 = add nsw i32 %10, %12
%14 = trunc i32 %13 to i7
store i7 %14, i7* %8, align 1
%15 = load i7, i7* %6, align 1
%16 = zext i7 %15 to i32
%17 = load i7, i7* %7, align 1
%18 = zext i7 %17 to i32
%19 = load i7, i7* %8, align 1
%20 = zext i7 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), i32 %16, i32 %18, i32 %20)
ret i32 0
}
declare i32 @printf(i8*, ...) #1
attributes #0 = { noinline nounwind optnone sspstrong uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0, !1, !2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 7, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!"clang version 7.0.0 (tags/RELEASE_700/final)"}

View file

@ -0,0 +1,49 @@
.text
.intel_syntax noprefix
.file "strange_size.c"
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.cfi_startproc
# %bb.0:
push rbp
.cfi_def_cfa_offset 16
.cfi_offset rbp, -16
mov rbp, rsp
.cfi_def_cfa_register rbp
sub rsp, 32
mov dword ptr [rbp - 12], 0
mov dword ptr [rbp - 8], edi
mov qword ptr [rbp - 24], rsi
mov byte ptr [rbp - 2], 72
mov byte ptr [rbp - 1], 84
movzx eax, byte ptr [rbp - 2]
movzx ecx, byte ptr [rbp - 1]
add eax, ecx
and al, 127
mov byte ptr [rbp - 3], al
movzx esi, byte ptr [rbp - 2]
movzx edx, byte ptr [rbp - 1]
movzx ecx, byte ptr [rbp - 3]
movabs rdi, offset .L.str
mov al, 0
call printf
xor eax, eax
add rsp, 32
pop rbp
.cfi_def_cfa rsp, 8
ret
.Lfunc_end0:
.size main, .Lfunc_end0-main
.cfi_endproc
# -- End function
.type .L.str,@object # @.str
.section .rodata.str1.1,"aMS",@progbits,1
.L.str:
.asciz "%d + %d = %d\n"
.size .L.str, 14
.ident "clang version 7.0.0 (tags/RELEASE_700/final)"
.section ".note.GNU-stack","",@progbits

3
idris/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
a.out
*.o
*.idc

4
idris/Hello.idr Normal file
View file

@ -0,0 +1,4 @@
module Main
main : IO ()
main = putStrLn "Hallo, Welt"

1
notebooks/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.ipynb_checkpoints/

101
notebooks/rolldice.ipynb Normal file

File diff suppressed because one or more lines are too long

View file

@ -4,8 +4,10 @@ import os
import secrets
a = "".join(sys.argv[1:])
d = "pq"
if "b" in a:
d = d + "b"
if "u" in a:
d = d + "PQ"
d = d + d.upper()
l = 16 + secrets.randbelow(16)