xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
float sqrtf(int /*<<< orphan*/);
int /*<<< orphan*/ stdlib_strided_svariancetk(int /*<<< orphan*/ const,
                                              float const, float const *,
                                              int /*<<< orphan*/ const);
float stdlib_strided_sstdevtk(const int64_t N, const float correction,
                              const float *X, const int64_t stride) {
  return sqrtf(stdlib_strided_svariancetk(N, correction, X, stride));
}


x86 assembly (clang, -O0):
<stdlib_strided_sstdevtk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_svariancetk@plt>
mov    %eax,%edi
call   1040 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_sstdevtk>:
push   %rax
call   1030 <stdlib_strided_svariancetk@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrtf@plt>

LLVM IR (-O0):
define float @stdlib_strided_sstdevtk(i32 %0, float %1, float* %2, i32 %3) {
%5 = alloca i32
%6 = alloca float
%7 = alloca float*
%8 = alloca i32
store i32 %0, i32* %5
store float %1, float* %6
store float* %2, float** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load float, float* %6
%11 = load float*, float** %7
%12 = load i32, i32* %8
%13 = call i32 @stdlib_strided_svariancetk(i32 %9, float %10, float* %11, i32 %12)
%14 = call float @sqrtf(i32 %13)
ret float %14
}

LLVM IR (-O2):
define float @stdlib_strided_sstdevtk(i32 %0, float %1, float* %2, i32 %3) {
%5 = tail call i32 @stdlib_strided_svariancetk(i32 %0, float %1, float* %2, i32 %3)
%6 = tail call float @sqrtf(i32 %5)
ret float %6
}
void TimerIntClear(unsigned long ulBase, unsigned long ulIntFlags) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000024))) = ulIntFlags;
}


