xunge/DecIR huggingface dataset:
int whoIsFirst(int age1, int age2, int (*func)(int, int)) {
  return func(age1, age2);
}


x86 assembly (clang, -O0):
<whoIsFirst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whoIsFirst>:
jmp    *%rdx

LLVM IR (-O0):
define i32 @whoIsFirst(i32 %0, i32 %1, i32 (i32, i32)* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32 (i32, i32)*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 (i32, i32)* %2, i32 (i32, i32)** %6
%7 = load i32 (i32, i32)*, i32 (i32, i32)** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 %7(i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @whoIsFirst(i32 %0, i32 %1, i32 (i32, i32)* nocapture %2) {
%4 = tail call i32 %2(i32 %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ error(int, char *, char const *);
void ws_fatal(const char *message) { error(1, "FATAL", message); }


x86 assembly (clang, -O0):
<ws_fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xed4(%rip),%rsi
call   1030 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ws_fatal>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rsi
mov    $0x1,%edi
jmp    1030 <error@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"FATAL\00"
define void @ws_fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @error(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"FATAL\00"
define void @ws_fatal(i8* %0) {
%2 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int hash(char *s) {
  int i, sum = 0;
  for (i = 0; s[i] != '\0'; i++)
    sum += (s[i] - '0') * i;
  return sum % 11231;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1152 <hash+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <hash+0x16>
mov    -0x10(%rbp),%eax
mov    $0x2bdf,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%dl
xor    %eax,%eax
test   %dl,%dl
je     1149 <hash+0x49>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movsbl %dl,%edx
add    $0xffffffd0,%edx
mov    %eax,%esi
imul   %edx,%esi
add    %esi,%ecx
movzbl 0x1(%rdi,%rax,1),%edx
add    $0x1,%rax
test   %dl,%dl
jne    1110 <hash+0x10>
movslq %ecx,%rax
imul   $0x5d5d4bcb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2bdf,%ecx,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %13, %4 ], [ 0, %1 ]
%6 = phi i8 [ %15, %4 ], [ %2, %1 ]
%7 = phi i32 [ %12, %4 ], [ 0, %1 ]
%8 = sext i8 %6 to i32
%9 = add nsw i32 %8, -48
%10 = trunc i64 %5 to i32
%11 = mul nsw i32 %9, %10
%12 = add nsw i32 %11, %7
%13 = add nuw nsw i64 %5, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4
%18 = srem i32 %12, 11231
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 0, %1 ], [ %18, %17 ]
ret i32 %20
}
diff(s1, s2) char *s1, *s2;
{
  while (1) {
    if (*s1 == 0 && *s2 == 0)
      return (0);
    if (*s1 != *s2)
      return (1);
    s1++;
    s2++;
  }
}


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1138 <diff+0x38>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1138 <diff+0x38>
movl   $0x0,-0x4(%rbp)
jmp    1177 <diff+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     115a <diff+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1177 <diff+0x77>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <diff+0xc>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
mov    (%rdi),%r8b
mov    (%rsi),%r9b
xor    %eax,%eax
mov    %r8d,%ecx
or     %r9b,%cl
je     113b <diff+0x3b>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r9b,%r8b
jne    113c <diff+0x3c>
movzbl (%rdi,%rcx,1),%r8d
movzbl (%rsi,%rcx,1),%r9d
add    $0x1,%rcx
mov    %r8d,%edx
or     %r9b,%dl
jne    1120 <diff+0x20>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @diff(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 0
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %22, label %8
8: ; preds = %2, %14
%9 = phi i8 [ %19, %14 ], [ %5, %2 ]
%10 = phi i8 [ %17, %14 ], [ %3, %2 ]
%11 = phi i8* [ %16, %14 ], [ %1, %2 ]
%12 = phi i8* [ %15, %14 ], [ %0, %2 ]
%13 = icmp eq i8 %10, %9
br i1 %13, label %14, label %22
14: ; preds = %8
%15 = getelementptr inbounds i8, i8* %12, i64 1
%16 = getelementptr inbounds i8, i8* %11, i64 1
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
%19 = load i8, i8* %16
%20 = icmp eq i8 %19, 0
%21 = select i1 %18, i1 %20, i1 false
br i1 %21, label %22, label %8
22: ; preds = %8, %14, %2
%23 = phi i32 [ 0, %2 ], [ 1, %8 ], [ 0, %14 ]
ret i32 %23
}
int IDE2() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @IDE2() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cgpop2();
int /*<<< orphan*/ cgxor();
int /*<<< orphan*/ gentext();
void genxor(void) {
  gentext();
  cgpop2();
  cgxor();
}


x86 assembly (clang, -O0):
<genxor>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <gentext@plt>
mov    $0x0,%al
call   1030 <cgpop2@plt>
mov    $0x0,%al
call   1050 <cgxor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<genxor>:
push   %rax
xor    %eax,%eax
call   1040 <gentext@plt>
xor    %eax,%eax
call   1030 <cgpop2@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <cgxor@plt>

LLVM IR (-O0):
define void @genxor() {
%1 = call i32 (...) @gentext()
%2 = call i32 (...) @cgpop2()
%3 = call i32 (...) @cgxor()
ret void
}

LLVM IR (-O2):
define void @genxor() {
%1 = tail call i32 (...) @gentext()
%2 = tail call i32 (...) @cgpop2()
%3 = tail call i32 (...) @cgxor()
ret void
}
/* Variables and functions */
char *GC_malloc_atomic(unsigned int);
unsigned int StringLeng(char const *);
int /*<<< orphan*/ StringPrint(char *, char const *);
char *PrintString(const char *str) {
  char *ptr;
  unsigned leng;
  leng = StringLeng(str);
  ptr = GC_malloc_atomic(leng + 1);
  StringPrint(ptr, str);
  return ptr;
}


x86 assembly (clang, -O0):
<PrintString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <StringLeng@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1030 <GC_malloc_atomic@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <StringPrint@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <StringLeng@plt>
lea    0x1(%rax),%edi
call   1030 <GC_malloc_atomic@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <StringPrint@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @PrintString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @StringLeng(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = add i32 %7, 1
%9 = call i8* @GC_malloc_atomic(i32 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = call i32 @StringPrint(i8* %10, i8* %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @PrintString(i8* %0) {
%2 = tail call i32 @StringLeng(i8* %0)
%3 = add i32 %2, 1
%4 = tail call i8* @GC_malloc_atomic(i32 %3)
%5 = tail call i32 @StringPrint(i8* %4, i8* %0)
ret i8* %4
}
float bin_to_ori(float bin, int nbins) {
  float ori = (bin + 0.5) * 2 * 3.14159265358979323846 / (float)nbins;
  if (ori > 3.14159265358979323846)
    ori -= 2 * 3.14159265358979323846;
  return ori;
}


x86 assembly (clang, -O0):
<bin_to_ori>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xedf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecb(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1188 <bin_to_ori+0x88>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_to_ori>:
cvtss2sd %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
addsd  %xmm0,%xmm0
movsd  0xef0(%rip),%xmm2
mulsd  %xmm2,%xmm0
cvtsi2ss %edi,%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jbe    1148 <bin_to_ori+0x48>
addsd  0xecf(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @bin_to_ori(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca float
store float %0, float* %3
store i32 %1, i32* %4
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = fadd double %7, 5.000000e-01
%9 = fmul double %8, 2.000000e+00
%10 = fmul double %9, 0x400921FB54442D18
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to float
%13 = fpext float %12 to double
%14 = fdiv double %10, %13
%15 = fptrunc double %14 to float
store float %15, float* %5
%16 = load float, float* %5
%17 = fpext float %16 to double
%18 = fcmp ogt double %17, 0x400921FB54442D18
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = fsub double %21, 0x401921FB54442D18
%23 = fptrunc double %22 to float
store float %23, float* %5
br label %24
24: ; preds = %19, %2
%25 = load float, float* %5
ret float %25
}

LLVM IR (-O2):
define float @bin_to_ori(float %0, i32 %1) {
%3 = fpext float %0 to double
%4 = fadd double %3, 5.000000e-01
%5 = fmul double %4, 2.000000e+00
%6 = fmul double %5, 0x400921FB54442D18
%7 = sitofp i32 %1 to float
%8 = fpext float %7 to double
%9 = fdiv double %6, %8
%10 = fptrunc double %9 to float
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 0x400921FB54442D18
%13 = fadd double %11, 0xC01921FB54442D18
%14 = fptrunc double %13 to float
%15 = select i1 %12, float %14, float %10
ret float %15
}
/* Variables and functions */
int /*<<< orphan*/ ZowiTone(int, int, int, int);
void S_connection() {
  ZowiTone(10, 659.26, 50, 30);
  ZowiTone(10, 1318.51, 50, 30);
  ZowiTone(10, 1760, 50, 30);
}


x86 assembly (clang, -O0):
<S_connection>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
mov    $0x293,%esi
mov    $0x32,%edx
mov    $0x1e,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x526,%esi
mov    $0x32,%edx
mov    $0x1e,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x6e0,%esi
mov    $0x32,%edx
mov    $0x1e,%ecx
call   1030 <ZowiTone@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_connection>:
push   %rax
mov    $0xa,%edi
mov    $0x293,%esi
mov    $0x32,%edx
mov    $0x1e,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x526,%esi
mov    $0x32,%edx
mov    $0x1e,%ecx
call   1030 <ZowiTone@plt>
mov    $0xa,%edi
mov    $0x6e0,%esi
mov    $0x32,%edx
mov    $0x1e,%ecx
pop    %rax
jmp    1030 <ZowiTone@plt>

LLVM IR (-O0):
define void @S_connection() {
%1 = call i32 @ZowiTone(i32 10, i32 659, i32 50, i32 30)
%2 = call i32 @ZowiTone(i32 10, i32 1318, i32 50, i32 30)
%3 = call i32 @ZowiTone(i32 10, i32 1760, i32 50, i32 30)
ret void
}

LLVM IR (-O2):
define void @S_connection() {
%1 = tail call i32 @ZowiTone(i32 10, i32 659, i32 50, i32 30)
%2 = tail call i32 @ZowiTone(i32 10, i32 1318, i32 50, i32 30)
%3 = tail call i32 @ZowiTone(i32 10, i32 1760, i32 50, i32 30)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ str_rev(char *, char *);
int str_cmp(char *f_str_2, char *f_str_1) {
  int flag;
  flag = 0;
  str_rev(f_str_2, f_str_1);
  while ((*f_str_2++ != *f_str_1++)) {
    flag = 1;
    break;
  }
  return flag;
}


x86 assembly (clang, -O0):
<str_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <str_rev@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1167 <str_cmp+0x57>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_cmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <str_rev@plt>
mov    (%rbx),%cl
xor    %eax,%eax
cmp    (%r14),%cl
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @str_cmp(i8* %0, i8* %1) {
%3 = tail call i32 @str_rev(i8* %0, i8* %1)
%4 = load i8, i8* %0
%5 = load i8, i8* %1
%6 = icmp ne i8 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *);
int sys_arch_prctl(int, unsigned long);
int /*<<< orphan*/ sys_exit(int);
void backend_set_tls(void *ptr) {
  int err;
  err = sys_arch_prctl(0x1002, (unsigned long)ptr);
  if (err) {
    debug("Failed to set FS\n");
    sys_exit(1);
  }
}


x86 assembly (clang, -O0):
<backend_set_tls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x1002,%edi
call   1050 <sys_arch_prctl@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116d <backend_set_tls+0x3d>
lea    0xea2(%rip),%rdi
call   1040 <debug@plt>
mov    $0x1,%edi
call   1030 <sys_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backend_set_tls>:
push   %rax
mov    %rdi,%rsi
mov    $0x1002,%edi
call   1050 <sys_arch_prctl@plt>
test   %eax,%eax
je     1159 <backend_set_tls+0x29>
lea    0xeb7(%rip),%rdi
call   1040 <debug@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <sys_exit@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Failed to set FS\0A\00"
define void @backend_set_tls(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = call i32 @sys_arch_prctl(i32 4098, i64 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @debug(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @sys_exit(i32 1)
br label %12
12: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Failed to set FS\0A\00"
define void @backend_set_tls(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @sys_arch_prctl(i32 4098, i64 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @debug(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @sys_exit(i32 1)
br label %8
8: ; preds = %5, %1
ret void
}
char *ft_strchr(const char *s, int c) {
  while (*s) {
    if (*s == (char)c)
      return ((char *)s);
    s++;
  }
  return ((char)c == 0 ? (char *)s : (char *)0);
}


x86 assembly (clang, -O0):
<ft_strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <ft_strchr+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    113a <ft_strchr+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117a <ft_strchr+0x7a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <ft_strchr+0xb>
mov    -0x14(%rbp),%eax
movsbl %al,%eax
cmp    $0x0,%eax
jne    1167 <ft_strchr+0x67>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1172 <ft_strchr+0x72>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1172 <ft_strchr+0x72>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strchr>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <ft_strchr+0x23>
movsbl %sil,%edx
nopl   (%rax)
movsbl %cl,%ecx
cmp    %ecx,%edx
je     112c <ft_strchr+0x2c>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <ft_strchr+0x10>
xor    %ecx,%ecx
test   %sil,%sil
cmovne %rcx,%rax
ret

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

LLVM IR (-O2):
define i8* @ft_strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %13
%9 = phi i8 [ %3, %5 ], [ %15, %13 ]
%10 = phi i8* [ %0, %5 ], [ %14, %13 ]
%11 = sext i8 %9 to i32
%12 = icmp eq i32 %7, %11
br i1 %12, label %22, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %13, %2
%18 = phi i8* [ %0, %2 ], [ %14, %13 ]
%19 = and i32 %1, 255
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8* %18, i8* null
br label %22
22: ; preds = %8, %17
%23 = phi i8* [ %21, %17 ], [ %10, %8 ]
ret i8* %23
}
int test_45_4(int *mem) { return __atomic_fetch_sub(mem + 4, 1, 4); }


x86 assembly (clang, -O0):
<test_45_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
neg    %eax
lock xadd %eax,0x10(%rcx)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_45_4>:
mov    $0xffffffff,%eax
lock xadd %eax,0x10(%rdi)
ret

LLVM IR (-O0):
define i32 @test_45_4(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 4
store i32 1, i32* %3
%7 = load i32, i32* %3
%8 = atomicrmw sub i32* %6, i32 %7 acq_rel
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_45_4(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = atomicrmw sub i32* %2, i32 1 acq_rel
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ OpenReadFile(char const *, int /*<<< orphan*/);
void signal_post(const char *file) { OpenReadFile(file, O_RDONLY); }


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

x86 assembly (clang, -O2):
<signal_post>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <OpenReadFile@plt>

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

LLVM IR (-O2):
@O_RDONLY = global i32 0
define void @signal_post(i8* %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @OpenReadFile(i8* %0, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ getpw(int /*<<< orphan*/, char *);
void check(uid_t uid) {
  char buf[1024];
  (void)getpw(uid, buf);
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
call   1030 <getpw@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
sub    $0x408,%rsp
mov    %rsp,%rsi
call   1030 <getpw@plt>
add    $0x408,%rsp
ret

LLVM IR (-O0):
define void @check(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = call i32 @getpw(i32 %4, i8* %5)
ret void
}

LLVM IR (-O2):
define void @check(i32 %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @getpw(i32 %0, i8* %3)
ret void
}
float Temtrans(float f) { return (5.0 / 9.0) * (f - 32.0); }


x86 assembly (clang, -O0):
<Temtrans>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeee(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xeda(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Temtrans>:
cvtss2sd %xmm0,%xmm0
addsd  0xef4(%rip),%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @Temtrans(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fsub double %4, 3.200000e+01
%6 = fmul double 0x3FE1C71C71C71C72, %5
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @Temtrans(float %0) {
%2 = fpext float %0 to double
%3 = fadd double %2, -3.200000e+01
%4 = fmul double %3, 0x3FE1C71C71C71C72
%5 = fptrunc double %4 to float
ret float %5
}
/* Variables and functions */
int print_uart0(char const *);
int puts(const char *s) { return print_uart0(s); }


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

x86 assembly (clang, -O2):
<puts>:
jmp    1030 <print_uart0@plt>

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

LLVM IR (-O2):
define i32 @puts(i8* %0) {
%2 = tail call i32 @print_uart0(i8* %0)
ret i32 %2
}
void percpu_pagelist_fraction_sysctl_handler(void) { nsc_assert(0, __func__); }


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

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

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

LLVM IR (-O2):
@__func__.percpu_pagelist_fraction_sysctl_handler = [40 x i8] c"percpu_pagelist_fraction_sysctl_handler\00"
define void @percpu_pagelist_fraction_sysctl_handler() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @__func__.percpu_pagelist_fraction_sysctl_handler, i64 0, i64 0))
ret void
}
int prec(char c) {
  if (c == '^') {
    return 3;
  } else if (c == '*' || c == '/') {
    return 2;
  } else if (c == '+' || c == '-') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<prec>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x5e,%eax
jne    1123 <prec+0x23>
movl   $0x3,-0x4(%rbp)
jmp    1176 <prec+0x76>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     113d <prec+0x3d>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
jne    1149 <prec+0x49>
movl   $0x2,-0x4(%rbp)
jmp    1176 <prec+0x76>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     1163 <prec+0x63>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    116f <prec+0x6f>
movl   $0x1,-0x4(%rbp)
jmp    1176 <prec+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prec>:
lea    -0x2a(%rdi),%eax
cmp    $0x5,%al
ja     1127 <prec+0x27>
movzbl %al,%eax
lea    0xeef(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2,%eax
ret
mov    $0x1,%eax
jmp    1132 <prec+0x32>
mov    $0x3,%eax
cmp    $0x5e,%dil
jne    1133 <prec+0x33>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @prec(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 eq i32 %5, 94
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 3, i32* %2
br label %27
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 42
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 47
br i1 %15, label %16, label %17
16: ; preds = %12, %8
store i32 2, i32* %2
br label %27
17: ; preds = %12
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 43
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 45
br i1 %24, label %25, label %26
25: ; preds = %21, %17
store i32 1, i32* %2
br label %27
26: ; preds = %21
store i32 0, i32* %2
br label %27
27: ; preds = %26, %25, %16, %7
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @prec(i8 signext %0) {
switch i8 %0, label %2 [
i8 94, label %5
i8 47, label %3
i8 42, label %3
i8 45, label %4
i8 43, label %4
]
2: ; preds = %1
br label %5
3: ; preds = %1, %1
br label %5
4: ; preds = %1, %1
br label %5
5: ; preds = %1, %4, %3, %2
%6 = phi i32 [ 0, %2 ], [ 3, %1 ], [ 2, %3 ], [ 1, %4 ]
ret i32 %6
}
float LinearInterpolation(float p) { return p; }


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

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

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

LLVM IR (-O2):
define float @LinearInterpolation(float returned %0) {
ret float %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void die(const char *why) {
  perror(why);
  exit(1);
}


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

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int mpu_write_mem(int, int, unsigned char *);
int dmp_set_tap_count(unsigned char min_taps) {
  unsigned char tmp;
  if (min_taps < 1)
    min_taps = 1;
  else if (min_taps > 4)
    min_taps = 4;
  tmp = min_taps - 1;
  return mpu_write_mem((256 + 79), 1, &tmp);
}


x86 assembly (clang, -O0):
<dmp_set_tap_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jge    1134 <dmp_set_tap_count+0x24>
movb   $0x1,-0x1(%rbp)
jmp    114a <dmp_set_tap_count+0x3a>
movzbl -0x1(%rbp),%eax
cmp    $0x4,%eax
jle    1145 <dmp_set_tap_count+0x35>
movb   $0x4,-0x1(%rbp)
jmp    114a <dmp_set_tap_count+0x3a>
movzbl -0x1(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0x2(%rbp)
mov    $0x14f,%edi
mov    $0x1,%esi
lea    -0x2(%rbp),%rdx
call   1030 <mpu_write_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmp_set_tap_count>:
push   %rax
cmp    $0x4,%dil
mov    $0x4,%eax
cmovb  %edi,%eax
add    $0xff,%al
test   %edi,%edi
movzbl %al,%eax
cmove  %edi,%eax
mov    %al,0x7(%rsp)
lea    0x7(%rsp),%rdx
mov    $0x14f,%edi
mov    $0x1,%esi
call   1030 <mpu_write_mem@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dmp_set_tap_count(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 1, i8* %2
br label %14
8: ; preds = %1
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = icmp sgt i32 %10, 4
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 4, i8* %2
br label %13
13: ; preds = %12, %8
br label %14
14: ; preds = %13, %7
%15 = load i8, i8* %2
%16 = zext i8 %15 to i32
%17 = sub nsw i32 %16, 1
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
%19 = call i32 @mpu_write_mem(i32 335, i32 1, i8* %3)
ret i32 %19
}

LLVM IR (-O2):
define i32 @dmp_set_tap_count(i8 zeroext %0) {
%2 = alloca i8
%3 = icmp eq i8 %0, 0
%4 = icmp ult i8 %0, 4
%5 = select i1 %4, i8 %0, i8 4
%6 = add nsw i8 %5, -1
%7 = select i1 %3, i8 0, i8 %6
store i8 %7, i8* %2
%8 = call i32 @mpu_write_mem(i32 335, i32 1, i8* %2)
ret i32 %8
}
void arriba(int x, int y, int mat[3][3]) {
  mat[x][y] = mat[x - 1][y];
  mat[x - 1][y] = 0;
}


x86 assembly (clang, -O0):
<arriba>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<arriba>:
lea    -0x1(%rdi),%eax
cltq
movslq %esi,%rcx
lea    (%rax,%rax,2),%rax
lea    (%rdx,%rax,4),%rax
mov    (%rax,%rcx,4),%esi
movslq %edi,%rdi
lea    (%rdi,%rdi,2),%rdi
lea    (%rdx,%rdi,4),%rdx
mov    %esi,(%rdx,%rcx,4)
movl   $0x0,(%rax,%rcx,4)
ret

LLVM IR (-O0):
define void @arriba(i32 %0, i32 %1, [3 x i32]* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i32]*
store i32 %0, i32* %4
store i32 %1, i32* %5
store [3 x i32]* %2, [3 x i32]** %6
%7 = load [3 x i32]*, [3 x i32]** %6
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 %10
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = load [3 x i32]*, [3 x i32]** %6
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %16, i64 %18
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 %21
store i32 %15, i32* %22
%23 = load [3 x i32]*, [3 x i32]** %6
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %23, i64 %26
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %27, i64 0, i64 %29
store i32 0, i32* %30
ret void
}

LLVM IR (-O2):
define void @arriba(i32 %0, i32 %1, [3 x i32]* nocapture %2) {
%4 = add nsw i32 %0, -1
%5 = sext i32 %4 to i64
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 %5, i64 %6
%8 = load i32, i32* %7
%9 = sext i32 %0 to i64
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 %9, i64 %6
store i32 %8, i32* %10
store i32 0, i32* %7
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;
struct timeval {
  unsigned long long tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
uint64_t diff_timeval_us(const struct timeval *t1, const struct timeval *t2) {
  return (t2->tv_sec - t1->tv_sec) * 1000000ULL + t2->tv_usec - t1->tv_usec;
}


x86 assembly (clang, -O0):
<diff_timeval_us>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%rax
imul   $0xf4240,%rax,%rax
mov    -0x10(%rbp),%rcx
add    0x8(%rcx),%rax
mov    -0x8(%rbp),%rcx
sub    0x8(%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_timeval_us>:
mov    (%rsi),%rax
sub    (%rdi),%rax
imul   $0xf4240,%rax,%rax
add    0x8(%rsi),%rax
sub    0x8(%rdi),%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @diff_timeval_us(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = load %struct.timeval*, %struct.timeval** %3
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = sub i64 %7, %10
%12 = mul i64 %11, 1000000
%13 = load %struct.timeval*, %struct.timeval** %4
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%15 = load i64, i64* %14
%16 = add i64 %12, %15
%17 = load %struct.timeval*, %struct.timeval** %3
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 1
%19 = load i64, i64* %18
%20 = sub i64 %16, %19
ret i64 %20
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @diff_timeval_us(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i64, i64* %5
%7 = sub i64 %4, %6
%8 = mul i64 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i64, i64* %9
%11 = add i64 %8, %10
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%13 = load i64, i64* %12
%14 = sub i64 %11, %13
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ __s32_cpy(void *, void *);
void __kv_5_alter(void *cc, void *k, void *v, bool n) { __s32_cpy(v, cc); }


x86 assembly (clang, -O0):
<__kv_5_alter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <__s32_cpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__kv_5_alter>:
mov    %rdi,%rsi
mov    %rdx,%rdi
jmp    1030 <__s32_cpy@plt>

LLVM IR (-O0):
define void @__kv_5_alter(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %7
%10 = load i8*, i8** %5
%11 = call i32 @__s32_cpy(i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
define void @__kv_5_alter(i8* %0, i8* nocapture readnone %1, i8* %2, i32 %3) {
%5 = tail call i32 @__s32_cpy(i8* %2, i8* %0)
ret void
}
int test_imm_A9uint16_reg(unsigned short val) {
  return ((val) & (0xA9 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A9uint16_reg>:
test   $0xa9,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A9uint16_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, 169
%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_A9uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 169
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int);
void exitfunc1(int status, void *arg) {
  printf("Executing exitfunc1 (status=%d, arg=%d)\n", status, (int)arg);
  exit((int)arg);
}


x86 assembly (clang, -O0):
<exitfunc1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc1>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Executing exitfunc1 (status=%d, arg=%d)\0A\00"
define void @exitfunc1(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 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i32
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [41 x i8] c"Executing exitfunc1 (status=%d, arg=%d)\0A\00"
define void @exitfunc1(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
%6 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
struct binaryTree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memberOfBinaryTreeRecurs(struct binaryTree *, int, int *);
int memberOfBinaryTree(struct binaryTree *tree, int searchedValue) {
  int found = 0;
  memberOfBinaryTreeRecurs(tree, searchedValue, &found);
  return found;
}


x86 assembly (clang, -O0):
<memberOfBinaryTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
call   1030 <memberOfBinaryTreeRecurs@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memberOfBinaryTree>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1030 <memberOfBinaryTreeRecurs@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.binaryTree = type { i32 }
define i32 @memberOfBinaryTree(%struct.binaryTree* %0, i32 %1) {
%3 = alloca %struct.binaryTree*
%4 = alloca i32
%5 = alloca i32
store %struct.binaryTree* %0, %struct.binaryTree** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load %struct.binaryTree*, %struct.binaryTree** %3
%7 = load i32, i32* %4
%8 = call i32 @memberOfBinaryTreeRecurs(%struct.binaryTree* %6, i32 %7, i32* %5)
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
%struct.binaryTree = type { i32 }
define i32 @memberOfBinaryTree(%struct.binaryTree* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @memberOfBinaryTreeRecurs(%struct.binaryTree* %0, i32 %1, i32* %3)
%6 = load i32, i32* %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
char *strdup(char *);
void get_string(const char **string_out) {
  *string_out = strdup("Hello");
  printf("get_string returns %s\n", *string_out);
}


x86 assembly (clang, -O0):
<get_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_string>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,(%rbx)
lea    0xecc(%rip),%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [23 x i8] c"get_string returns %s\0A\00"
define void @get_string(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i8**, i8*** %2
store i8* %3, i8** %4
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [23 x i8] c"get_string returns %s\0A\00"
define void @get_string(i8** nocapture writeonly %0) {
%2 = tail call dereferenceable_or_null(6) i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}
int test_imm_FEint8_reg(signed char val) {
  return ((val) & (0xFE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FEint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xfe,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_FEint8_reg>:
cmp    $0x2,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_FEint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 254
%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_FEint8_reg(i8 signext %0) {
%2 = icmp ult i8 %0, 2
%3 = select i1 %2, i32 -40, i32 -20
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
char *adjust_unit(double *);
int /*<<< orphan*/ printf(char *, double, char const *);
void pr_freespace(uint64_t fs) {
  double f = (double)fs;
  const char *unit = adjust_unit(&f);
  printf("Free space: %.2f %s\n", f, unit);
}


x86 assembly (clang, -O0):
<pr_freespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <adjust_unit@plt>
mov    %rax,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_freespace>:
push   %rax
cvtsi2sd %rdi,%xmm0
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <adjust_unit@plt>
movsd  (%rsp),%xmm0
lea    0xec1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Free space: %.2f %s\0A\00"
define void @pr_freespace(i64 %0) {
%2 = alloca i64
%3 = alloca double
%4 = alloca i8*
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = sitofp i64 %5 to double
store double %6, double* %3
%7 = call i8* @adjust_unit(double* %3)
store i8* %7, i8** %4
%8 = load double, double* %3
%9 = load i8*, i8** %4
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Free space: %.2f %s\0A\00"
define void @pr_freespace(i64 %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = sitofp i64 %0 to double
store double %4, double* %2
%5 = call i8* @adjust_unit(double* %2)
%6 = load double, double* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %6, i8* %5)
ret void
}