xunge/DecIR huggingface dataset:
int intscmp(int tab1[], int tab2[], int size) {
  int i;
  for (i = 0; i < size; i++)
    if (tab1[i] != tab2[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<intscmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <intscmp+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     114a <intscmp+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1164 <intscmp+0x64>
jmp    114f <intscmp+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <intscmp+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intscmp>:
mov    $0x1,%eax
test   %edx,%edx
jle    1121 <intscmp+0x21>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
mov    (%rdi,%rdx,4),%ecx
cmp    (%rsi,%rdx,4),%ecx
jne    1122 <intscmp+0x22>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <intscmp+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @intscmp(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp eq i32 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
void division(unsigned U, signed S) {
  if (S > 5)
    S = U / S;
  if (S < -10)
    S = U / S;
}


x86 assembly (clang, -O0):
<division>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jle    111f <division+0x1f>
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %eax,-0x8(%rbp)
cmpl   $0xfffffff6,-0x8(%rbp)
jge    1134 <division+0x34>
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @division(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 5
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = udiv i32 %8, %9
store i32 %10, i32* %4
br label %11
11: ; preds = %7, %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, -10
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = udiv i32 %15, %16
store i32 %17, i32* %4
br label %18
18: ; preds = %14, %11
ret void
}

LLVM IR (-O2):
define void @division(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int sscanf(char *, char *, int *, float *);
double parse_lat(char *str) {
  int deg;
  float min;
  int ret;
  ret = sscanf(str, "%2i%f", &deg, &min);
  if (ret != 2)
    return 0;
  return deg + (min / 60.0);
}


x86 assembly (clang, -O0):
<parse_lat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xee1(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <sscanf@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
je     114e <parse_lat+0x3e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1171 <parse_lat+0x61>
cvtsi2sdl -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe9c(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_lat>:
push   %rax
lea    0xef0(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
call   1030 <sscanf@plt>
xorpd  %xmm0,%xmm0
cmp    $0x2,%eax
jne    1149 <parse_lat+0x39>
cvtsi2sdl 0x4(%rsp),%xmm1
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xebb(%rip),%xmm0
addsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%2i%f\00"
define double @parse_lat(i8* %0) {
%2 = alloca double
%3 = alloca i8*
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %4, float* %5)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %1
store double 0.000000e+00, double* %2
br label %19
12: ; preds = %1
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = load float, float* %5
%16 = fpext float %15 to double
%17 = fdiv double %16, 6.000000e+01
%18 = fadd double %14, %17
store double %18, double* %2
br label %19
19: ; preds = %12, %11
%20 = load double, double* %2
ret double %20
}

LLVM IR (-O2):
@.str = [6 x i8] c"%2i%f\00"
define double @parse_lat(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca float
%4 = bitcast i32* %2 to i8*
%5 = bitcast float* %3 to i8*
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, float* %3)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = load float, float* %3
%12 = fpext float %11 to double
%13 = fdiv double %12, 6.000000e+01
%14 = fadd double %13, %10
br label %15
15: ; preds = %1, %8
%16 = phi double [ %14, %8 ], [ 0.000000e+00, %1 ]
ret double %16
}
/* Variables and functions */
int /*<<< orphan*/ voronoi(float, float, float, float *, float *, int,
                           int /*<<< orphan*/);
float voronoi_F4(float x, float y, float z) {
  float da[4], pa[12];
  voronoi(x, y, z, da, pa, 1, 0);
  return da[3];
}


x86 assembly (clang, -O0):
<voronoi_F4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
lea    -0x20(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <voronoi@plt>
movss  -0x14(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<voronoi_F4>:
sub    $0x48,%rsp
mov    %rsp,%rdi
lea    0x10(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <voronoi@plt>
movss  0xc(%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define float @voronoi_F4(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca [4 x float]
%8 = alloca [12 x float]
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%9 = load float, float* %4
%10 = load float, float* %5
%11 = load float, float* %6
%12 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 0
%13 = getelementptr inbounds [12 x float], [12 x float]* %8, i64 0, i64 0
%14 = call i32 @voronoi(float %9, float %10, float %11, float* %12, float* %13, i32 1, i32 0)
%15 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 3
%16 = load float, float* %15
ret float %16
}

LLVM IR (-O2):
define float @voronoi_F4(float %0, float %1, float %2) {
%4 = alloca [4 x float]
%5 = alloca [12 x float]
%6 = bitcast [4 x float]* %4 to i8*
%7 = bitcast [12 x float]* %5 to i8*
%8 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 0
%9 = getelementptr inbounds [12 x float], [12 x float]* %5, i64 0, i64 0
%10 = call i32 @voronoi(float %0, float %1, float %2, float* %8, float* %9, i32 1, i32 0)
%11 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 3
%12 = load float, float* %11
ret float %12
}
int valid_idchar(char c) {
  return (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9');
}


x86 assembly (clang, -O0):
<valid_idchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1129 <valid_idchar+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <valid_idchar+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <valid_idchar+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_idchar>:
lea    -0x41(%rdi),%eax
cmp    $0x1a,%al
setb   %al
add    $0xd0,%dil
cmp    $0xa,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @valid_idchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 48
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 57
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @valid_idchar(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -48
%5 = icmp ult i8 %4, 10
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
char EOF;
char getchar();
int /*<<< orphan*/ putchar(char);
main() {
  char c;
  c = getchar();
  while (c != EOF) {
    putchar(c);
    c = getchar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    0x2ea4(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1167 <main+0x47>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1139 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%al
je     1153 <main+0x33>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%al
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
br label %4
4: ; preds = %10, %0
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = load i8, i8* %2
%12 = call i32 @putchar(i8 signext %11)
%13 = call signext i8 (...) @getchar()
store i8 %13, i8* %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i8 signext %5)
%7 = tail call signext i8 (...) @getchar()
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __enable_irq();
__attribute__((always_)) void __enable_excp_irq(void) { __enable_irq(); }


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

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

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

LLVM IR (-O2):
define void @__enable_excp_irq() {
%1 = tail call i32 (...) @__enable_irq()
ret void
}
/* Type definitions */
typedef char wchar_t;

/* Variables and functions */
int wctomb(char *s, wchar_t w) {
  if (s == 0)
    return 0;
  if ((unsigned)w > (unsigned char)-1)
    return -1;
  if ((*s = w) == 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<wctomb>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1125 <wctomb+0x25>
movl   $0x0,-0x4(%rbp)
jmp    1168 <wctomb+0x68>
movsbl -0x11(%rbp),%eax
cmp    $0xff,%eax
jbe    1140 <wctomb+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <wctomb+0x68>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
jne    1161 <wctomb+0x61>
movl   $0x0,-0x4(%rbp)
jmp    1168 <wctomb+0x68>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wctomb>:
test   %rdi,%rdi
je     1114 <wctomb+0x14>
test   %sil,%sil
js     1117 <wctomb+0x17>
mov    %sil,(%rdi)
setne  %al
movzbl %al,%eax
ret
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @wctomb(i8* writeonly %0, i8 signext %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = icmp slt i8 %1, 0
br i1 %5, label %9, label %6
6: ; preds = %4
store i8 %1, i8* %0
%7 = icmp ne i8 %1, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %6, %4, %2
%10 = phi i32 [ 0, %2 ], [ -1, %4 ], [ %8, %6 ]
ret i32 %10
}
void *get_zimage_start() {
  int diff;
  void *flash_end;
  extern unsigned __etext;
  extern unsigned __data_start__;
  extern unsigned __data_end__;
  diff = &__data_end__ - &__data_start__;
  flash_end = &__etext + diff;
  return flash_end;
}


x86 assembly (clang, -O0):
<get_zimage_start>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    0x2ec6(%rip),%rcx
sub    %rcx,%rax
mov    0x2ebc(%rip),%rcx
mov    0x2ead(%rip),%rax
sub    %rcx,%rax
shr    $0x2,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
mov    0x2eb0(%rip),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_zimage_start>:
mov    0x2ec9(%rip),%rax
sub    0x2eca(%rip),%rax
lea    0x3(%rax),%rcx
test   %rax,%rax
cmovns %rax,%rcx
shr    $0x2,%rcx
movslq %ecx,%rax
shl    $0x2,%rax
add    0x2ebd(%rip),%rax
ret

LLVM IR (-O0):
@__data_end__ = external global i32
@__data_start__ = external global i32
@__etext = external global i32
define i8* @get_zimage_start() {
%1 = alloca i32
%2 = alloca i8*
store i32 trunc (i64 sdiv exact (i64 sub (i64 ptrtoint (i32* @__data_end__ to i64), i64 ptrtoint (i32* @__data_start__ to i64)), i64 4) to i32), i32* %1
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* @__etext, i64 %4
%6 = bitcast i32* %5 to i8*
store i8* %6, i8** %2
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@__data_end__ = external global i32
@__data_start__ = external global i32
@__etext = external global i32
define i8* @get_zimage_start() {
ret i8* bitcast (i32* getelementptr inbounds (i32, i32* @__etext, i64 sext (i32 trunc (i64 sdiv (i64 sub (i64 ptrtoint (i32* @__data_end__ to i64), i64 ptrtoint (i32* @__data_start__ to i64)), i64 4) to i32) to i64)) to i8*)
}
int is_in_bound(int *arr, int size, int *ptr) {
  if ((ptr - arr < 0) || (ptr - arr > size)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_in_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmp    $0x0,%rax
jl     1144 <is_in_bound+0x44>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jle    1150 <is_in_bound+0x50>
movl   $0x0,-0x4(%rbp)
jmp    1157 <is_in_bound+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bound>:
sub    %rdi,%rdx
setns  %al
sar    $0x2,%rdx
movslq %esi,%rcx
cmp    %rcx,%rdx
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_in_bound(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%8 = load i32*, i32** %7
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %8 to i64
%11 = ptrtoint i32* %9 to i64
%12 = sub i64 %10, %11
%13 = sdiv exact i64 %12, 4
%14 = icmp slt i64 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %3
%16 = load i32*, i32** %7
%17 = load i32*, i32** %5
%18 = ptrtoint i32* %16 to i64
%19 = ptrtoint i32* %17 to i64
%20 = sub i64 %18, %19
%21 = sdiv exact i64 %20, 4
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = icmp sgt i64 %21, %23
br i1 %24, label %25, label %26
25: ; preds = %15, %3
store i32 0, i32* %4
br label %27
26: ; preds = %15
store i32 1, i32* %4
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @is_in_bound(i32* %0, i32 %1, i32* %2) {
%4 = ptrtoint i32* %2 to i64
%5 = ptrtoint i32* %0 to i64
%6 = sub i64 %4, %5
%7 = icmp sgt i64 %6, -1
%8 = ashr exact i64 %6, 2
%9 = sext i32 %1 to i64
%10 = icmp sle i64 %8, %9
%11 = select i1 %7, i1 %10, i1 false
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(short *);
short *init_board();
int /*<<< orphan*/ show(short *);
int /*<<< orphan*/ update(short *);
int main() {
  short *board = init_board();
  update(board);
  show(board);
  free(board);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <init_board@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <update@plt>
mov    -0x10(%rbp),%rdi
call   1060 <show@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <init_board@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <update@plt>
mov    %rbx,%rdi
call   1060 <show@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16*
store i32 0, i32* %1
%3 = call i16* (...) @init_board()
store i16* %3, i16** %2
%4 = load i16*, i16** %2
%5 = call i32 @update(i16* %4)
%6 = load i16*, i16** %2
%7 = call i32 @show(i16* %6)
%8 = load i16*, i16** %2
%9 = call i32 @free(i16* %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i16* (...) @init_board()
%2 = tail call i32 @update(i16* %1)
%3 = tail call i32 @show(i16* %1)
%4 = tail call i32 @free(i16* %1)
ret i32 0
}
void pass() {}


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

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

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

LLVM IR (-O2):
define void @pass() {
ret void
}
/* Variables and functions */
int *return_null(int **out) {
  int *p = NULL;
  *out = p;
  return p;
}


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

x86 assembly (clang, -O2):
<return_null>:
movq   $0x0,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32* @return_null(i32** %0) {
%2 = alloca i32**
%3 = alloca i32*
store i32** %0, i32*** %2
store i32* null, i32** %3
%4 = load i32*, i32** %3
%5 = load i32**, i32*** %2
store i32* %4, i32** %5
%6 = load i32*, i32** %3
ret i32* %6
}

LLVM IR (-O2):
define noalias i32* @return_null(i32** nocapture writeonly %0) {
store i32* null, i32** %0
ret i32* null
}
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ write(int, void const *, size_t);
void persistent_write(int fd, const void *ptr, size_t size) {
  while (size > 0) {
    ssize_t result = write(fd, ptr, size);
    assert(result >= 0);
    size -= result;
  }
}


x86 assembly (clang, -O0):
<persistent_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    1178 <persistent_write+0x58>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1133 <persistent_write+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<persistent_write>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rdx,%rdx
je     1165 <persistent_write+0x45>
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <write@plt>
mov    %rax,%rbp
mov    %rax,%rdi
shr    $0x3f,%rdi
xor    $0x1,%edi
call   1040 <assert@plt>
sub    %rbp,%rbx
jne    1140 <persistent_write+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @persistent_write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
br label %8
8: ; preds = %11, %3
%9 = load i64, i64* %6
%10 = icmp ugt i64 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %8
%12 = load i32, i32* %4
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = call i64 @write(i32 %12, i8* %13, i64 %14)
store i64 %15, i64* %7
%16 = load i64, i64* %7
%17 = icmp sge i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i64, i64* %7
%21 = load i64, i64* %6
%22 = sub i64 %21, %20
store i64 %22, i64* %6
br label %8
23: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @persistent_write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %14, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %12, %5 ], [ %2, %3 ]
%7 = tail call i64 @write(i32 %0, i8* %1, i64 %6)
%8 = lshr i64 %7, 63
%9 = trunc i64 %8 to i32
%10 = xor i32 %9, 1
%11 = tail call i32 @assert(i32 %10)
%12 = sub i64 %6, %7
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %3
ret void
}
void three() {}


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

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

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

LLVM IR (-O2):
define void @three() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(float *, int, int, int /*<<< orphan*/ *);
void input_vec(char *fName, float *h_vec, int dim) {
  FILE *fid = fopen(fName, "rb");
  fread(h_vec, sizeof(float), dim, fid);
  fclose(fid);
}


x86 assembly (clang, -O0):
<input_vec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x4,%esi
call   1030 <fread@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_vec>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0xebf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define void @input_vec(i8* %0, float* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store float* %1, float** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load float*, float** %5
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = call i32 @fread(float* %10, i32 4, i32 %11, i32* %12)
%14 = load i32*, i32** %7
%15 = call i32 @fclose(i32* %14)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define void @input_vec(i8* nocapture %0, float* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @fread(float* %1, i32 4, i32 %2, i32* %4)
%6 = tail call i32 @fclose(i32* %4)
ret void
}
const char *__malidrv_build_info(void) {
  return "malidrv:  API_VERSION=401 REPO_URL= REVISION= CHANGED_REVISION= "
         "CHANGE_DATE= BUILD_DATE=Суб Июн 20 16:10:16 EEST 2015 BUILD=debug "
         "TARGET_PLATFORM= MALI_PLATFORM= KDIR= "
         "OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= "
         "USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 "
         "USING_POWER_PERFORMANCE_POLICY= MALI_UPPER_HALF_SCHEDULING=1";
}


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

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

LLVM IR (-O0):
@.str = [351 x i8] c"malidrv: API_VERSION=401 REPO_URL= REVISION= CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=\D0\A1\D1\83\D0\B1 \D0\98\D1\8E\D0\BD 20 16:10:16 EEST 2015 BUILD=debug TARGET_PLATFORM= MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 USING_POWER_PERFORMANCE_POLICY= MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([351 x i8], [351 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [351 x i8] c"malidrv: API_VERSION=401 REPO_URL= REVISION= CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=\D0\A1\D1\83\D0\B1 \D0\98\D1\8E\D0\BD 20 16:10:16 EEST 2015 BUILD=debug TARGET_PLATFORM= MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 USING_POWER_PERFORMANCE_POLICY= MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([351 x i8], [351 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
uint16_t maxu16(uint16_t a, uint16_t b) { return ((a) < (b) ? (a) : (b)); }


x86 assembly (clang, -O0):
<maxu16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <maxu16+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <maxu16+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxu16>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @maxu16(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
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @maxu16(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ keyPressed(unsigned char, int /*<<< orphan*/,
                              int /*<<< orphan*/);
void menu(int value) { keyPressed((unsigned char)value, 0, 0); }


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    %edx,%edx
movzbl %al,%edi
mov    %edx,%esi
call   1030 <keyPressed@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
movzbl %dil,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <keyPressed@plt>

LLVM IR (-O0):
define void @menu(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = call i32 @keyPressed(i8 zeroext %4, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @menu(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i32 @keyPressed(i8 zeroext %2, i32 0, i32 0)
ret void
}
extern void get_guidance(double time, struct sensordata *sensorData_ptr,
                         struct nav *navData_ptr,
                         struct control *controlData_ptr,
                         struct mission *missionData_ptr) {}


x86 assembly (clang, -O0):
<get_guidance>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sensordata = type opaque
%struct.nav = type opaque
%struct.control = type opaque
%struct.mission = type opaque
define void @get_guidance(double %0, %struct.sensordata* %1, %struct.nav* %2, %struct.control* %3, %struct.mission* %4) {
%6 = alloca double
%7 = alloca %struct.sensordata*
%8 = alloca %struct.nav*
%9 = alloca %struct.control*
%10 = alloca %struct.mission*
store double %0, double* %6
store %struct.sensordata* %1, %struct.sensordata** %7
store %struct.nav* %2, %struct.nav** %8
store %struct.control* %3, %struct.control** %9
store %struct.mission* %4, %struct.mission** %10
ret void
}

LLVM IR (-O2):
%struct.sensordata = type opaque
%struct.nav = type opaque
%struct.control = type opaque
%struct.mission = type opaque
define void @get_guidance(double %0, %struct.sensordata* nocapture %1, %struct.nav* nocapture %2, %struct.control* nocapture %3, %struct.mission* nocapture %4) {
ret void
}
int ls_hook_mcheck() { return -1; }


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

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

LLVM IR (-O0):
define i32 @ls_hook_mcheck() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @ls_hook_mcheck() {
ret i32 -1
}
/* Variables and functions */
double f(double, int);
int i(int, double);
void main(void) {
  int x;
  int y[5];
  x = y[i(3 + 7, 4.27)] - i(i(3, 4.7), 4.5 + f(38.92, 51));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0xa,%edi
movsd  0xee3(%rip),%xmm0
call   1040 <i@plt>
cltq
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x24(%rbp)
mov    $0x3,%edi
movsd  0xec0(%rip),%xmm0
call   1040 <i@plt>
mov    %eax,-0x28(%rbp)
movsd  0xea8(%rip),%xmm0
mov    $0x33,%edi
call   1030 <f@plt>
mov    -0x28(%rbp),%edi
movaps %xmm0,%xmm1
movsd  0xe88(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1040 <i@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xed7(%rip),%xmm0
mov    $0xa,%edi
call   1040 <i@plt>
movsd  0xecd(%rip),%xmm0
mov    $0x3,%edi
call   1040 <i@plt>
mov    %eax,%ebx
movsd  0xec1(%rip),%xmm0
mov    $0x33,%edi
call   1030 <f@plt>
addsd  0xeb7(%rip),%xmm0
mov    %ebx,%edi
pop    %rbx
jmp    1040 <i@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = call i32 @i(i32 10, double 4.270000e+00)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = call i32 @i(i32 3, double 4.700000e+00)
%8 = call double @f(double 3.892000e+01, i32 51)
%9 = fadd double 4.500000e+00, %8
%10 = call i32 @i(i32 %7, double %9)
%11 = sub nsw i32 %6, %10
store i32 %11, i32* %1
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @i(i32 10, double 4.270000e+00)
%2 = tail call i32 @i(i32 3, double 4.700000e+00)
%3 = tail call double @f(double 3.892000e+01, i32 51)
%4 = fadd double %3, 4.500000e+00
%5 = tail call i32 @i(i32 %2, double %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printw(char *);
void ion_cmd_mode(char *cmd) { printw("\n\rmode command\n\r\n\r"); }


x86 assembly (clang, -O0):
<ion_cmd_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ion_cmd_mode>:
lea    0xee9(%rip),%rdi
jmp    1030 <printw@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"\0A\0Dmode command\0A\0D\0A\0D\00"
define void @ion_cmd_mode(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printw(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0A\0Dmode command\0A\0D\0A\0D\00"
define void @ion_cmd_mode(i8* nocapture readnone %0) {
%2 = tail call i32 @printw(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(void *, int /*<<< orphan*/ *, int);
void voip_writeInt32(int32_t v, void *p) {
  v = htonl(v);
  memcpy(p, &v, 4);
}


x86 assembly (clang, -O0):
<voip_writeInt32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<voip_writeInt32>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
call   1030 <htonl@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @voip_writeInt32(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = call i32 @htonl(i32 %5)
store i32 %6, i32* %3
%7 = load i8*, i8** %4
%8 = call i32 @memcpy(i8* %7, i32* %3, i32 4)
ret void
}

LLVM IR (-O2):
define void @voip_writeInt32(i32 %0, i8* %1) {
%3 = alloca i32
%4 = tail call i32 @htonl(i32 %0)
store i32 %4, i32* %3
%5 = call i32 @memcpy(i8* %1, i32* %3, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcasecmp(char *, char *);
int is_reserved_word(char *s) {
  return !strcasecmp(s, "or") || !strcasecmp(s, "and");
}


x86 assembly (clang, -O0):
<is_reserved_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcasecmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1157 <is_reserved_word+0x47>
mov    -0x8(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_reserved_word>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     113e <is_reserved_word+0x2e>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"or\00"
@.str.1 = [4 x i8] c"and\00"
define i32 @is_reserved_word(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcasecmp(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strcasecmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br label %11
11: ; preds = %6, %1
%12 = phi i1 [ true, %1 ], [ %10, %6 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"or\00"
@.str.1 = [4 x i8] c"and\00"
define i32 @is_reserved_word(i8* nocapture %0) {
%2 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
struct hconf_node {
  int dummy;
};

/* Variables and functions */
char *hconf_get_string(struct hconf_node *, char const *, int /*<<< orphan*/ *);
double warp_strtod(char const *, double);
double hconf_get_double(struct hconf_node *node, const char *key, double def) {
  const char *value = hconf_get_string(node, key, NULL);
  if (value) {
    return warp_strtod(value, def);
  }
  return def;
}


x86 assembly (clang, -O0):
<hconf_get_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <hconf_get_string@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     116d <hconf_get_double+0x4d>
mov    -0x28(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1040 <warp_strtod@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1177 <hconf_get_double+0x57>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hconf_get_double>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %edx,%edx
call   1030 <hconf_get_string@plt>
test   %rax,%rax
je     1140 <hconf_get_double+0x20>
mov    %rax,%rdi
movsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <warp_strtod@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.hconf_node = type { i32 }
define double @hconf_get_double(%struct.hconf_node* %0, i8* %1, double %2) {
%4 = alloca double
%5 = alloca %struct.hconf_node*
%6 = alloca i8*
%7 = alloca double
%8 = alloca i8*
store %struct.hconf_node* %0, %struct.hconf_node** %5
store i8* %1, i8** %6
store double %2, double* %7
%9 = load %struct.hconf_node*, %struct.hconf_node** %5
%10 = load i8*, i8** %6
%11 = call i8* @hconf_get_string(%struct.hconf_node* %9, i8* %10, i32* null)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i8*, i8** %8
%16 = load double, double* %7
%17 = call double @warp_strtod(i8* %15, double %16)
store double %17, double* %4
br label %20
18: ; preds = %3
%19 = load double, double* %7
store double %19, double* %4
br label %20
20: ; preds = %18, %14
%21 = load double, double* %4
ret double %21
}

LLVM IR (-O2):
%struct.hconf_node = type { i32 }
define double @hconf_get_double(%struct.hconf_node* %0, i8* %1, double %2) {
%4 = tail call i8* @hconf_get_string(%struct.hconf_node* %0, i8* %1, i32* null)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call double @warp_strtod(i8* %4, double %2)
br label %8
8: ; preds = %3, %6
%9 = phi double [ %7, %6 ], [ %2, %3 ]
ret double %9
}
int md_pre_mount(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @md_pre_mount() {
ret i32 0
}

LLVM IR (-O2):
define i32 @md_pre_mount() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(void) {
  printf("watchdog-ctl %s\n"
         "Usage: watchdog-ctl [options]\n"
         "--daemon - run as daemon\n"
         "-e or --enable - enable watchdog timer\n"
         "-d or --disable - disable watchdog timer\n"
         "-s <arg> or --set-timeout <arg> - set timeout to watchdog timer\n"
         "-g or --get-timeout - get timeout for watchdog timer\n"
         "-r or --reset - reset watchdog timer\n"
         "-l or --loop - reset watchdog timer in infinity loop\n"
         "-h or --help - show this message and exit\n",
         "1.1");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0x106f(%rip),%rsi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rdi
lea    0x1073(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [401 x i8] c"watchdog-ctl %s\0AUsage: watchdog-ctl [options]\0A--daemon - run as daemon\0A-e or --enable - enable watchdog timer\0A-d or --disable - disable watchdog timer\0A-s <arg> or --set-timeout <arg> - set timeout to watchdog timer\0A-g or --get-timeout - get timeout for watchdog timer\0A-r or --reset - reset watchdog timer\0A-l or --loop - reset watchdog timer in infinity loop\0A-h or --help - show this message and exit\0A\00"
@.str.1 = [4 x i8] c"1.1\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([401 x i8], [401 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [401 x i8] c"watchdog-ctl %s\0AUsage: watchdog-ctl [options]\0A--daemon - run as daemon\0A-e or --enable - enable watchdog timer\0A-d or --disable - disable watchdog timer\0A-s <arg> or --set-timeout <arg> - set timeout to watchdog timer\0A-g or --get-timeout - get timeout for watchdog timer\0A-r or --reset - reset watchdog timer\0A-l or --loop - reset watchdog timer in infinity loop\0A-h or --help - show this message and exit\0A\00"
@.str.1 = [4 x i8] c"1.1\00"
define void @usage() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([401 x i8], [401 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void spawn_free(void *base) {
  free(base);
  return;
}


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

x86 assembly (clang, -O2):
<spawn_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @spawn_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @spawn_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void print_usage(const char *name) {
  printf("USAGE:\n");
  printf("\t%s SAT <solver-output> <problem.cnf>\n", name);
  printf("\t%s UNSAT <solver-output> <problem.cnf>\n\n", name);
  exit(0);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"USAGE:\0A\00"
@.str.1 = [39 x i8] c"\09%s SAT <solver-output> <problem.cnf>\0A\00"
@.str.2 = [42 x i8] c"\09%s UNSAT <solver-output> <problem.cnf>\0A\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.1 = [39 x i8] c"\09%s SAT <solver-output> <problem.cnf>\0A\00"
@.str.2 = [42 x i8] c"\09%s UNSAT <solver-output> <problem.cnf>\0A\0A\00"
@str = [7 x i8] c"USAGE:\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(char, int);
int /*<<< orphan*/ ft_putstr_fd(char const *, int);
void ft_putendl_fd(const char *s, int fd) {
  ft_putstr_fd(s, fd);
  ft_putchar_fd('\n', fd);
}


x86 assembly (clang, -O0):
<ft_putendl_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <ft_putstr_fd@plt>
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1040 <ft_putchar_fd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl_fd>:
push   %rbx
mov    %esi,%ebx
call   1030 <ft_putstr_fd@plt>
mov    $0xa,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <ft_putchar_fd@plt>

LLVM IR (-O0):
define void @ft_putendl_fd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @ft_putstr_fd(i8* %5, i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @ft_putchar_fd(i8 signext 10, i32 %8)
ret void
}

LLVM IR (-O2):
define void @ft_putendl_fd(i8* %0, i32 %1) {
%3 = tail call i32 @ft_putstr_fd(i8* %0, i32 %1)
%4 = tail call i32 @ft_putchar_fd(i8 signext 10, i32 %1)
ret void
}