xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *stringLiteral();
char *stringLocal();
char *stringMalloc();
int main(void) {
  printf("%s\n", stringMalloc());
  printf("%s\n", stringLiteral());
  printf("%s\n", stringLocal());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <stringMalloc@plt>
mov    %rax,%rsi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <stringLiteral@plt>
mov    %rax,%rsi
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <stringLocal@plt>
mov    %rax,%rsi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <stringMalloc@plt>
lea    0xeb1(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <stringLiteral@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <stringLocal@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @stringMalloc()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i8* (...) @stringLiteral()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i8* (...) @stringLocal()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
char *strcpy(char *dest, const char *src) {
  char *ret = dest;
  while (*src)
    *(dest++) = *(src++);
  *dest = 0;
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1148 <strcpy+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %rdi,%rdx
test   %cl,%cl
je     1131 <strcpy+0x31>
add    $0x1,%rsi
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <strcpy+0x20>
movb   $0x0,(%rdx)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %6, i8* %7
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, int, int);
int main(int argc, char *argv[]) {
  char a[] = "hei";
  int b = 2;
  int c = 3;
  int d = b + c;
  printf("a = %s b = %d c = %d d = %d \n", a, b, c, d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x14(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x696568,0x4(%rsp)
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x5,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.a = [4 x i8] c"hei\00"
@.str = [30 x i8] c"a = %s b = %d c = %d d = %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [4 x i8]* %6 to i8*
store i32 2, i32* %7
store i32 3, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = add nsw i32 %11, %12
store i32 %13, i32* %9
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = load i32, i32* %9
%18 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15, i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"a = %s b = %d c = %d d = %d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 6907240, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %4, i32 2, i32 3, i32 5)
ret i32 0
}
unsigned char mostSignificantBit(unsigned myInt) {
  unsigned i;
  for (i = 0; i < 8; i++) {
    if (!(myInt & (1 << i))) {
      return i;
    }
  }
  return 8;
}


x86 assembly (clang, -O0):
<mostSignificantBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jae    1150 <mostSignificantBit+0x50>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    113d <mostSignificantBit+0x3d>
mov    -0xc(%rbp),%eax
mov    %al,-0x1(%rbp)
jmp    1154 <mostSignificantBit+0x54>
jmp    1142 <mostSignificantBit+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <mostSignificantBit+0xe>
movb   $0x8,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostSignificantBit>:
test   $0x1,%dil
jne    1109 <mostSignificantBit+0x9>
xor    %eax,%eax
ret
mov    $0x1,%al
test   $0x2,%dil
je     1146 <mostSignificantBit+0x46>
mov    $0x2,%al
test   $0x4,%dil
je     1146 <mostSignificantBit+0x46>
mov    $0x3,%al
test   $0x8,%dil
je     1146 <mostSignificantBit+0x46>
mov    $0x4,%al
test   $0x10,%dil
je     1146 <mostSignificantBit+0x46>
mov    $0x5,%al
test   $0x20,%dil
je     1146 <mostSignificantBit+0x46>
mov    $0x6,%al
test   $0x40,%dil
je     1146 <mostSignificantBit+0x46>
and    $0x80,%edi
cmp    $0x1,%edi
mov    $0x8,%al
sbb    $0x0,%al
ret

LLVM IR (-O0):
define zeroext i8 @mostSignificantBit(i32 %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %4
%7 = icmp ult i32 %6, 8
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = and i32 %9, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = load i32, i32* %4
%16 = trunc i32 %15 to i8
store i8 %16, i8* %2
br label %22
17: ; preds = %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = add i32 %19, 1
store i32 %20, i32* %4
br label %5
21: ; preds = %5
store i8 8, i8* %2
br label %22
22: ; preds = %21, %14
%23 = load i8, i8* %2
ret i8 %23
}

LLVM IR (-O2):
define zeroext i8 @mostSignificantBit(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %26, label %4
4: ; preds = %1
%5 = and i32 %0, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %4
%8 = and i32 %0, 4
%9 = icmp eq i32 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = and i32 %0, 8
%12 = icmp eq i32 %11, 0
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = and i32 %0, 16
%15 = icmp eq i32 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = and i32 %0, 32
%18 = icmp eq i32 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %16
%20 = and i32 %0, 64
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = and i32 %0, 128
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i8 7, i8 8
br label %26
26: ; preds = %22, %1, %4, %7, %10, %13, %16, %19
%27 = phi i8 [ 0, %1 ], [ 1, %4 ], [ 2, %7 ], [ 3, %10 ], [ 4, %13 ], [ 5, %16 ], [ 6, %19 ], [ %25, %22 ]
ret i8 %27
}
int odd(int i) { return i & 0x1; }


x86 assembly (clang, -O0):
<odd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<odd>:
mov    %edi,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @odd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @odd(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
double exp(double);
int snprintf(char *, int, char *, double);
int senFunc6(char *s, int n, int a) {
  return snprintf(s, n, "CO: %lf ppm", 0.282806 * exp(1.62986 * a * 0.00488));
}


x86 assembly (clang, -O0):
<senFunc6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeaf(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
movaps %xmm0,%xmm1
movsd  0xe8c(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xe99(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<senFunc6>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
cvtsi2sd %edx,%xmm0
mulsd  0xecc(%rip),%xmm0
mulsd  0xecc(%rip),%xmm0
call   1040 <exp@plt>
mulsd  0xec7(%rip),%xmm0
lea    0xec8(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"CO: %lf ppm\00"
define i32 @senFunc6(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to double
%11 = fmul double 1.629860e+00, %10
%12 = fmul double %11, 4.880000e-03
%13 = call double @exp(double %12)
%14 = fmul double 2.828060e-01, %13
%15 = call i32 @snprintf(i8* %7, i32 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [12 x i8] c"CO: %lf ppm\00"
define i32 @senFunc6(i8* %0, i32 %1, i32 %2) {
%4 = sitofp i32 %2 to double
%5 = fmul double %4, 1.629860e+00
%6 = fmul double %5, 4.880000e-03
%7 = tail call double @exp(double %6)
%8 = fmul double %7, 2.828060e-01
%9 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %8)
ret i32 %9
}
int test_imm_81int64_midword_reg(long long val) {
  return ((val >> 16) & (0x81 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_81int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x81,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_81int64_midword_reg(i64 %0) {
%2 = and i64 %0, 8454144
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void foo() {
  int x;
  printf("hello");
  printf("%d", x);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [3 x i8] c"%d\00"
define void @foo() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 undef)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
compareFamilies(const void *first, const void *second) {
  return strcmp((char *)first, (char *)second);
}


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

x86 assembly (clang, -O2):
<compareFamilies>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compareFamilies(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hello world\n"); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ getaloc(int);
int getword(scalar_t__);
int getafield(int act, int off) { return (getword(getaloc(act) + off)); }


x86 assembly (clang, -O0):
<getafield>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <getaloc@plt>
mov    %rax,%rdi
movslq -0x8(%rbp),%rax
add    %rax,%rdi
call   1030 <getword@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getafield>:
push   %rbx
mov    %esi,%ebx
call   1040 <getaloc@plt>
movslq %ebx,%rdi
add    %rax,%rdi
pop    %rbx
jmp    1030 <getword@plt>

LLVM IR (-O0):
define i32 @getafield(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i64 @getaloc(i32 %5)
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = add nsw i64 %6, %8
%10 = call i32 @getword(i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @getafield(i32 %0, i32 %1) {
%3 = tail call i64 @getaloc(i32 %0)
%4 = sext i32 %1 to i64
%5 = add nsw i64 %3, %4
%6 = tail call i32 @getword(i64 %5)
ret i32 %6
}
/* Type definitions */
struct netpbm_image {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dilate(struct netpbm_image *, struct netpbm_image *,
                          struct netpbm_image *);
int /*<<< orphan*/ erode(struct netpbm_image *, struct netpbm_image *,
                         struct netpbm_image *);
void morph_close(struct netpbm_image *img_in, struct netpbm_image *img_scratch,
                 struct netpbm_image *img_scratch2,
                 struct netpbm_image *img_out) {
  dilate(img_in, img_scratch, img_scratch2);
  erode(img_scratch2, img_scratch, img_out);
}


x86 assembly (clang, -O0):
<morph_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <dilate@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <erode@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<morph_close>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
call   1040 <dilate@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <erode@plt>

LLVM IR (-O0):
%struct.netpbm_image = type { i32 }
define void @morph_close(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2, %struct.netpbm_image* %3) {
%5 = alloca %struct.netpbm_image*
%6 = alloca %struct.netpbm_image*
%7 = alloca %struct.netpbm_image*
%8 = alloca %struct.netpbm_image*
store %struct.netpbm_image* %0, %struct.netpbm_image** %5
store %struct.netpbm_image* %1, %struct.netpbm_image** %6
store %struct.netpbm_image* %2, %struct.netpbm_image** %7
store %struct.netpbm_image* %3, %struct.netpbm_image** %8
%9 = load %struct.netpbm_image*, %struct.netpbm_image** %5
%10 = load %struct.netpbm_image*, %struct.netpbm_image** %6
%11 = load %struct.netpbm_image*, %struct.netpbm_image** %7
%12 = call i32 @dilate(%struct.netpbm_image* %9, %struct.netpbm_image* %10, %struct.netpbm_image* %11)
%13 = load %struct.netpbm_image*, %struct.netpbm_image** %7
%14 = load %struct.netpbm_image*, %struct.netpbm_image** %6
%15 = load %struct.netpbm_image*, %struct.netpbm_image** %8
%16 = call i32 @erode(%struct.netpbm_image* %13, %struct.netpbm_image* %14, %struct.netpbm_image* %15)
ret void
}

LLVM IR (-O2):
%struct.netpbm_image = type { i32 }
define void @morph_close(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2, %struct.netpbm_image* %3) {
%5 = tail call i32 @dilate(%struct.netpbm_image* %0, %struct.netpbm_image* %1, %struct.netpbm_image* %2)
%6 = tail call i32 @erode(%struct.netpbm_image* %2, %struct.netpbm_image* %1, %struct.netpbm_image* %3)
ret void
}
void RTAvlGCPtrInsert(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlGCPtrInsert() {
ret void
}
/* Variables and functions */
long _strtoxl(char const *, char **, int, int);
long int strtol(const char *nptr, char **endptr, int base) {
  return _strtoxl(nptr, endptr, base, 1);
}


x86 assembly (clang, -O0):
<strtol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x1,%ecx
call   1030 <_strtoxl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtol>:
mov    $0x1,%ecx
jmp    1030 <_strtoxl@plt>

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

LLVM IR (-O2):
define i64 @strtol(i8* %0, i8** %1, i32 %2) {
%4 = tail call i64 @_strtoxl(i8* %0, i8** %1, i32 %2, i32 1)
ret i64 %4
}
char test_52_0(char *mem) { return __atomic_or_fetch(mem + 0, 1, 4); }


x86 assembly (clang, -O0):
<test_52_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movb   $0x1,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    %cl,-0xc(%rbp)
mov    (%rax),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%sil
mov    %al,%dl
or     %sil,%dl
lock cmpxchg %dl,(%rcx)
sete   %cl
mov    %al,-0x19(%rbp)
test   $0x1,%cl
mov    %al,-0xb(%rbp)
jne    114a <test_52_0+0x4a>
jmp    111f <test_52_0+0x1f>
mov    -0xc(%rbp),%cl
mov    -0x19(%rbp),%al
or     %cl,%al
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_52_0>:
mov    (%rdi),%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
or     $0x1,%cl
lock cmpxchg %cl,(%rdi)
jne    1110 <test_52_0+0x10>
or     $0x1,%al
ret

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

LLVM IR (-O2):
define signext i8 @test_52_0(i8* nocapture %0) {
%2 = atomicrmw or i8* %0, i8 1 acq_rel
%3 = or i8 %2, 1
ret i8 %3
}
int group_state_gid(const struct group_state *s) { return -1; }


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

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

LLVM IR (-O0):
%struct.group_state = type opaque
define i32 @group_state_gid(%struct.group_state* %0) {
%2 = alloca %struct.group_state*
store %struct.group_state* %0, %struct.group_state** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.group_state = type opaque
define i32 @group_state_gid(%struct.group_state* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
float pow(float, float);
float gamma_EOTF(float value, float gamma) {
  if (value == 0) {
    return 0;
  } else if (value == 1) {
    return value;
  } else {
    return pow(value, gamma);
  }
}


x86 assembly (clang, -O0):
<gamma_EOTF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1146 <gamma_EOTF+0x36>
jp     1146 <gamma_EOTF+0x36>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1185 <gamma_EOTF+0x75>
movss  -0x8(%rbp),%xmm0
movss  0xead(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1171 <gamma_EOTF+0x61>
jp     1171 <gamma_EOTF+0x61>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1185 <gamma_EOTF+0x75>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <pow@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_EOTF>:
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jne    111a <gamma_EOTF+0xa>
jnp    1129 <gamma_EOTF+0x19>
movss  0xede(%rip),%xmm2
ucomiss %xmm2,%xmm0
jne    112d <gamma_EOTF+0x1d>
jp     112d <gamma_EOTF+0x1d>
movaps %xmm2,%xmm0
ret
jmp    1030 <pow@plt>

LLVM IR (-O0):
define float @gamma_EOTF(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = fcmp oeq float %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %2
store float 0.000000e+00, float* %3
br label %18
9: ; preds = %2
%10 = load float, float* %4
%11 = fcmp oeq float %10, 1.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = load float, float* %4
store float %13, float* %3
br label %18
14: ; preds = %9
%15 = load float, float* %4
%16 = load float, float* %5
%17 = call float @pow(float %15, float %16)
store float %17, float* %3
br label %18
18: ; preds = %14, %12, %8
%19 = load float, float* %3
ret float %19
}

LLVM IR (-O2):
define float @gamma_EOTF(float %0, float %1) {
%3 = fcmp oeq float %0, 0.000000e+00
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = fcmp oeq float %0, 1.000000e+00
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call float @pow(float %0, float %1)
br label %8
8: ; preds = %4, %2, %6
%9 = phi float [ %7, %6 ], [ 0.000000e+00, %2 ], [ 1.000000e+00, %4 ]
ret float %9
}
int putline(char *string) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @putline(i8* nocapture readnone %0) {
ret i32 0
}
void gui_ggz_embed_leave_table(void) {}


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

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

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

LLVM IR (-O2):
define void @gui_ggz_embed_leave_table() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ signbit(double);
void uninitvar_signbit(void) {
  double d;
  (void)signbit(d);
}


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

x86 assembly (clang, -O2):
<uninitvar_signbit>:
jmp    1030 <signbit@plt>

LLVM IR (-O0):
define void @uninitvar_signbit() {
%1 = alloca double
%2 = load double, double* %1
%3 = call i32 @signbit(double %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_signbit() {
%1 = tail call i32 @signbit(double undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strmlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void outplain(char *tmp) { write(1, tmp, strmlen(tmp)); }


x86 assembly (clang, -O0):
<outplain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strmlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outplain>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strmlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @outplain(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strmlen(i8* %4)
%6 = call i32 @write(i32 1, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @outplain(i8* %0) {
%2 = tail call i32 @strmlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int myfgetc(FILE *stream) {
  unsigned char c;
  if (fread(&c, 1, 1, stream) == 1)
    return c;
  else
    return EOF;
}


x86 assembly (clang, -O0):
<myfgetc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
cmp    $0x1,%eax
jne    1145 <myfgetc+0x35>
movzbl -0x11(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <myfgetc+0x41>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfgetc>:
push   %rax
mov    %rdi,%rcx
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
je     1138 <myfgetc+0x28>
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
movzbl 0x7(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @myfgetc(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @fread(i8* %4, i32 1, i32 1, i32* %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8, i8* %4
%10 = zext i8 %9 to i32
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* @EOF
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @myfgetc(i32* nocapture %0) {
%2 = alloca i8
%3 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%4 = icmp eq i32 %3, 1
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = load i32, i32* @EOF
%8 = select i1 %4, i32 %6, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ f();
main() {
  'abc';
  f();
  "";
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = call i32 (...) @f()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void printHelpAndExit(FILE *stream, int exitCode) {
  fprintf(stream, "Usage: presmerovanie (-h | vystupny_subor)\n");
  fprintf(stream,
          "Program vypise do suboru vystupny_subor procesy pouzivatela\n");
  fprintf(stream, "Prepinac -h vypise help\n");
  exit(exitCode);
}


x86 assembly (clang, -O0):
<printHelpAndExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf0f(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<printHelpAndExit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xee4(%rip),%rdi
mov    $0x3c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf08(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %ebp,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"Usage: presmerovanie (-h | vystupny_subor)\0A\00"
@.str.1 = [61 x i8] c"Program vypise do suboru vystupny_subor procesy pouzivatela\0A\00"
@.str.2 = [25 x i8] c"Prepinac -h vypise help\0A\00"
define void @printHelpAndExit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%7 = load i32*, i32** %3
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32*, i32** %3
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %4
%12 = call i32 @exit(i32 %11)
unreachable
}

LLVM IR (-O2):
@.str = [44 x i8] c"Usage: presmerovanie (-h | vystupny_subor)\0A\00"
@.str.1 = [61 x i8] c"Program vypise do suboru vystupny_subor procesy pouzivatela\0A\00"
@.str.2 = [25 x i8] c"Prepinac -h vypise help\0A\00"
define void @printHelpAndExit(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i64 43, i64 1, i32* %0)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i64 60, i64 1, i32* %0)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 24, i64 1, i32* %0)
%6 = tail call i32 @exit(i32 %1)
unreachable
}
int contains(unsigned nNeighbors, unsigned neighborsCache[nNeighbors],
             unsigned index) {
  for (unsigned i = 0; i < nNeighbors; i++) {
    if (index == neighborsCache[i])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<contains>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1153 <contains+0x53>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
cmp    (%rcx,%rdx,4),%eax
jne    1140 <contains+0x40>
movl   $0x1,-0x4(%rbp)
jmp    115a <contains+0x5a>
jmp    1145 <contains+0x45>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <contains+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<contains>:
test   %edi,%edi
je     113a <contains+0x3a>
mov    $0x1,%eax
cmp    %edx,(%rsi)
je     1139 <contains+0x39>
mov    %edi,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rdi
cmp    %rax,%rcx
je     1131 <contains+0x31>
lea    0x1(%rdi),%rax
cmp    %edx,(%rsi,%rdi,4)
jne    1120 <contains+0x20>
xor    %eax,%eax
cmp    %rcx,%rdi
setb   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @contains(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
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
store i32 0, i32* %8
br label %11
11: ; preds = %25, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %5
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = load i32, i32* %7
%17 = load i32*, i32** %6
%18 = load i32, i32* %8
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %16, %21
br i1 %22, label %23, label %24
23: ; preds = %15
store i32 1, i32* %4
br label %29
24: ; preds = %15
br label %25
25: ; preds = %24
%26 = load i32, i32* %8
%27 = add i32 %26, 1
store i32 %27, i32* %8
br label %11
28: ; preds = %11
store i32 0, i32* %4
br label %29
29: ; preds = %28, %23
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @contains(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %20, label %5
5: ; preds = %3
%6 = zext i32 %0 to i64
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, %2
br i1 %8, label %20, label %9
9: ; preds = %5, %12
%10 = phi i64 [ %16, %12 ], [ 1, %5 ]
%11 = icmp eq i64 %10, %6
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, %2
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %17, label %9
17: ; preds = %9, %12
%18 = icmp ult i64 %10, %6
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %17, %5, %3
%21 = phi i32 [ 0, %3 ], [ 1, %5 ], [ %19, %17 ]
ret i32 %21
}
int confirm(mesg)
char *mesg;
{
  register int result;
  printf("%s", mesg);
  if (getchar() == 'y')
    result = 1;
  else
    result = 0;
  while (getchar() != '\n')
    ;
  return (result);
}


x86 assembly (clang, -O0):
<confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
cmp    $0x79,%eax
jne    115a <confirm+0x3a>
movl   $0x1,-0xc(%rbp)
jmp    1161 <confirm+0x41>
movl   $0x0,-0xc(%rbp)
jmp    1166 <confirm+0x46>
mov    $0x0,%al
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     117b <confirm+0x5b>
jmp    1166 <confirm+0x46>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confirm>:
push   %rbx
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
jne    1140 <confirm+0x20>
xor    %eax,%eax
cmp    $0x79,%ebx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @confirm(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @getchar()
%7 = icmp eq i32 %6, 121
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %3
br label %10
9: ; preds = %1
store i32 0, i32* %3
br label %10
10: ; preds = %9, %8
br label %11
11: ; preds = %14, %10
%12 = call i32 (...) @getchar()
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %11
br label %11
15: ; preds = %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @confirm(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @getchar()
br label %4
4: ; preds = %4, %1
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 10
br i1 %6, label %7, label %4
7: ; preds = %4
%8 = icmp eq i32 %3, 121
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int lengthOfLongestSubstring(char *);
int main() {
  char *x = "12345adfsd123";
  int l = lengthOfLongestSubstring(x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <lengthOfLongestSubstring@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <lengthOfLongestSubstring@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"12345adfsd123\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @lengthOfLongestSubstring(i8* %4)
store i32 %5, i32* %3
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"12345adfsd123\00"
define i32 @main() {
%1 = tail call i32 @lengthOfLongestSubstring(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void ft_foreach(int *tab, int length, void (*f)(int)) {
  if (length == 0)
    return;
  f(tab[0]);
  ft_foreach(tab + 1, length - 1, f);
}


x86 assembly (clang, -O0):
<ft_foreach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1132 <ft_foreach+0x22>
jmp    1155 <ft_foreach+0x45>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%edi
call   *%rax
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x18(%rbp),%rdx
call   1030 <ft_foreach@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_foreach>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1130 <ft_foreach+0x30>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%edi
call   *%r14
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1120 <ft_foreach+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_foreach(i32* nocapture %0, i32 %1, void (i32)* nocapture %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %12, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %10, %5 ], [ %1, %3 ]
%7 = phi i32* [ %9, %5 ], [ %0, %3 ]
%8 = load i32, i32* %7
tail call void %2(i32 %8)
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = add nsw i32 %6, -1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %3
ret void
}
/* Variables and functions */
int length(char *str) {
  if (str == NULL) {
    return 0;
  }
  int i = 0;
  while (*(str + i) != '\0') {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <length+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    114f <length+0x4f>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1149 <length+0x49>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <length+0x26>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
test   %rdi,%rdi
je     111d <length+0x1d>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <length+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @length(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 0, %1 ], [ %10, %9 ]
ret i32 %12
}
void *bgzf_nul_func(void *arg) { return arg; }


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

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

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

LLVM IR (-O2):
define i8* @bgzf_nul_func(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  setuid(0);
  system("/bin/bash /home/santiago/.xmonad/sleep.sh");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <setuid@plt>
lea    0xec3(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <setuid@plt>
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"/bin/bash /home/santiago/.xmonad/sleep.sh\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 0)
%3 = call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"/bin/bash /home/santiago/.xmonad/sleep.sh\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @system(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ *boxUnsigned(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ micros();
uint32_t *arduinoMicros(uint32_t context_len, uint32_t *stackvar) {
  uint32_t value;
  value = micros();
  return boxUnsigned(context_len, value);
}


x86 assembly (clang, -O0):
<arduinoMicros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <micros@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <boxUnsigned@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32* @arduinoMicros(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = call i32 (...) @micros()
store i32 %6, i32* %5
%7 = load i32, i32* %3
%8 = load i32, i32* %5
%9 = call i32* @boxUnsigned(i32 %7, i32 %8)
ret i32* %9
}

LLVM IR (-O2):
define i32* @arduinoMicros(i32 %0, i32* nocapture readnone %1) {
%3 = tail call i32 (...) @micros()
%4 = tail call i32* @boxUnsigned(i32 %0, i32 %3)
ret i32* %4
}