xunge/DecIR huggingface dataset:
void unalloc_square_matrix(int **m, int n) {
  for (int i = 0; i < n; ++i) {
    free(m[i]);
  }
  free(m);
}


x86 assembly (clang, -O0):
<unalloc_square_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <unalloc_square_matrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <unalloc_square_matrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unalloc_square_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <unalloc_square_matrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <unalloc_square_matrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @unalloc_square_matrix(i32** nocapture %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 %8
6: ; preds = %8, %2
%7 = bitcast i32** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32*, i32** %0, i64 %9
%11 = bitcast i32** %10 to i8**
%12 = load i8*, i8** %11
tail call void @free(i8* %12)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ sqlite3GenericFree(void *);
void *sqlite3GenericRealloc(void *, int);
void *sqlite3_malloc(int);
void *sqlite3_realloc(void *pOld, int nByte) {
  if (pOld) {
    if (nByte > 0) {
      return sqlite3GenericRealloc(pOld, nByte);
    } else {
      sqlite3GenericFree(pOld);
      return 0;
    }
  } else {
    return sqlite3_malloc(nByte);
  }
}


x86 assembly (clang, -O0):
<sqlite3_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117f <sqlite3_realloc+0x4f>
cmpl   $0x0,-0x14(%rbp)
jle    1169 <sqlite3_realloc+0x39>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <sqlite3GenericRealloc@plt>
mov    %rax,-0x8(%rbp)
jmp    118b <sqlite3_realloc+0x5b>
mov    -0x10(%rbp),%rdi
call   1030 <sqlite3GenericFree@plt>
movq   $0x0,-0x8(%rbp)
jmp    118b <sqlite3_realloc+0x5b>
mov    -0x14(%rbp),%edi
call   1040 <sqlite3_malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3_realloc>:
test   %rdi,%rdi
je     113e <sqlite3_realloc+0xe>
test   %esi,%esi
jle    1145 <sqlite3_realloc+0x15>
jmp    1050 <sqlite3GenericRealloc@plt>
mov    %esi,%edi
jmp    1040 <sqlite3_malloc@plt>
push   %rax
call   1030 <sqlite3GenericFree@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @sqlite3_realloc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %18
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = call i8* @sqlite3GenericRealloc(i8* %12, i32 %13)
store i8* %14, i8** %3
br label %21
15: ; preds = %8
%16 = load i8*, i8** %4
%17 = call i32 @sqlite3GenericFree(i8* %16)
store i8* null, i8** %3
br label %21
18: ; preds = %2
%19 = load i32, i32* %5
%20 = call i8* @sqlite3_malloc(i32 %19)
store i8* %20, i8** %3
br label %21
21: ; preds = %18, %15, %11
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
define i8* @sqlite3_realloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i8* @sqlite3GenericRealloc(i8* %0, i32 %1)
br label %12
8: ; preds = %4
%9 = tail call i32 @sqlite3GenericFree(i8* %0)
br label %12
10: ; preds = %2
%11 = tail call i8* @sqlite3_malloc(i32 %1)
br label %12
12: ; preds = %10, %8, %6
%13 = phi i8* [ %7, %6 ], [ null, %8 ], [ %11, %10 ]
ret i8* %13
}
/* Variables and functions */
int /*<<< orphan*/ SSD1306_cleanAll();
int /*<<< orphan*/ SSD1306_writeCmd(int);
void SSD1306_turnOFF() {
  SSD1306_cleanAll();
  SSD1306_writeCmd(0xAE);
}


x86 assembly (clang, -O0):
<SSD1306_turnOFF>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <SSD1306_cleanAll@plt>
mov    $0xae,%edi
call   1030 <SSD1306_writeCmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSD1306_turnOFF>:
push   %rax
xor    %eax,%eax
call   1040 <SSD1306_cleanAll@plt>
mov    $0xae,%edi
pop    %rax
jmp    1030 <SSD1306_writeCmd@plt>