x86 assembly (clang, -O0):
<TimerIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x24(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerIntClear>:
mov    %rsi,0x24(%rdi)
ret

LLVM IR (-O0):
define void @TimerIntClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 36
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @TimerIntClear(i64 %0, i64 %1) {
%3 = add i64 %0, 36
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
int dict_ptr_cmp(const void *k1, const void *k2) {
  return (k1 > k2) - (k1 < k2);
}


x86 assembly (clang, -O0):
<dict_ptr_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
cmp    -0x10(%rbp),%rcx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dict_ptr_cmp>:
xor    %eax,%eax
cmp    %rsi,%rdi
seta   %al
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @dict_ptr_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp ugt i8* %5, %6
%8 = zext i1 %7 to i32
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = icmp ult i8* %9, %10
%12 = zext i1 %11 to i32
%13 = sub nsw i32 %8, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @dict_ptr_cmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp ugt i8* %0, %1
%4 = zext i1 %3 to i32
%5 = icmp ult i8* %0, %1
%6 = sext i1 %5 to i32
%7 = add nsw i32 %6, %4
ret i32 %7
}
/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int /*<<< orphan*/ rot13(int);
int /*<<< orphan*/ stdin;
int main(void) {
  int c;
  while ((c = fgetc(stdin)) != EOF) {
    putchar(rot13(c));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1050 <fgetc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
je     1173 <main+0x43>
mov    -0x8(%rbp),%edi
call   1040 <rot13@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ead(%rip),%r14
mov    (%r14),%edi
call   1050 <fgetc@plt>
mov    0x2e96(%rip),%rbx
cmp    (%rbx),%eax
je     116a <main+0x3a>
xchg   %ax,%ax
mov    %eax,%edi
call   1040 <rot13@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
mov    (%r14),%edi
call   1050 <fgetc@plt>
cmp    (%rbx),%eax
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* @stdin
%5 = call i32 @fgetc(i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = load i32, i32* %2
%10 = call i32 @rot13(i32 %9)
%11 = call i32 @putchar(i32 %10)
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fgetc(i32 %1)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %13, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %10, %5 ], [ %2, %0 ]
%7 = tail call i32 @rot13(i32 %6)
%8 = tail call i32 @putchar(i32 %7)
%9 = load i32, i32* @stdin
%10 = tail call i32 @fgetc(i32 %9)
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %5
13: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lcd_wr_command(int);
void lcd_line2() { lcd_wr_command(0xC0); }


x86 assembly (clang, -O0):
<lcd_line2>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc0,%edi
call   1030 <lcd_wr_command@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_line2>:
mov    $0xc0,%edi
jmp    1030 <lcd_wr_command@plt>

LLVM IR (-O0):
define void @lcd_line2() {
%1 = call i32 @lcd_wr_command(i32 192)
ret void
}

LLVM IR (-O2):
define void @lcd_line2() {
%1 = tail call i32 @lcd_wr_command(i32 192)
ret void
}
int main(int argc, const char *argv[]) {
  int buffer[10];
  int i = 0;
  int a = 0;
  while (i < 10) {
    buffer[i] = i;
    ++i;
    a = a + 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    114c <main+0x4c>
mov    -0x44(%rbp),%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x48(%rbp)
jmp    1120 <main+0x20>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %12, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %7
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %15
store i32 %13, i32* %16
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
%19 = load i32, i32* %8
%20 = add nsw i32 %19, 2
store i32 %20, i32* %8
br label %9
21: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
double _nand(const int numInputs, const double *inputs,
             const double *connectionWeights) {
  int i;
  for (i = 0; i < numInputs; i++) {
    if (inputs[i] == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<_nand>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1167 <_nand+0x67>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1154 <_nand+0x54>
jp     1154 <_nand+0x54>
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    116f <_nand+0x6f>
jmp    1159 <_nand+0x59>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1116 <_nand+0x16>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nand>:
test   %edi,%edi
jle    1136 <_nand+0x36>
mov    %edi,%eax
xor    %ecx,%ecx
xorpd  %xmm1,%xmm1
movsd  0xeec(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rsi,%rcx,8),%xmm2
ucomisd %xmm1,%xmm2
jne    112d <_nand+0x2d>
jnp    1139 <_nand+0x39>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1120 <_nand+0x20>
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @_nand(i32 %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store i32 0, i32* %8
br label %9
9: ; preds = %22, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load double*, double** %6
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %13
store double 1.000000e+00, double* %4
br label %26
21: ; preds = %13
br label %22
22: ; preds = %21
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
store i32 %24, i32* %8
br label %9
25: ; preds = %9
store double 0.000000e+00, double* %4
br label %26
26: ; preds = %25, %20
%27 = load double, double* %4
ret double %27
}

LLVM IR (-O2):
define double @_nand(i32 %0, double* nocapture %1, double* nocapture readnone %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %14, %6
br i1 %8, label %15, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %14, %7 ]
%11 = getelementptr inbounds double, double* %1, i64 %10
%12 = load double, double* %11
%13 = fcmp oeq double %12, 0.000000e+00
%14 = add nuw nsw i64 %10, 1
br i1 %13, label %15, label %7
15: ; preds = %9, %7, %3
%16 = phi double [ 0.000000e+00, %3 ], [ 0.000000e+00, %7 ], [ 1.000000e+00, %9 ]
ret double %16
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  char *f;
  f = malloc(400);
  free(f + 50);
  printf("coucou\n");
  free(f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x190,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x32,%rdi
call   1030 <free@plt>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x190,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0x32(%rax),%rdi
call   1030 <free@plt>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"coucou\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 400)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 50
%5 = call i32 @free(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %1
%8 = call i32 @free(i8* %7)
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"coucou\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(400) i8* @malloc(i32 400)
%2 = getelementptr inbounds i8, i8* %1, i64 50
%3 = tail call i32 @free(i8* %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @free(i8* %1)
ret i32 0
}
double factorial(double n) {
  double res = 1;
  double i;
  for (i = 1; i <= n; i++) {
    res = res * i;
  }
  return res;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     115d <factorial+0x5d>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb2(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1123 <factorial+0x23>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
movsd  0xef8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     112e <factorial+0x2e>
movsd  0xeea(%rip),%xmm2
movapd %xmm2,%xmm3
movapd %xmm2,%xmm1
xchg   %ax,%ax
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm3
ucomisd %xmm3,%xmm0
jae    1120 <factorial+0x20>
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @factorial(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %3
store double 1.000000e+00, double* %4
br label %5
5: ; preds = %13, %1
%6 = load double, double* %4
%7 = load double, double* %2
%8 = fcmp ole double %6, %7
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fmul double %10, %11
store double %12, double* %3
br label %13
13: ; preds = %9
%14 = load double, double* %4
%15 = fadd double %14, 1.000000e+00
store double %15, double* %4
br label %5
16: ; preds = %5
%17 = load double, double* %3
ret double %17
}

LLVM IR (-O2):
define double @factorial(double %0) {
%2 = fcmp ult double %0, 1.000000e+00
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi double [ %7, %3 ], [ 1.000000e+00, %1 ]
%5 = phi double [ %6, %3 ], [ 1.000000e+00, %1 ]
%6 = fmul double %5, %4
%7 = fadd double %4, 1.000000e+00
%8 = fcmp ugt double %7, %0
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi double [ 1.000000e+00, %1 ], [ %6, %3 ]
ret double %10
}
unsigned int hash(char *key) {
  unsigned int result = 0;
  while (*key) {
    result += *key;
    key++;
  }
  return result;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113a <hash+0x3a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1121 <hash+0x21>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i32, i32* %3
%13 = add i32 %12, %11
store i32 %13, i32* %3
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %2
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %9, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = add i32 %6, %8
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ thread_get_current();
int /*<<< orphan*/ thread_set_priority(int /*<<< orphan*/, unsigned int);
void thread_set_current_priority(unsigned int priority) {
  thread_set_priority(thread_get_current(), priority);
}


x86 assembly (clang, -O0):
<thread_set_current_priority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <thread_get_current@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <thread_set_priority@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_set_current_priority>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <thread_get_current@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <thread_set_priority@plt>

LLVM IR (-O0):
define void @thread_set_current_priority(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @thread_get_current()
%4 = load i32, i32* %2
%5 = call i32 @thread_set_priority(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
define void @thread_set_current_priority(i32 %0) {
%2 = tail call i32 (...) @thread_get_current()
%3 = tail call i32 @thread_set_priority(i32 %2, i32 %0)
ret void
}
int xh_str_hash(const void *key, void *data) {
  const char *str = *(const char **)key;
  int hash = 0;
  (void)data;
  while (*str) {
    hash = hash * 31 + *str++;
  }
  return hash;
}


x86 assembly (clang, -O0):
<xh_str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <xh_str_hash+0x4b>
imul   $0x1f,-0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    111e <xh_str_hash+0x1e>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xh_str_hash>:
mov    (%rdi),%rcx
mov    (%rcx),%dl
test   %dl,%dl
je     1128 <xh_str_hash+0x28>
add    $0x1,%rcx
xor    %eax,%eax
nop
mov    %eax,%esi
shl    $0x5,%esi
sub    %eax,%esi
movsbl %dl,%eax
add    %esi,%eax
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <xh_str_hash+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @xh_str_hash(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
store i32 0, i32* %6
%10 = load i8*, i8** %4
br label %11
11: ; preds = %15, %2
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32, i32* %6
%17 = mul nsw i32 %16, 31
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
%20 = load i8, i8* %18
%21 = sext i8 %20 to i32
%22 = add nsw i32 %17, %21
store i32 %22, i32* %6
br label %11
23: ; preds = %11
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
define i32 @xh_str_hash(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %2, %7
%8 = phi i8 [ %15, %7 ], [ %5, %2 ]
%9 = phi i32 [ %14, %7 ], [ 0, %2 ]
%10 = phi i8* [ %12, %7 ], [ %4, %2 ]
%11 = mul nsw i32 %9, 31
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = sext i8 %8 to i32
%14 = add nsw i32 %11, %13
%15 = load i8, i8* %12
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %7
17: ; preds = %7, %2
%18 = phi i32 [ 0, %2 ], [ %14, %7 ]
ret i32 %18
}
void led_on() { *(volatile unsigned long *)0x56000014 = 0x6bf; }


x86 assembly (clang, -O0):
<led_on>:
push   %rbp
mov    %rsp,%rbp
mov    $0x56000014,%eax
movq   $0x6bf,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_on>:
movq   $0x6bf,0x56000014
ret

LLVM IR (-O0):
define void @led_on() {
store volatile i64 1727, i64* inttoptr (i64 1442840596 to i64*)
ret void
}

LLVM IR (-O2):
define void @led_on() {
store volatile i64 1727, i64* inttoptr (i64 1442840596 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0x0a() {
  Assert_real((isgraph(10) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              55, ("isgraph should be 0 for 0x0a"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x0a>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1040 <isgraph@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x37,%edx
lea    0xf5b(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x0a>:
push   %rax
mov    $0xa,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x37,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0x0a\00"
define void @t_isgraph_0x0a() {
%1 = call i64 @isgraph(i32 10)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0x0a\00"
define void @t_isgraph_0x0a() {
%1 = tail call i64 @isgraph(i32 10)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usage(char *);
int help(int argc, char *argv[], void *__attribute__((unused)) config) {
  usage("cmail-admin-popd");
  return -1;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <usage@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <usage@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"cmail-admin-popd\00"
define i32 @help(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = call i32 @usage(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [17 x i8] c"cmail-admin-popd\00"
define i32 @help(i32 %0, i8** nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @usage(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void timestamp() {
  time_t t = time(NULL);
  char *s = asctime(localtime(&t));
  s[strlen(s) - 1] = '\0';
  printf("[%s]", s);
}


x86 assembly (clang, -O0):
<timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1050 <asctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
lea    0xe5c(%rip),%rdi
call   1060 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestamp>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1050 <asctime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xe76(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"[%s]\00"
define void @timestamp() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i32 @localtime(i32* %1)
%5 = call i8* @asctime(i32 %4)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %6, i64 %10
store i8 0, i8* %11
%12 = load i8*, i8** %2
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"[%s]\00"
define void @timestamp() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i32 @localtime(i32* %1)
%5 = call i8* @asctime(i32 %4)
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
store i8 0, i8* %9
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
int test_imm_97uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x97 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_97uint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0x97,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_97uint64_highword_reg>:
movabs $0x9700000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_97uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 151
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_97uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 648540061696
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned char);
void fprint_anl_Rn(FILE *stream, unsigned char n) {
  fprintf(stream, "ANL   A, R%X                     ", n);
}


x86 assembly (clang, -O0):
<fprint_anl_Rn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_anl_Rn>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"ANL A, R%X \00"
define void @fprint_anl_Rn(i32* %0, i8 zeroext %1) {
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 %1, i8* %4
%5 = load i32*, i32** %3
%6 = load i8, i8* %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"ANL A, R%X \00"
define void @fprint_anl_Rn(i32* nocapture %0, i8 zeroext %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t mpga_get_emphasis(const uint8_t *p_mpga) { return p_mpga[3] & 0x03; }


x86 assembly (clang, -O0):
<mpga_get_emphasis>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
and    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpga_get_emphasis>:
mov    0xc(%rdi),%eax
and    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @mpga_get_emphasis(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
%6 = and i32 %5, 3
ret i32 %6
}

LLVM IR (-O2):
define i32 @mpga_get_emphasis(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = and i32 %3, 3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__13__GeneralIO__clr();
void HplSensirionSht11P__SCK__clr(void) { Msp430GpioC__13__GeneralIO__clr(); }


x86 assembly (clang, -O0):
<HplSensirionSht11P__SCK__clr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Msp430GpioC__13__GeneralIO__clr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HplSensirionSht11P__SCK__clr>:
xor    %eax,%eax
jmp    1030 <Msp430GpioC__13__GeneralIO__clr@plt>

LLVM IR (-O0):
define void @HplSensirionSht11P__SCK__clr() {
%1 = call i32 (...) @Msp430GpioC__13__GeneralIO__clr()
ret void
}

LLVM IR (-O2):
define void @HplSensirionSht11P__SCK__clr() {
%1 = tail call i32 (...) @Msp430GpioC__13__GeneralIO__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int k1 = 5 / 2;
  assert(k1 == 2);
  int k2 = -5 / 2;
  assert(k2 == -2);
  int k3 = 5 / -2;
  assert(k3 == -2);
  int k4 = -5 / -2;
  assert(k4 == 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0xfffffffe,-0x8(%rbp)
cmpl   $0xfffffffe,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0xfffffffe,-0xc(%rbp)
cmpl   $0xfffffffe,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x2,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 2, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
store i32 -2, i32* %2
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, -2
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
store i32 -2, i32* %3
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, -2
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
store i32 2, i32* %4
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 2
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
ret i32 0
}
void ipv6_skip_exthdr(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<ipv6_skip_exthdr>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipv6_skip_exthdr>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.ipv6_skip_exthdr = [17 x i8] c"ipv6_skip_exthdr\00"
define void @ipv6_skip_exthdr() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.ipv6_skip_exthdr, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.ipv6_skip_exthdr = [17 x i8] c"ipv6_skip_exthdr\00"
define void @ipv6_skip_exthdr() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__func__.ipv6_skip_exthdr, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void mixedComparisons7(signed char a) {
  int min = (-((~0U) & ((~0U) >> 1)) - 1);
  clang_analyzer_eval((a + 2) >= (min + 5LL));
  clang_analyzer_eval(a == 0);
  clang_analyzer_eval(a == 0x7F);
  clang_analyzer_eval(a == -0x80);
}


x86 assembly (clang, -O0):
<mixedComparisons7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x80000000,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x2,%eax
cltq
movslq -0x8(%rbp),%rcx
add    $0x5,%rcx
cmp    %rcx,%rax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
movsbl -0x1(%rbp),%eax
cmp    $0xffffff80,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mixedComparisons7>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
xor    %edi,%edi
test   %bl,%bl
sete   %dil
call   1030 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmp    $0x7f,%bl
sete   %dil
call   1030 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmp    $0x80,%bl
sete   %dil
pop    %rbx
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @mixedComparisons7(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 -2147483648, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, 2
%7 = sext i32 %6 to i64
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, 5
%11 = icmp sge i64 %7, %10
%12 = zext i1 %11 to i32
%13 = call i32 @clang_analyzer_eval(i32 %12)
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @clang_analyzer_eval(i32 %17)
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 127
%22 = zext i1 %21 to i32
%23 = call i32 @clang_analyzer_eval(i32 %22)
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, -128
%27 = zext i1 %26 to i32
%28 = call i32 @clang_analyzer_eval(i32 %27)
ret void
}

LLVM IR (-O2):
define void @mixedComparisons7(i8 signext %0) {
%2 = tail call i32 @clang_analyzer_eval(i32 1)
%3 = icmp eq i8 %0, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @clang_analyzer_eval(i32 %4)
%6 = icmp eq i8 %0, 127
%7 = zext i1 %6 to i32
%8 = tail call i32 @clang_analyzer_eval(i32 %7)
%9 = icmp eq i8 %0, -128
%10 = zext i1 %9 to i32
%11 = tail call i32 @clang_analyzer_eval(i32 %10)
ret void
}
void init_string(char str[], int size) {
  for (int i = 0; i < size; ++i) {
    str[i] = 0;
  }
}


x86 assembly (clang, -O0):
<init_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1138 <init_string+0x38>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <init_string+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_string>:
test   %esi,%esi
jle    1122 <init_string+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @init_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_string(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void keyPress(unsigned char whichKey, int x, int y) {
  if (whichKey == 27)
    exit(0);
}


x86 assembly (clang, -O0):
<keyPress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1b,%eax
jne    1138 <keyPress+0x28>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyPress>:
cmp    $0x1b,%dil
je     1117 <keyPress+0x7>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @keyPress(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 27
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @keyPress(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int cat(uint32_t sig) {
  int r = 0;
  while (sig) {
    r += (sig % 3) != 0;
    sig /= 3;
  }
  return (r >= ((8) / 2 + 1) ? ((8) / 2 + 1) : r) - 1;
}


x86 assembly (clang, -O0):
<cat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1147 <cat+0x47>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <cat+0xe>
cmpl   $0x5,-0x8(%rbp)
jl     115e <cat+0x5e>
mov    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <cat+0x64>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat>:
xor    %ecx,%ecx
test   %edi,%edi
je     1146 <cat+0x46>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rax
imul   $0x55555556,%rax,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,2),%edx
xor    %esi,%esi
cmp    %edx,%eax
setne  %sil
add    %esi,%ecx
add    $0x2,%eax
cmp    $0x4,%eax
ja     1110 <cat+0x10>
mov    $0x5,%eax
cmp    $0x4,%ecx
ja     1148 <cat+0x48>
mov    %ecx,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @cat(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 3
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
%12 = load i32, i32* %3
%13 = add nsw i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = sdiv i32 %14, 3
store i32 %15, i32* %2
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
%18 = icmp sge i32 %17, 5
br i1 %18, label %19, label %20
19: ; preds = %16
br label %22
20: ; preds = %16
%21 = load i32, i32* %3
br label %22
22: ; preds = %20, %19
%23 = phi i32 [ 5, %19 ], [ %21, %20 ]
%24 = sub nsw i32 %23, 1
ret i32 %24
}

LLVM IR (-O2):
define i32 @cat(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %15, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %10, %3 ], [ %0, %1 ]
%6 = srem i32 %5, 3
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %4, %8
%10 = sdiv i32 %5, 3
%11 = add i32 %5, 2
%12 = icmp ult i32 %11, 5
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = icmp ult i32 %9, 5
br i1 %14, label %15, label %17
15: ; preds = %1, %13
%16 = phi i32 [ %9, %13 ], [ 0, %1 ]
br label %17
17: ; preds = %13, %15
%18 = phi i32 [ %16, %15 ], [ 5, %13 ]
%19 = add nsw i32 %18, -1
ret i32 %19
}
unsigned char int31(int x) {
  x = (unsigned char)1000;
  x = (signed char)0xff;
  x = (unsigned char)-1;
  x = (unsigned long long)-1;
}


x86 assembly (clang, -O0):
<int31>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0xe8,-0x8(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0xff,-0x8(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int31>:
ret

LLVM IR (-O0):
define zeroext i8 @int31(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
store i32 232, i32* %3
store i32 -1, i32* %3
store i32 255, i32* %3
store i32 -1, i32* %3
%4 = load i8, i8* %2
ret i8 %4
}

LLVM IR (-O2):
define zeroext i8 @int31(i32 %0) {
ret i8 undef
}
/* Variables and functions */
scalar_t__ malloc(int);
size_t *nl_xvector_create(size_t n) {
  size_t *v = (size_t *)malloc(sizeof(size_t) * n);
  return v;
}


x86 assembly (clang, -O0):
<nl_xvector_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_xvector_create>:
shl    $0x3,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i64* @nl_xvector_create(i64 %0) {
%2 = alloca i64
%3 = alloca i64*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul i64 8, %4
%6 = trunc i64 %5 to i32
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i64*
store i64* %8, i64** %3
%9 = load i64*, i64** %3
ret i64* %9
}

LLVM IR (-O2):
define i64* @nl_xvector_create(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = shl i32 %2, 3
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i64*
ret i64* %5
}
/* Variables and functions */
double RAND_MAX;
double rand();
double getRandomFloat() { return rand() / (RAND_MAX + 1.0); }


x86 assembly (clang, -O0):
<getRandomFloat>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
movsd  0xedd(%rip),%xmm1
mov    0x2ebe(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomFloat>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec9(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xed5(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @getRandomFloat() {
%1 = call double (...) @rand()
%2 = load double, double* @RAND_MAX
%3 = fadd double %2, 1.000000e+00
%4 = fdiv double %1, %3
ret double %4
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @getRandomFloat() {
%1 = tail call double (...) @rand()
%2 = load double, double* @RAND_MAX
%3 = fadd double %2, 1.000000e+00
%4 = fdiv double %1, %3
ret double %4
}
/* Variables and functions */
float sqrtf(float);
float distance3d(float x, float y, float z, float a, float b, float c) {
  return sqrtf((x - a) * (x - a) + (y - b) * (y - b) + (z - c) * (z - c));
}


x86 assembly (clang, -O0):
<distance3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0x4(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x8(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  -0x8(%rbp),%xmm3
subss  -0x14(%rbp),%xmm3
mulss  %xmm3,%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
subss  -0x18(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance3d>:
subss  %xmm3,%xmm0
subss  %xmm4,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
subss  %xmm5,%xmm2
mulss  %xmm2,%xmm2
addss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jb     1140 <distance3d+0x30>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
ret
movaps %xmm2,%xmm0
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @distance3d(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%13 = load float, float* %7
%14 = load float, float* %10
%15 = fsub float %13, %14
%16 = load float, float* %7
%17 = load float, float* %10
%18 = fsub float %16, %17
%19 = load float, float* %8
%20 = load float, float* %11
%21 = fsub float %19, %20
%22 = load float, float* %8
%23 = load float, float* %11
%24 = fsub float %22, %23
%25 = fmul float %21, %24
%26 = call float @llvm.fmuladd.f32(float %15, float %18, float %25)
%27 = load float, float* %9
%28 = load float, float* %12
%29 = fsub float %27, %28
%30 = load float, float* %9
%31 = load float, float* %12
%32 = fsub float %30, %31
%33 = call float @llvm.fmuladd.f32(float %29, float %32, float %26)
%34 = call float @sqrtf(float %33)
ret float %34
}

LLVM IR (-O2):
define float @distance3d(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fsub float %0, %3
%8 = fsub float %1, %4
%9 = fmul float %8, %8
%10 = tail call float @llvm.fmuladd.f32(float %7, float %7, float %9)
%11 = fsub float %2, %5
%12 = tail call float @llvm.fmuladd.f32(float %11, float %11, float %10)
%13 = tail call float @sqrtf(float %12)
ret float %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void error(char *message) {
  perror(message);
  exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1030 <perror@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
char *SUMO_Version(void) { return "0.92"; }


x86 assembly (clang, -O0):
<SUMO_Version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SUMO_Version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"0.92\00"
define i8* @SUMO_Version() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"0.92\00"
define i8* @SUMO_Version() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}