xunge/DecIR huggingface dataset:
/* Type definitions */
struct demod_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ selcall_deinit(struct demod_state *);
void zvei1_deinit(struct demod_state *s) { selcall_deinit(s); }


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

x86 assembly (clang, -O2):
<zvei1_deinit>:
jmp    1030 <selcall_deinit@plt>

LLVM IR (-O0):
%struct.demod_state = type { i32 }
define void @zvei1_deinit(%struct.demod_state* %0) {
%2 = alloca %struct.demod_state*
store %struct.demod_state* %0, %struct.demod_state** %2
%3 = load %struct.demod_state*, %struct.demod_state** %2
%4 = call i32 @selcall_deinit(%struct.demod_state* %3)
ret void
}

LLVM IR (-O2):
%struct.demod_state = type { i32 }
define void @zvei1_deinit(%struct.demod_state* %0) {
%2 = tail call i32 @selcall_deinit(%struct.demod_state* %0)
ret void
}
void b_progbeg(int argc, char *argv[]) {}


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

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

LLVM IR (-O0):
define void @b_progbeg(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @b_progbeg(i32 %0, i8** nocapture %1) {
ret void
}
int DunemaskDist(int a, int b) {
  a = a ^ b;
  int r = 0;
  for (int i = 0; i < 9; ++i)
    if (a & (1 << i))
      ++r;
  return r;
}


x86 assembly (clang, -O0):
<DunemaskDist>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    1161 <DunemaskDist+0x61>
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     114e <DunemaskDist+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <DunemaskDist+0x53>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1121 <DunemaskDist+0x21>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DunemaskDist>:
xor    %esi,%edi
mov    %edi,%eax
and    $0x1,%eax
mov    %edi,%ecx
shr    %ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x2,%eax
and    $0x1,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    $0x3,%ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x4,%eax
and    $0x1,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    $0x5,%ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%edx
shr    $0x6,%edx
and    $0x1,%edx
add    %ecx,%edx
mov    %edi,%eax
shr    $0x7,%eax
and    $0x1,%eax
add    %edx,%eax
shr    $0x8,%edi
and    $0x1,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @DunemaskDist(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = xor i32 %7, %8
store i32 %9, i32* %3
store i32 0, i32* %5
store i32 0, i32* %6
br label %10
10: ; preds = %23, %2
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 9
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %3
%15 = load i32, i32* %6
%16 = shl i32 1, %15
%17 = and i32 %14, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %22
22: ; preds = %19, %13
br label %23
23: ; preds = %22
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %10
26: ; preds = %10
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @DunemaskDist(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = and i32 %3, 1
%5 = lshr i32 %3, 1
%6 = and i32 %5, 1
%7 = add nuw nsw i32 %6, %4
%8 = lshr i32 %3, 2
%9 = and i32 %8, 1
%10 = add nuw nsw i32 %9, %7
%11 = lshr i32 %3, 3
%12 = and i32 %11, 1
%13 = add nuw nsw i32 %12, %10
%14 = lshr i32 %3, 4
%15 = and i32 %14, 1
%16 = add nuw nsw i32 %15, %13
%17 = lshr i32 %3, 5
%18 = and i32 %17, 1
%19 = add nuw nsw i32 %18, %16
%20 = lshr i32 %3, 6
%21 = and i32 %20, 1
%22 = add nuw nsw i32 %21, %19
%23 = lshr i32 %3, 7
%24 = and i32 %23, 1
%25 = add nuw nsw i32 %24, %22
%26 = lshr i32 %3, 8
%27 = and i32 %26, 1
%28 = add nuw nsw i32 %27, %25
ret i32 %28
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void BuG(char *s) {
  printf("%s", s);
  exit(0);
}


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

x86 assembly (clang, -O2):
<BuG>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @BuG(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @BuG(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
int decay_response(int k) {
  if (k < 1)
    return (int)(1.2 * 30000.0);
  if (k > 1000)
    return 0;
  return (int)(1.2 * 30000.0 * (1000 - k) / (1.0 * 1000));
}


x86 assembly (clang, -O0):
<decay_response>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    111d <decay_response+0x1d>
movl   $0x8ca0,-0x4(%rbp)
jmp    1161 <decay_response+0x61>
cmpl   $0x3e8,-0x8(%rbp)
jle    1136 <decay_response+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1161 <decay_response+0x61>
mov    $0x3e8,%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xebe(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeaa(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decay_response>:
test   %edi,%edi
jle    112e <decay_response+0x2e>
xor    %eax,%eax
cmp    $0x3e8,%edi
ja     112d <decay_response+0x2d>
mov    $0x3e8,%eax
sub    %edi,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xedf(%rip),%xmm0
divsd  0xedf(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret
mov    $0x8ca0,%eax
ret

LLVM IR (-O0):
define i32 @decay_response(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 36000, i32* %2
br label %18
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 1000
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 0, i32* %2
br label %18
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sub nsw i32 1000, %12
%14 = sitofp i32 %13 to double
%15 = fmul double 3.600000e+04, %14
%16 = fdiv double %15, 1.000000e+03
%17 = fptosi double %16 to i32
store i32 %17, i32* %2
br label %18
18: ; preds = %11, %10, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @decay_response(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 1000
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = sub nuw nsw i32 1000, %0
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 3.600000e+04
%9 = fdiv double %8, 1.000000e+03
%10 = fptosi double %9 to i32
br label %11
11: ; preds = %3, %1, %5
%12 = phi i32 [ %10, %5 ], [ 36000, %1 ], [ 0, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ new_int(int);
int pop_int();
int /*<<< orphan*/ push(int /*<<< orphan*/);
void builtin_mult() {
  int b = pop_int();
  int a = pop_int();
  push(new_int(a * b));
}


x86 assembly (clang, -O0):
<builtin_mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pop_int@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <pop_int@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
imul   -0x4(%rbp),%edi
call   1040 <new_int@plt>
mov    %eax,%edi
call   1050 <push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_mult>:
push   %rbx
xor    %eax,%eax
call   1030 <pop_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <pop_int@plt>
imul   %eax,%ebx
mov    %ebx,%edi
call   1040 <new_int@plt>
mov    %eax,%edi
pop    %rbx
jmp    1050 <push@plt>

LLVM IR (-O0):
define void @builtin_mult() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @pop_int()
store i32 %3, i32* %1
%4 = call i32 (...) @pop_int()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = mul nsw i32 %5, %6
%8 = call i32 @new_int(i32 %7)
%9 = call i32 @push(i32 %8)
ret void
}

LLVM IR (-O2):
define void @builtin_mult() {
%1 = tail call i32 (...) @pop_int()
%2 = tail call i32 (...) @pop_int()
%3 = mul nsw i32 %2, %1
%4 = tail call i32 @new_int(i32 %3)
%5 = tail call i32 @push(i32 %4)
ret void
}
/* Variables and functions */
double ndrand48();
double rndom(double z) { return (z * ndrand48()); }


x86 assembly (clang, -O0):
<rndom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <ndrand48@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rndom>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <ndrand48@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rndom(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double (...) @ndrand48()
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @rndom(double %0) {
%2 = tail call double (...) @ndrand48()
%3 = fmul double %2, %0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int ile(int x, int y, int ok) {
  if ((x < y) || (x == y)) {
    if (!ok)
      abort();
  } else if (ok)
    abort();
}


x86 assembly (clang, -O0):
<ile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1139 <ile+0x29>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    114f <ile+0x3f>
cmpl   $0x0,-0x10(%rbp)
jne    114a <ile+0x3a>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1165 <ile+0x55>
cmpl   $0x0,-0x10(%rbp)
je     1160 <ile+0x50>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1165 <ile+0x55>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ile>:
push   %rax
cmp    %esi,%edi
jle    1120 <ile+0x10>
test   %edx,%edx
je     1124 <ile+0x14>
xor    %eax,%eax
call   1030 <abort@plt>
test   %edx,%edx
je     1119 <ile+0x9>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @ile(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = icmp eq i32 %2, 0
br i1 %4, label %9, label %6
6: ; preds = %3
br i1 %5, label %7, label %12
7: ; preds = %6
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %3
br i1 %5, label %12, label %10
10: ; preds = %9
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %9, %6
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, int *);
int build_hour() {
  int h;
  sscanf("16:19:17", "%d:%*d:%*d", &h);
  return h;
}


x86 assembly (clang, -O0):
<build_hour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee3(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_hour>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xeea(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"16:19:17\00"
@.str.1 = [11 x i8] c"%d:%*d:%*d\00"
define i32 @build_hour() {
%1 = alloca i32
%2 = call i32 @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [9 x i8] c"16:19:17\00"
@.str.1 = [11 x i8] c"%d:%*d:%*d\00"
define i32 @build_hour() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ func(char *);
int main() { func("fifo_in_same_dir"); }


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"fifo_in_same_dir\00"
define i32 @main() {
%1 = tail call i32 @func(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
void stub1();
int main(void) {
  char *shellcode = "\x31\xc0\xb0\x01\x31\xdb\xcd\x80";
  printf("strlen(shellcode)=%d\n", strlen(shellcode));
  ((void (*)(void))shellcode)();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
call   *-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <strlen@plt>
lea    0xed5(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
call   2000 <_fini+0xebc>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"1\C0\B0\011\DB\CD\80\00"
@.str.1 = [22 x i8] c"strlen(shellcode)=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to void ()*
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"1\C0\B0\011\DB\CD\80\00"
@.str.1 = [22 x i8] c"strlen(shellcode)=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %1)
tail call void bitcast ([9 x i8]* @.str to void ()*)()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ main_default();
int /*<<< orphan*/ main_hidden();
int /*<<< orphan*/ main_internal();
int /*<<< orphan*/ main_protected();
int lib1(void) {
  main_default();
  main_hidden();
  main_internal();
  main_protected();
  return 0;
}


x86 assembly (clang, -O0):
<lib1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <main_default@plt>
mov    $0x0,%al
call   1030 <main_hidden@plt>
mov    $0x0,%al
call   1060 <main_internal@plt>
mov    $0x0,%al
call   1050 <main_protected@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib1>:
push   %rax
xor    %eax,%eax
call   1040 <main_default@plt>
xor    %eax,%eax
call   1030 <main_hidden@plt>
xor    %eax,%eax
call   1060 <main_internal@plt>
xor    %eax,%eax
call   1050 <main_protected@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @lib1() {
%1 = call i32 (...) @main_default()
%2 = call i32 (...) @main_hidden()
%3 = call i32 (...) @main_internal()
%4 = call i32 (...) @main_protected()
ret i32 0
}

LLVM IR (-O2):
define i32 @lib1() {
%1 = tail call i32 (...) @main_default()
%2 = tail call i32 (...) @main_hidden()
%3 = tail call i32 (...) @main_internal()
%4 = tail call i32 (...) @main_protected()
ret i32 0
}
/* Variables and functions */
int IPC_CREAT;
int *shmat(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int shmget(int, int, int);
void shm_init() {
  int shmid = shmget(1234, 512, IPC_CREAT | 0644);
  int *max = shmat(shmid, NULL, 0);
  *max = 0;
}


x86 assembly (clang, -O0):
<shm_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
or     $0x1a4,%edx
mov    $0x4d2,%edi
mov    $0x200,%esi
call   1040 <shmget@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <shmat@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shm_init>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    $0x1a4,%edx
or     (%rax),%edx
mov    $0x4d2,%edi
mov    $0x200,%esi
call   1040 <shmget@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <shmat@plt>
movl   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
@IPC_CREAT = global i32 0
define void @shm_init() {
%1 = alloca i32
%2 = alloca i32*
%3 = load i32, i32* @IPC_CREAT
%4 = or i32 %3, 420
%5 = call i32 @shmget(i32 1234, i32 512, i32 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = call i32* @shmat(i32 %6, i32* null, i32 0)
store i32* %7, i32** %2
%8 = load i32*, i32** %2
store i32 0, i32* %8
ret void
}

LLVM IR (-O2):
@IPC_CREAT = global i32 0
define void @shm_init() {
%1 = load i32, i32* @IPC_CREAT
%2 = or i32 %1, 420
%3 = tail call i32 @shmget(i32 1234, i32 512, i32 %2)
%4 = tail call i32* @shmat(i32 %3, i32* null, i32 0)
store i32 0, i32* %4
ret void
}
int QualityScaling(int quality) {
  if (quality <= 0)
    quality = 1;
  if (quality > 100)
    quality = 100;
  if (quality < 50)
    quality = 5000 / quality;
  else
    quality = 200 - quality * 2;
  return quality;
}


x86 assembly (clang, -O0):
<QualityScaling>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1118 <QualityScaling+0x18>
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jle    1129 <QualityScaling+0x29>
movl   $0x64,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    1144 <QualityScaling+0x44>
mov    $0x1388,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1154 <QualityScaling+0x54>
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
mov    $0xc8,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<QualityScaling>:
test   %edi,%edi
mov    $0x1,%eax
cmovg  %edi,%eax
cmp    $0x64,%eax
mov    $0x64,%ecx
cmovb  %eax,%ecx
cmp    $0x31,%ecx
ja     1127 <QualityScaling+0x27>
mov    $0x1388,%ax
xor    %edx,%edx
div    %cx
movzwl %ax,%eax
ret
add    %ecx,%ecx
mov    $0xc8,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @QualityScaling(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 1, i32* %2
br label %6
6: ; preds = %5, %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 100
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 100, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 50
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sdiv i32 5000, %14
store i32 %15, i32* %2
br label %20
16: ; preds = %10
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 2
%19 = sub nsw i32 200, %18
store i32 %19, i32* %2
br label %20
20: ; preds = %16, %13
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @QualityScaling(i32 %0) {
%2 = icmp sgt i32 %0, 1
%3 = select i1 %2, i32 %0, i32 1
%4 = icmp ult i32 %3, 100
%5 = select i1 %4, i32 %3, i32 100
%6 = icmp ult i32 %5, 50
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = trunc i32 %5 to i16
%9 = udiv i16 5000, %8
%10 = zext i16 %9 to i32
br label %14
11: ; preds = %1
%12 = mul nsw i32 %5, -2
%13 = add nsw i32 %12, 200
br label %14
14: ; preds = %11, %7
%15 = phi i32 [ %10, %7 ], [ %13, %11 ]
ret i32 %15
}
void FIQHandler(void) { return; }


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

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

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

LLVM IR (-O2):
define void @FIQHandler() {
ret void
}
/* Variables and functions */
int scanw(char *, long *);
int l_scanw(char *fmt, long *i) { return (scanw(fmt, i)); }


x86 assembly (clang, -O0):
<l_scanw>:
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 <scanw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_scanw>:
jmp    1030 <scanw@plt>

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

LLVM IR (-O2):
define i32 @l_scanw(i8* %0, i64* %1) {
%3 = tail call i32 @scanw(i8* %0, i64* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int startsWith(const char *a, const char *b) {
  if (strncmp(a, b, strlen(b)) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<startsWith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    116e <startsWith+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1175 <startsWith+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startsWith>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @startsWith(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void WatchdogStallEnable(uint32_t ui32Base) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000418))) |= 0x00000100;
}


x86 assembly (clang, -O0):
<WatchdogStallEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x418,%eax
cltq
mov    (%rax),%ecx
or     $0x100,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogStallEnable>:
movslq %edi,%rax
orl    $0x100,0x418(%rax)
ret

LLVM IR (-O0):
define void @WatchdogStallEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1048
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 256
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @WatchdogStallEnable(i32 %0) {
%2 = add nsw i32 %0, 1048
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = or i32 %5, 256
store volatile i32 %6, i32* %4
ret void
}
char *strcpy(char *dest, const char *src) {
  int l = __builtin_strlen((src));
  __builtin_memcpy((dest), (src), (l + 1));
  return (char *)dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <memcpy@plt>

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = shl i64 %3, 32
%5 = add i64 %4, 4294967296
%6 = ashr exact i64 %5, 32
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %6, i1 false)
ret i8* %0
}
__attribute__((no)) void f(int i) {
  if (i != 0x12345678)
    abort();
  asm("");
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x12345678,-0x4(%rbp)
je     112d <f+0x1d>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x12345678,%edi
jne    1119 <f+0x9>
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 305419896
br i1 %4, label %5, label %6
5: ; preds = %1
unreachable
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @f(i32 %0) {
%2 = icmp eq i32 %0, 305419896
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void av_frame_copy_props() {}


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

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

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

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

/* Variables and functions */
int _mm_movemask_pd(int /*<<< orphan*/);
int test_mm_movemask_pd(__m128d A) { return _mm_movemask_pd(A); }


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

x86 assembly (clang, -O2):
<test_mm_movemask_pd>:
jmp    1030 <_mm_movemask_pd@plt>

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

LLVM IR (-O2):
define i32 @test_mm_movemask_pd(i32 %0) {
%2 = tail call i32 @_mm_movemask_pd(i32 %0)
ret i32 %2
}
int sum_of_powers(n) { sum_of_powers_helper(n, 0, n); }


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

x86 assembly (clang, -O2):
<sum_of_powers>:
xor    %esi,%esi
mov    %edi,%edx
xor    %eax,%eax
jmp    1030 <sum_of_powers_helper@plt>

LLVM IR (-O0):
define i32 @sum_of_powers(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %3
%6 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @sum_of_powers_helper to i32 (i32, i32, i32, ...)*)(i32 %4, i32 0, i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @sum_of_powers(i32 %0) {
%2 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @sum_of_powers_helper to i32 (i32, i32, i32, ...)*)(i32 %0, i32 0, i32 %0)
ret i32 undef
}
/* Variables and functions */
scalar_t__ __asm_utils_in8(int);
int /*<<< orphan*/ __asm_utils_out8(int, char);
short _pic_read_reg(char ocw3) {
  __asm_utils_out8(0x20, ocw3);
  __asm_utils_out8(0xA0, ocw3);
  return ((short)__asm_utils_in8(0xA0) << 8) || (short)__asm_utils_in8(0x20);
}


x86 assembly (clang, -O0):
<_pic_read_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x20,%edi
movsbl -0x1(%rbp),%esi
call   1030 <__asm_utils_out8@plt>
mov    $0xa0,%edi
movsbl -0x1(%rbp),%esi
call   1030 <__asm_utils_out8@plt>
mov    $0xa0,%edi
call   1040 <__asm_utils_in8@plt>
movswl %ax,%ecx
shl    $0x8,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    117c <_pic_read_reg+0x5c>
mov    $0x20,%edi
call   1040 <__asm_utils_in8@plt>
cwtl
cmp    $0x0,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pic_read_reg>:
push   %rbx
mov    %edi,%ebx
mov    $0x20,%edi
mov    %ebx,%esi
call   1030 <__asm_utils_out8@plt>
mov    $0xa0,%edi
mov    %ebx,%esi
call   1030 <__asm_utils_out8@plt>
mov    $0xa0,%edi
call   1040 <__asm_utils_in8@plt>
mov    %rax,%rcx
mov    $0x1,%ax
test   %cx,%cx
je     1153 <_pic_read_reg+0x33>
pop    %rbx
ret
mov    $0x20,%edi
call   1040 <__asm_utils_in8@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %cx,%cx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define signext i16 @_pic_read_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @__asm_utils_out8(i32 32, i8 signext %3)
%5 = load i8, i8* %2
%6 = call i32 @__asm_utils_out8(i32 160, i8 signext %5)
%7 = call i64 @__asm_utils_in8(i32 160)
%8 = trunc i64 %7 to i16
%9 = sext i16 %8 to i32
%10 = shl i32 %9, 8
%11 = icmp ne i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %1
%13 = call i64 @__asm_utils_in8(i32 32)
%14 = trunc i64 %13 to i16
%15 = sext i16 %14 to i32
%16 = icmp ne i32 %15, 0
br label %17
17: ; preds = %12, %1
%18 = phi i1 [ true, %1 ], [ %16, %12 ]
%19 = zext i1 %18 to i32
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
define signext i16 @_pic_read_reg(i8 signext %0) {
%2 = tail call i32 @__asm_utils_out8(i32 32, i8 signext %0)
%3 = tail call i32 @__asm_utils_out8(i32 160, i8 signext %0)
%4 = tail call i64 @__asm_utils_in8(i32 160)
%5 = and i64 %4, 65535
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = tail call i64 @__asm_utils_in8(i32 32)
%9 = and i64 %8, 65535
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i16
br label %12
12: ; preds = %7, %1
%13 = phi i16 [ 1, %1 ], [ %11, %7 ]
ret i16 %13
}
/* Variables and functions */
int sprintf(char *, char *, void *);
int default_key_printer(char *buffer, void *key) {
  return sprintf(buffer, "%p", key);
}


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

x86 assembly (clang, -O2):
<default_key_printer>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%p\00"
define i32 @default_key_printer(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 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [3 x i8] c"%p\00"
define i32 @default_key_printer(i8* nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 %3
}
int test_imm_6Duint16_reg(unsigned short val) {
  return ((val) & (-0x6D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_6Duint16_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, -109
%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_6Duint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -109
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *realloc(char *, scalar_t__);
scalar_t__ strlen(char *);
char *strgrow(char *str, int grow) {
  return realloc(str, strlen(str) + 1 + grow);
}


x86 assembly (clang, -O0):
<strgrow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
call   1040 <realloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strgrow>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %ebp,%rcx
lea    (%rcx,%rax,1),%rsi
add    $0x1,%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @strgrow(i8* nocapture %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = sext i32 %1 to i64
%5 = add nsw i64 %4, 1
%6 = add i64 %5, %3
%7 = tail call i8* @realloc(i8* %0, i64 %6)
ret i8* %7
}
char convertLowerLetter(char c) { return (char)(c + 32); }


x86 assembly (clang, -O0):
<convertLowerLetter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertLowerLetter>:
lea    0x20(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @convertLowerLetter(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, 32
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @convertLowerLetter(i8 signext %0) {
%2 = add i8 %0, 32
ret i8 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_vtab;
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int cXInit(int /*<<< orphan*/ *, void *, int, char const *const *,
           int /*<<< orphan*/ **, char **, int);
int cXCreate(sqlite3 *db, void *pAux, int argc, const char *const *argv,
             sqlite3_vtab **ppVTab, char **pzErr) {
  return cXInit(db, pAux, argc, argv, ppVTab, pzErr, 1);
}


x86 assembly (clang, -O0):
<cXCreate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
movl   $0x1,(%rsp)
call   1030 <cXInit@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cXCreate>:
push   %rax
movl   $0x1,(%rsp)
call   1030 <cXInit@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cXCreate(i32* %0, i8* %1, i32 %2, i8** %3, i32** %4, i8** %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i32**
%12 = alloca i8**
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8** %3, i8*** %10
store i32** %4, i32*** %11
store i8** %5, i8*** %12
%13 = load i32*, i32** %7
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = load i8**, i8*** %10
%17 = load i32**, i32*** %11
%18 = load i8**, i8*** %12
%19 = call i32 @cXInit(i32* %13, i8* %14, i32 %15, i8** %16, i32** %17, i8** %18, i32 1)
ret i32 %19
}

LLVM IR (-O2):
define i32 @cXCreate(i32* %0, i8* %1, i32 %2, i8** %3, i32** %4, i8** %5) {
%7 = tail call i32 @cXInit(i32* %0, i8* %1, i32 %2, i8** %3, i32** %4, i8** %5, i32 1)
ret i32 %7
}
int main(void) {
  int x;
  assert(my_func(x) == x);
  union my_U {
    int z;
    char ch;
    float f;
  } union_object;
  float some_float = 1.5;
  union_object = (union my_U)some_float;
  assert(union_object.f == 1.5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <my_func@plt>
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
movss  0xebc(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe94(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.my_U = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.my_U
%3 = alloca float
%4 = load i32, i32* %1
%5 = call i32 (i32, ...) bitcast (i32 (...)* @my_func to i32 (i32, ...)*)(i32 %4)
%6 = load i32, i32* %1
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %8)
store float 1.500000e+00, float* %3
%10 = bitcast %union.my_U* %2 to float*
%11 = load float, float* %3
store float %11, float* %10
%12 = bitcast %union.my_U* %2 to float*
%13 = load float, float* %12
%14 = fpext float %13 to double
%15 = fcmp oeq double %14, 1.500000e+00
%16 = zext i1 %15 to i32
%17 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @my_func to i32 (i32, ...)*)(i32 undef)
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret i32 0
}
int swapShortEndianness(short input) {
  int output = 0;
  for (int i = 0; i < sizeof(short); i++) {
    *((char *)&output + sizeof(short) - i - 1) = *((char *)&input + i);
  }
  return output;
}


x86 assembly (clang, -O0):
<swapShortEndianness>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x2,%rax
jae    114a <swapShortEndianness+0x4a>
movslq -0xc(%rbp),%rax
mov    -0x2(%rbp,%rax,1),%cl
movslq -0xc(%rbp),%rdx
xor    %eax,%eax
sub    %rdx,%rax
mov    %cl,-0x7(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <swapShortEndianness+0x19>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapShortEndianness>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @swapShortEndianness(i16 signext %0) {
%2 = alloca i16
%3 = alloca i32
%4 = alloca i32
store i16 %0, i16* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %22, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 2
br i1 %8, label %9, label %25
9: ; preds = %5
%10 = bitcast i16* %2 to i8*
%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 = bitcast i32* %3 to i8*
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = sub i64 0, %18
%20 = getelementptr inbounds i8, i8* %16, i64 %19
%21 = getelementptr inbounds i8, i8* %20, i64 -1
store i8 %14, i8* %21
br label %22
22: ; preds = %9
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %5
25: ; preds = %5
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @swapShortEndianness(i16 signext %0) {
%2 = call i16 @llvm.bswap.i16(i16 %0)
%3 = zext i16 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void close_file(int file_descriptor) { close(file_descriptor); }


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

x86 assembly (clang, -O2):
<close_file>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @close_file(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
size_t zero_or_ten(int);
void l3_concrete_overrun_Bad() {
  int a[zero_or_ten(0) + 5];
  a[zero_or_ten(1)] = 0;
}


x86 assembly (clang, -O0):
<l3_concrete_overrun_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
call   1030 <zero_or_ten@plt>
mov    %rax,%rcx
mov    %rcx,%rax
add    $0x5,%rax
mov    %rsp,%rdx
mov    %rdx,-0x8(%rbp)
lea    0x23(,%rcx,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <zero_or_ten@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l3_concrete_overrun_Bad>:
push   %rax
xor    %edi,%edi
call   1030 <zero_or_ten@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <zero_or_ten@plt>

LLVM IR (-O0):
define void @l3_concrete_overrun_Bad() {
%1 = alloca i8*
%2 = alloca i64
%3 = call i64 @zero_or_ten(i32 0)
%4 = add i64 %3, 5
%5 = call i8* @llvm.stacksave()
store i8* %5, i8** %1
%6 = alloca i32, i64 %4
store i64 %4, i64* %2
%7 = call i64 @zero_or_ten(i32 1)
%8 = getelementptr inbounds i32, i32* %6, i64 %7
store i32 0, i32* %8
%9 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
define void @l3_concrete_overrun_Bad() {
%1 = tail call i64 @zero_or_ten(i32 0)
%2 = tail call i64 @zero_or_ten(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ swap(int, int);
int main() {
  int a = 23, b = 16;
  swap(a, b);
  printf("a: %d, b: %d\n", a, b);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x17,%edi
mov    $0x10,%esi
call   1040 <swap@plt>
lea    0xec9(%rip),%rdi
mov    $0x17,%esi
mov    $0x10,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"a: %d, b: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 23, i32* %1
store i32 16, i32* %2
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = call i32 @swap(i32 %3, i32 %4)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"a: %d, b: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @swap(i32 23, i32 16)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 23, i32 16)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = -3;
  printf("%d", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffffd,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 -3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ uthread_exit();
void wrap_function(void (*entry)()) {
  entry();
  uthread_exit();
}


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

x86 assembly (clang, -O2):
<wrap_function>:
push   %rax
xor    %eax,%eax
call   *%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <uthread_exit@plt>

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

LLVM IR (-O2):
define void @wrap_function(void (...)* nocapture %0) {
tail call void (...) %0()
%2 = tail call i32 (...) @uthread_exit()
ret void
}