LLVM IR (-O0):
define void @SSD1306_turnOFF() {
%1 = call i32 (...) @SSD1306_cleanAll()
%2 = call i32 @SSD1306_writeCmd(i32 174)
ret void
}

LLVM IR (-O2):
define void @SSD1306_turnOFF() {
%1 = tail call i32 (...) @SSD1306_cleanAll()
%2 = tail call i32 @SSD1306_writeCmd(i32 174)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned long f26(unsigned long x,
                                               unsigned long y) {
  unsigned long r = x + y;
  if (r <= x)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f26>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
ja     1141 <f26+0x31>
xor    %edi,%edi
call   1030 <foo@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f26>:
push   %rbx
mov    %rsi,%rbx
add    %rdi,%rbx
cmp    %rdi,%rbx
ja     1123 <f26+0x13>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @f26(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = add i64 %6, %7
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i64, i64* %3
%11 = icmp ule i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @foo(i32 0)
br label %14
14: ; preds = %12, %2
%15 = load i64, i64* %5
ret i64 %15
}

LLVM IR (-O2):
define i64 @f26(i64 %0, i64 %1) {
%3 = add i64 %1, %0
%4 = icmp ugt i64 %3, %0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @foo(i32 0)
br label %7
7: ; preds = %5, %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int myprint(int n, int f) {
  int i;
  printf("%08x:\n%08x:", n, f);
  return (n + f);
}


x86 assembly (clang, -O0):
<myprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myprint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xee2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%08x:\0A%08x:\00"
define i32 @myprint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
@.str = [12 x i8] c"%08x:\0A%08x:\00"
define i32 @myprint(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = add nsw i32 %1, %0
ret i32 %4
}
void dlmalloc_walk_free_pages() {}


x86 assembly (clang, -O0):
<dlmalloc_walk_free_pages>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @dlmalloc_walk_free_pages() {
ret void
}

LLVM IR (-O2):
define void @dlmalloc_walk_free_pages() {
ret void
}
void c_vector3_invert(float *vector) {
  vector[0] = -vector[0];
  vector[1] = -vector[1];
  vector[2] = -vector[2];
}


x86 assembly (clang, -O0):
<c_vector3_invert>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_vector3_invert>:
movaps 0xef9(%rip),%xmm0
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm2
movss  0x8(%rdi),%xmm3
xorps  %xmm0,%xmm1
movss  %xmm1,(%rdi)
xorps  %xmm0,%xmm2
movss  %xmm2,0x4(%rdi)
xorps  %xmm0,%xmm3
movss  %xmm3,0x8(%rdi)
ret

LLVM IR (-O0):
define void @c_vector3_invert(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = fneg float %5
%7 = load float*, float** %2
%8 = getelementptr inbounds float, float* %7, i64 0
store float %6, float* %8
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
%12 = fneg float %11
%13 = load float*, float** %2
%14 = getelementptr inbounds float, float* %13, i64 1
store float %12, float* %14
%15 = load float*, float** %2
%16 = getelementptr inbounds float, float* %15, i64 2
%17 = load float, float* %16
%18 = fneg float %17
%19 = load float*, float** %2
%20 = getelementptr inbounds float, float* %19, i64 2
store float %18, float* %20
ret void
}

LLVM IR (-O2):
define void @c_vector3_invert(float* nocapture %0) {
%2 = load float, float* %0
%3 = fneg float %2
store float %3, float* %0
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = fneg float %5
store float %6, float* %4
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = fneg float %8
store float %9, float* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void read_stdin_to_buffer(char *buffer) { fgets(buffer, 200, stdin); }


x86 assembly (clang, -O0):
<read_stdin_to_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1030 <fgets@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_stdin_to_buffer>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
jmp    1030 <fgets@plt>

LLVM IR (-O0):
@stdin = global i32 0
define void @read_stdin_to_buffer(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 200, i32 %4)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @read_stdin_to_buffer(i8* %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @fgets(i8* %0, i32 200, i32 %2)
ret void
}
void GLT_DeSelectList() {}


x86 assembly (clang, -O0):
<GLT_DeSelectList>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @GLT_DeSelectList() {
ret void
}

LLVM IR (-O2):
define void @GLT_DeSelectList() {
ret void
}
void arch_gdb_breakpoint(void) { asm("   int $3"); }


x86 assembly (clang, -O0):
<arch_gdb_breakpoint>:
push   %rbp
mov    %rsp,%rbp
int3
pop    %rbp
ret

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

LLVM IR (-O0):
define void @arch_gdb_breakpoint() {
ret void
}

LLVM IR (-O2):
define void @arch_gdb_breakpoint() {
tail call void asm sideeffect " int $$3", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int _findRecursiveVersion(int index, int array[], int length, int value) {
  if (index == length)
    return -1;
  if (value == array[index])
    return index;
  return _findRecursiveVersion(index + 1, array, length, value);
}


x86 assembly (clang, -O0):
<_findRecursiveVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    113d <_findRecursiveVersion+0x2d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <_findRecursiveVersion+0x64>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x8(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    115c <_findRecursiveVersion+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <_findRecursiveVersion+0x64>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <_findRecursiveVersion@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_findRecursiveVersion>:
mov    $0xffffffff,%eax
cmp    %edx,%edi
je     111f <_findRecursiveVersion+0x1f>
movslq %edi,%r8
lea    (%rsi,%r8,4),%rsi
cmp    %ecx,(%rsi)
je     1120 <_findRecursiveVersion+0x20>
add    $0x1,%edi
add    $0x4,%rsi
cmp    %edi,%edx
jne    1110 <_findRecursiveVersion+0x10>
ret
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @_findRecursiveVersion(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 -1, i32* %5
br label %31
14: ; preds = %4
%15 = load i32, i32* %9
%16 = load i32*, i32** %7
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %15, %20
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = load i32, i32* %6
store i32 %23, i32* %5
br label %31
24: ; preds = %14
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
%27 = load i32*, i32** %7
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = call i32 @_findRecursiveVersion(i32 %26, i32* %27, i32 %28, i32 %29)
store i32 %30, i32* %5
br label %31
31: ; preds = %24, %22, %13
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
define i32 @_findRecursiveVersion(i32 %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %2
br i1 %5, label %19, label %6
6: ; preds = %4
%7 = sext i32 %0 to i64
br label %8
8: ; preds = %6, %13
%9 = phi i64 [ %7, %6 ], [ %14, %13 ]
%10 = getelementptr inbounds i32, i32* %1, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, %3
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = add nsw i64 %9, 1
%15 = trunc i64 %14 to i32
%16 = icmp eq i32 %15, %2
br i1 %16, label %19, label %8
17: ; preds = %8
%18 = trunc i64 %9 to i32
br label %19
19: ; preds = %13, %17, %4
%20 = phi i32 [ -1, %4 ], [ %18, %17 ], [ -1, %13 ]
ret i32 %20
}
void proc_call_1(int p0) {}


x86 assembly (clang, -O0):
<proc_call_1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @proc_call_1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @proc_call_1(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ pow(int, int);
int get_ith_dgt(int num, int i) {
  return num % (int)pow(10, i + 1) / (int)pow(10, i);
}


x86 assembly (clang, -O0):
<get_ith_dgt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ith_dgt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0x1(%rbx),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %edx,%ebp
mov    $0xa,%edi
mov    %ebx,%esi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
cltd
idiv   %ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_ith_dgt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i64 @pow(i32 10, i32 %7)
%9 = trunc i64 %8 to i32
%10 = srem i32 %5, %9
%11 = load i32, i32* %4
%12 = call i64 @pow(i32 10, i32 %11)
%13 = trunc i64 %12 to i32
%14 = sdiv i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @get_ith_dgt(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @pow(i32 10, i32 %3)
%5 = trunc i64 %4 to i32
%6 = srem i32 %0, %5
%7 = tail call i64 @pow(i32 10, i32 %1)
%8 = trunc i64 %7 to i32
%9 = sdiv i32 %6, %8
ret i32 %9
}
double sub_double(double arg1, double arg2) { return arg1 - arg2; }


x86 assembly (clang, -O0):
<sub_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_double>:
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sub_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @sub_double(double %0, double %1) {
%3 = fsub double %0, %1
ret double %3
}
char *getString(void *p) { return (char *)p; }


x86 assembly (clang, -O0):
<getString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getString>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @getString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* %3
}

LLVM IR (-O2):
define i8* @getString(i8* readnone returned %0) {
ret i8* %0
}
long int longint_ignoring_signedlonglong(long int x, signed long long y) {
  return x;
}


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

x86 assembly (clang, -O2):
<longint_ignoring_signedlonglong>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @longint_ignoring_signedlonglong(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @longint_ignoring_signedlonglong(i64 returned %0, i64 %1) {
ret i64 %0
}
/* Variables and functions */
int /*<<< orphan*/ oosmos_DelayMS(int);
int /*<<< orphan*/ oosmos_RunStateMachines();
int /*<<< orphan*/ threadtestNew();
extern int main(void) {
  for (unsigned I = 1; I <= 1; I++) {
    (void)threadtestNew();
  }
  for (;;) {
    oosmos_RunStateMachines();
    oosmos_DelayMS(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
ja     1165 <main+0x35>
mov    $0x0,%al
call   1030 <threadtestNew@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
jmp    116a <main+0x3a>
mov    $0x0,%al
call   1050 <oosmos_RunStateMachines@plt>
mov    $0x1,%edi
call   1040 <oosmos_DelayMS@plt>
jmp    116a <main+0x3a>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <threadtestNew@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <oosmos_RunStateMachines@plt>
mov    $0x1,%edi
call   1040 <oosmos_DelayMS@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* %2
%5 = icmp ule i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 (...) @threadtestNew()
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
br label %12
12: ; preds = %12, %11
%13 = call i32 (...) @oosmos_RunStateMachines()
%14 = call i32 @oosmos_DelayMS(i32 1)
br label %12
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @threadtestNew()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @oosmos_RunStateMachines()
%4 = tail call i32 @oosmos_DelayMS(i32 1)
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ set_keepalive(int, int, int, int);
int client_in_callback(int sock, char *ip, void *param) {
  printf("client from %s\n", ip);
  set_keepalive(sock, 60, 6, 10);
  return 0;
}


x86 assembly (clang, -O0):
<client_in_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x3c,%esi
mov    $0x6,%edx
mov    $0xa,%ecx
call   1030 <set_keepalive@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_in_callback>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
mov    %ebx,%edi
mov    $0x3c,%esi
mov    $0x6,%edx
mov    $0xa,%ecx
call   1030 <set_keepalive@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"client from %s\0A\00"
define i32 @client_in_callback(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 = load i8*, i8** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %4
%10 = call i32 @set_keepalive(i32 %9, i32 60, i32 6, i32 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"client from %s\0A\00"
define i32 @client_in_callback(i32 %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = tail call i32 @set_keepalive(i32 %0, i32 60, i32 6, i32 10)
ret i32 0
}
int comparator(const void *item_1, const void *item_2) {
  int value_1, value_2;
  value_1 = *((int *)item_1);
  value_2 = *((int *)item_2);
  if (value_1 < value_2) {
    return -1;
  } else if (value_1 == value_2) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <comparator+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <comparator+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <comparator+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <comparator+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comparator>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @comparator(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void CatchSigUsr2(int signo) {
  extern void RotateLogs();
  RotateLogs();
}


x86 assembly (clang, -O0):
<CatchSigUsr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <RotateLogs@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @CatchSigUsr2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @CatchSigUsr2(i32 %0) {
tail call void (...) @RotateLogs()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
char *realloc(char *, int /*<<< orphan*/);
void reallocSizeZero3() {
  char *p = malloc(12);
  char *r = realloc(p, 0);
  free(r);
}


x86 assembly (clang, -O0):
<reallocSizeZero3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocSizeZero3>:
push   %rax
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
call   1050 <realloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @reallocSizeZero3() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @malloc(i32 12)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i8* @realloc(i8* %4, i32 0)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
ret void
}

LLVM IR (-O2):
define void @reallocSizeZero3() {
%1 = tail call dereferenceable_or_null(12) i8* @malloc(i32 12)
%2 = tail call i8* @realloc(i8* %1, i32 0)
%3 = tail call i32 @free(i8* %2)
ret void
}
/* Variables and functions */
scalar_t__ isspace(int);
int getnewline1(char **line) {
  char *c = *line;
  while (isspace((int)*c))
    c++;
  *line = c;
  if (*c == 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<getnewline1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     114e <getnewline1+0x3e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1127 <getnewline1+0x17>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1175 <getnewline1+0x65>
movl   $0x0,-0x4(%rbp)
jmp    117c <getnewline1+0x6c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnewline1>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
add    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <getnewline1+0x10>
mov    %rbx,(%r14)
xor    %eax,%eax
cmpb   $0x0,(%rbx)
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @getnewline1(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %3, %1
%4 = phi i8* [ %2, %1 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = tail call i64 @isspace(i32 %6)
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
store i8* %4, i8** %0
%11 = load i8, i8* %4
%12 = icmp ne i8 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
packetsend(s, pkt) int s;
char *pkt;
{
  switch (_sendpacket(s, pkt)) {
  case 1:
    break;
  case 0:
    disconnectuser(s);
    break;
  case -1:
    disconnectuser(s);
    break;
  case -2:
    disconnectuser(s);
    break;
  }
}


x86 assembly (clang, -O0):
<packetsend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
call   1040 <_sendpacket@plt>
add    $0x2,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     1190 <packetsend+0x70>
mov    -0x18(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1190 <packetsend+0x70>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <disconnectuser@plt>
jmp    1190 <packetsend+0x70>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <disconnectuser@plt>
jmp    1190 <packetsend+0x70>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <disconnectuser@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packetsend>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <_sendpacket@plt>
add    $0x2,%eax
cmp    $0x2,%eax
ja     113b <packetsend+0x1b>
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <disconnectuser@plt>
pop    %rbx
ret

LLVM IR (-O0):
define i32 @packetsend(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = load i8*, i8** %5
%8 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @_sendpacket to i32 (i32, i8*, ...)*)(i32 %6, i8* %7)
switch i32 %8, label %19 [
i32 1, label %9
i32 0, label %10
i32 -1, label %13
i32 -2, label %16
]
9: ; preds = %2
br label %19
10: ; preds = %2
%11 = load i32, i32* %4
%12 = call i32 (i32, ...) bitcast (i32 (...)* @disconnectuser to i32 (i32, ...)*)(i32 %11)
br label %19
13: ; preds = %2
%14 = load i32, i32* %4
%15 = call i32 (i32, ...) bitcast (i32 (...)* @disconnectuser to i32 (i32, ...)*)(i32 %14)
br label %19
16: ; preds = %2
%17 = load i32, i32* %4
%18 = call i32 (i32, ...) bitcast (i32 (...)* @disconnectuser to i32 (i32, ...)*)(i32 %17)
br label %19
19: ; preds = %2, %16, %13, %10, %9
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @packetsend(i32 %0, i8* %1) {
%3 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @_sendpacket to i32 (i32, i8*, ...)*)(i32 %0, i8* %1)
switch i32 %3, label %6 [
i32 -2, label %4
i32 0, label %4
i32 -1, label %4
]
4: ; preds = %2, %2, %2
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @disconnectuser to i32 (i32, ...)*)(i32 %0)
br label %6
6: ; preds = %4, %2
ret i32 undef
}
int char_to_int(char character) {
  if (character < '0' || character > '9')
    return (-1);
  return (character - '0');
}


x86 assembly (clang, -O0):
<char_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1124 <char_to_int+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    1130 <char_to_int+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    113a <char_to_int+0x3a>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_to_int>:
lea    -0x3a(%rdi),%eax
lea    -0x30(%rdi),%ecx
cmp    $0xf6,%al
mov    $0xffffffff,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @char_to_int(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 48
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sgt i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 -1, i32* %2
br label %16
12: ; preds = %7
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 48
store i32 %15, i32* %2
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @char_to_int(i8 signext %0) {
%2 = add i8 %0, -58
%3 = icmp ult i8 %2, -10
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = select i1 %3, i32 -1, i32 %5
ret i32 %6
}
/* Variables and functions */
char *U_EMR_CORE5(int);
char *U_EMRSETMETARGN_set(void) { return (U_EMR_CORE5(28)); }


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

x86 assembly (clang, -O2):
<U_EMRSETMETARGN_set>:
mov    $0x1c,%edi
jmp    1030 <U_EMR_CORE5@plt>

LLVM IR (-O0):
define i8* @U_EMRSETMETARGN_set() {
%1 = call i8* @U_EMR_CORE5(i32 28)
ret i8* %1
}

LLVM IR (-O2):
define i8* @U_EMRSETMETARGN_set() {
%1 = tail call i8* @U_EMR_CORE5(i32 28)
ret i8* %1
}
unsigned xrop3_100_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T | S;
  stk2 = D & stk3;
  stk1 = S ^ stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_100_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = or i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %5
%27 = load i32, i32* %10
%28 = and i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %6
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %7
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = and i32 %39, %40
%42 = or i32 %38, %41
%43 = load i32, i32* %5
%44 = load i32, i32* %7
%45 = and i32 %43, %44
%46 = or i32 %42, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @xrop3_100_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Type definitions */
struct device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
int intel_svm_unbind_mm(struct device *dev, int pasid) { BUG(); }


x86 assembly (clang, -O0):
<intel_svm_unbind_mm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    $0x0,%al
call   1030 <BUG@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.device = type { i32 }
define i32 @intel_svm_unbind_mm(%struct.device* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.device*
%5 = alloca i32
store %struct.device* %0, %struct.device** %4
store i32 %1, i32* %5
%6 = call i32 (...) @BUG()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
%struct.device = type { i32 }
define i32 @intel_svm_unbind_mm(%struct.device* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (...) @BUG()
ret i32 undef
}
float __ocl_convert_float_int(int src) { return (float)src; }


x86 assembly (clang, -O0):
<__ocl_convert_float_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_convert_float_int>:
cvtsi2ss %edi,%xmm0
ret

LLVM IR (-O0):
define float @__ocl_convert_float_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @__ocl_convert_float_int(i32 %0) {
%2 = sitofp i32 %0 to float
ret float %2
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ranged_random_revmult(scalar_t__);
void loop_revmult_linear(size_t count, uint32_t range, uint32_t *output) {
  for (size_t i = 0; i < count; i++) {
    *output++ = ranged_random_revmult(range + i);
  }
}


x86 assembly (clang, -O0):
<loop_revmult_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    116d <loop_revmult_linear+0x5d>
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
call   1030 <ranged_random_revmult@plt>
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112c <loop_revmult_linear+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop_revmult_linear>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1148 <loop_revmult_linear+0x38>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r15,%rbx,1),%rdi
call   1030 <ranged_random_revmult@plt>
cltq
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <loop_revmult_linear+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @loop_revmult_linear(i64 %0, i64 %1, i64* nocapture writeonly %2) {
%4 = icmp eq i64 %0, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %3
ret void
6: ; preds = %3, %6
%7 = phi i64 [ %13, %6 ], [ 0, %3 ]
%8 = phi i64* [ %12, %6 ], [ %2, %3 ]
%9 = add i64 %7, %1
%10 = tail call i32 @ranged_random_revmult(i64 %9)
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i64, i64* %8, i64 1
store i64 %11, i64* %8
%13 = add nuw i64 %7, 1
%14 = icmp eq i64 %13, %0
br i1 %14, label %5, label %6
}
void interrupt_enable(void) { __asm__ volatile("sti"); }


x86 assembly (clang, -O0):
<interrupt_enable>:
push   %rbp
mov    %rsp,%rbp
sti
pop    %rbp
ret

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

LLVM IR (-O0):
define void @interrupt_enable() {
ret void
}

LLVM IR (-O2):
define void @interrupt_enable() {
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int test_imm_7Duint16_reg(unsigned short val) {
  return ((val) & (-0x7D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Duint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff83,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_7Duint16_reg>:
test   $0xff83,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_7Duint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -125
%6 = icmp ne i32 %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_7Duint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -125
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int rnd_32int();
long rnd_31int(void) { return (long)(rnd_32int() >> 1); }


x86 assembly (clang, -O0):
<rnd_31int>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rnd_32int@plt>
sar    $0x1,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd_31int>:
push   %rax
xor    %eax,%eax
call   1030 <rnd_32int@plt>
sar    %eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @rnd_31int() {
%1 = call i32 (...) @rnd_32int()
%2 = ashr i32 %1, 1
%3 = sext i32 %2 to i64
ret i64 %3
}

LLVM IR (-O2):
define i64 @rnd_31int() {
%1 = tail call i32 (...) @rnd_32int()
%2 = ashr i32 %1, 1
%3 = sext i32 %2 to i64
ret i64 %3
}
void stackInit(int S[]) { S[0] = 0; }


x86 assembly (clang, -O0):
<stackInit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<stackInit>:
movl   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @stackInit(i32* nocapture writeonly %0) {
store i32 0, i32* %0
ret void
}
int main() { return 2 - 3; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 -1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 -1
}
unsigned xrop3_10_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = ~T;
  stk1 = D & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_10_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_10_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
not    %eax
and    %esi,%eax
xor    $0xff,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_10_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = xor i32 %22, -1
store i32 %23, i32* %9
%24 = load i32, i32* %5
%25 = load i32, i32* %9
%26 = and i32 %24, %25
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = load i32, i32* %6
%29 = and i32 %27, %28
%30 = load i32, i32* %8
%31 = load i32, i32* %7
%32 = xor i32 %31, -1
%33 = and i32 %30, %32
%34 = or i32 %29, %33
%35 = load i32, i32* %7
%36 = load i32, i32* %6
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %5
%40 = and i32 %38, %39
%41 = or i32 %34, %40
ret i32 %41
}

LLVM IR (-O2):
define i32 @xrop3_10_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = xor i32 %5, 255
%7 = xor i32 %4, -1
%8 = and i32 %7, %5
%9 = or i32 %8, %6
ret i32 %9
}
/* Type definitions */
struct lobject {
  int dummy;
};
struct lemon {
  int dummy;
};

/* Variables and functions */
struct lobject *machine_throw(struct lemon *, struct lobject *);
struct lobject *lemon_machine_throw(struct lemon *lemon,
                                    struct lobject *exception) {
  return machine_throw(lemon, exception);
}


x86 assembly (clang, -O0):
<lemon_machine_throw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <machine_throw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lemon_machine_throw>:
jmp    1030 <machine_throw@plt>

LLVM IR (-O0):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @lemon_machine_throw(%struct.lemon* %0, %struct.lobject* %1) {
%3 = alloca %struct.lemon*
%4 = alloca %struct.lobject*
store %struct.lemon* %0, %struct.lemon** %3
store %struct.lobject* %1, %struct.lobject** %4
%5 = load %struct.lemon*, %struct.lemon** %3
%6 = load %struct.lobject*, %struct.lobject** %4
%7 = call %struct.lobject* @machine_throw(%struct.lemon* %5, %struct.lobject* %6)
ret %struct.lobject* %7
}

LLVM IR (-O2):
%struct.lemon = type { i32 }
%struct.lobject = type { i32 }
define %struct.lobject* @lemon_machine_throw(%struct.lemon* %0, %struct.lobject* %1) {
%3 = tail call %struct.lobject* @machine_throw(%struct.lemon* %0, %struct.lobject* %1)
ret %struct.lobject* %3
}