xunge/DecIR huggingface dataset:
int hid_sensor_convert_exponent(int unit_expo) {
  if (unit_expo < 0x08)
    return unit_expo;
  else if (unit_expo <= 0x0f)
    return -(0x0f - unit_expo + 1);
  else
    return 0;
}


x86 assembly (clang, -O0):
<hid_sensor_convert_exponent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    111c <hid_sensor_convert_exponent+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <hid_sensor_convert_exponent+0x44>
cmpl   $0xf,-0x8(%rbp)
jg     113d <hid_sensor_convert_exponent+0x3d>
mov    $0xf,%ecx
sub    -0x8(%rbp),%ecx
add    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <hid_sensor_convert_exponent+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hid_sensor_convert_exponent>:
lea    -0x10(%rdi),%ecx
xor    %eax,%eax
cmp    $0x10,%edi
cmovl  %ecx,%eax
cmp    $0x8,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @hid_sensor_convert_exponent(i32 %0) {
%2 = icmp slt i32 %0, 8
%3 = icmp slt i32 %0, 16
%4 = add i32 %0, -16
%5 = select i1 %3, i32 %4, i32 0
%6 = select i1 %2, i32 %0, i32 %5
ret i32 %6
}
int test_imm_DAuint8_mem(unsigned char *val) {
  return ((*val) & (0xDA << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DAuint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xda,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DAuint8_mem>:
testb  $0xda,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DAuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -38
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void class2posix_class() {}


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

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

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

LLVM IR (-O2):
define void @class2posix_class() {
ret void
}
int GSM_strlen(const char *str) {
  const char *eos = str;
  while (*eos++)
    ;
  return ((int)(eos - str - 1));
}


x86 assembly (clang, -O0):
<GSM_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
je     112d <GSM_strlen+0x2d>
jmp    1110 <GSM_strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GSM_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <GSM_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @GSM_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %4 to i64
%9 = ptrtoint i8* %0 to i64
%10 = xor i64 %9, -1
%11 = add i64 %8, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ testGenerateHugeHistoryFileWithSameLines();
int main(int argc, char *argv[]) { testGenerateHugeHistoryFileWithSameLines(); }


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @testGenerateHugeHistoryFileWithSameLines()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testGenerateHugeHistoryFileWithSameLines()
ret i32 0
}
void wbinvd(void) { __asm volatile("wbinvd" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @wbinvd() {
tail call void asm sideeffect "wbinvd", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_int(char *, int);
void protect(int seconds) {
  write_int("/sys/block/sda/device/unload_heads", seconds * 1000);
}


x86 assembly (clang, -O0):
<protect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <write_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<protect>:
imul   $0x3e8,%edi,%esi
lea    0xee3(%rip),%rdi
jmp    1030 <write_int@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"/sys/block/sda/device/unload_heads\00"
define void @protect(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @write_int(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"/sys/block/sda/device/unload_heads\00"
define void @protect(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @write_int(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int f(int);
main() {
  if (f(3) != 4)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1040 <f@plt>
cmp    $0x4,%eax
je     1149 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1040 <f@plt>
cmp    $0x4,%eax
jne    1134 <main+0x14>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = icmp eq i32 %1, 4
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
int decimalToBbinary(long number, char *str) {
  int i = 50 - 1;
  long decimal = number;
  int remainder;
  while (number > 0) {
    remainder = number % 2;
    str[i] = (remainder == 1 ? '1' : '0');
    number = number / 2;
    i--;
  }
  return (i + 1);
}


x86 assembly (clang, -O0):
<decimalToBbinary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x31,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jle    1179 <decimalToBbinary+0x79>
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    111b <decimalToBbinary+0x1b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimalToBbinary>:
test   %rdi,%rdi
jle    112f <decimalToBbinary+0x2f>
mov    $0x31,%eax
mov    %rdi,%rcx
nopl   (%rax)
mov    %edi,%edx
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,(%rsi,%rax,1)
shr    %rcx
add    $0xffffffffffffffff,%rax
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <decimalToBbinary+0x10>
add    $0x1,%eax
ret
mov    $0x32,%eax
ret

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

LLVM IR (-O2):
define i32 @decimalToBbinary(i64 %0, i8* nocapture writeonly %1) {
%3 = icmp sgt i64 %0, 0
br i1 %3, label %4, label %17
4: ; preds = %2, %4
%5 = phi i64 [ %12, %4 ], [ 49, %2 ]
%6 = phi i64 [ %11, %4 ], [ %0, %2 ]
%7 = and i64 %6, 1
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8 48, i8 49
%10 = getelementptr inbounds i8, i8* %1, i64 %5
store i8 %9, i8* %10
%11 = lshr i64 %6, 1
%12 = add nsw i64 %5, -1
%13 = icmp ult i64 %6, 2
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = trunc i64 %12 to i32
%16 = add i32 %15, 1
br label %17
17: ; preds = %14, %2
%18 = phi i32 [ 50, %2 ], [ %16, %14 ]
ret i32 %18
}
/* Variables and functions */
char *getenv(char *);
char *spp_var_get(char *var) { return getenv(var); }


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

x86 assembly (clang, -O2):
<spp_var_get>:
jmp    1030 <getenv@plt>

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

LLVM IR (-O2):
define i8* @spp_var_get(i8* nocapture %0) {
%2 = tail call i8* @getenv(i8* %0)
ret i8* %2
}
void trap_is_kprobe(unsigned long address, struct pt_regs *regs) {}


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

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

LLVM IR (-O0):
%struct.pt_regs = type opaque
define void @trap_is_kprobe(i64 %0, %struct.pt_regs* %1) {
%3 = alloca i64
%4 = alloca %struct.pt_regs*
store i64 %0, i64* %3
store %struct.pt_regs* %1, %struct.pt_regs** %4
ret void
}

LLVM IR (-O2):
%struct.pt_regs = type opaque
define void @trap_is_kprobe(i64 %0, %struct.pt_regs* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ binario(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() { printf("%ld", binario(1025)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x401,%edi
call   1040 <binario@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = tail call i32 @binario(i32 1025)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void gendelayslot() {}


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

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

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

LLVM IR (-O2):
define void @gendelayslot() {
ret void
}
void rop3_14_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D | S;
  stk2 = ~stk2;
  stk1 = T | stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_14_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_14_1_0>:
not    %dl
or     %sil,%dl
and    %dl,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_14_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %2, -1
%6 = or i8 %5, %1
%7 = and i8 %4, %6
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printSpaces(int n) {
  printf("\n");
  for (; n >= 0; n--)
    printf(" ");
}


x86 assembly (clang, -O0):
<printSpaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jl     114b <printSpaces+0x3b>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <printSpaces+0x17>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSpaces>:
push   %rbx
mov    %edi,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
js     113f <printSpaces+0x2f>
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1130 <printSpaces+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @printSpaces(i32 %0) {
%2 = tail call i32 @putchar(i32 10)
%3 = icmp sgt i32 %0, -1
br i1 %3, label %4, label %9
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %0, %1 ]
%6 = tail call i32 @putchar(i32 32)
%7 = add nsw i32 %5, -1
%8 = icmp eq i32 %5, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret void
}
/* Variables and functions */
char *strchr(char *, char);
int count_options(char *optstring) {
  int count = 0;
  char *ptr = optstring;
  while ((ptr = strchr(ptr, ':'))) {
    count++;
    ptr++;
  }
  return count;
}


x86 assembly (clang, -O0):
<count_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1161 <count_options+0x51>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112b <count_options+0x1b>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_options>:
push   %rbx
mov    $0x3a,%esi
call   1030 <strchr@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1149 <count_options+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <count_options+0x20>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @count_options(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %10, %1
%7 = load i8*, i8** %4
%8 = call i8* @strchr(i8* %7, i8 signext 58)
store i8* %8, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
br label %6
15: ; preds = %6
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @count_options(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %9, %4 ], [ %2, %1 ]
%6 = phi i32 [ %7, %4 ], [ 0, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = tail call i8* @strchr(i8* dereferenceable(1) %8, i8 signext 58)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
float squash(x)
float x;
{
  float m;
  return (1.0 / (1.0 + exp(-x)));
}


x86 assembly (clang, -O0):
<squash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <exp@plt>
movsd  0xebc(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xeb0(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squash>:
push   %rax
cvtsd2ss %xmm0,%xmm0
xorps  0xee4(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <exp@plt>
movsd  0xee3(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @squash(double %0) {
%2 = alloca float
%3 = alloca float
%4 = fptrunc double %0 to float
store float %4, float* %2
%5 = load float, float* %2
%6 = fneg float %5
%7 = fpext float %6 to double
%8 = call double @exp(double %7)
%9 = fadd double 1.000000e+00, %8
%10 = fdiv double 1.000000e+00, %9
%11 = fptrunc double %10 to float
ret float %11
}

LLVM IR (-O2):
define float @squash(double %0) {
%2 = fptrunc double %0 to float
%3 = fneg float %2
%4 = fpext float %3 to double
%5 = tail call double @exp(double %4)
%6 = fadd double %5, 1.000000e+00
%7 = fdiv double 1.000000e+00, %6
%8 = fptrunc double %7 to float
ret float %8
}
unsigned int DFhash(const char *s) {
  unsigned int hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = *s + 31 * hashval;
  return hashval % 101;
}


x86 assembly (clang, -O0):
<DFhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <DFhash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <DFhash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DFhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1147 <DFhash+0x47>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <DFhash+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @DFhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
void setval_276(unsigned *p) { *p = 3372794504U; }


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

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

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

LLVM IR (-O2):
define void @setval_276(i32* nocapture writeonly %0) {
store i32 -922172792, i32* %0
ret void
}
/* Type definitions */
struct sockaddr_in6 {
  int /*<<< orphan*/ sin6_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int main(void) {
  struct sockaddr_in6 sa;
  sa.sin6_family = AF_INET6;
  return 0;
}


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

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

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32 }
@AF_INET6 = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in6
store i32 0, i32* %1
%3 = load i32, i32* @AF_INET6
%4 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %2, i32 0, i32 0
store i32 %3, i32* %4
ret i32 0
}

LLVM IR (-O2):
@AF_INET6 = global i32 0
define i32 @main() {
ret i32 0
}
/* Variables and functions */
void Reserved_Handler34(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Reserved_Handler34>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Reserved_Handler34+0x9>
jmp    1109 <Reserved_Handler34+0x9>

x86 assembly (clang, -O2):
<Reserved_Handler34>:
jmp    1100 <Reserved_Handler34>

LLVM IR (-O0):
define void @Reserved_Handler34() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Reserved_Handler34() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int umap_file(void *p, int length, int fd) {
  if (p == NULL)
    return 1;
  if (length < 1)
    return 1;
  if (fd != -1)
    return 1;
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<umap_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1139 <umap_file+0x29>
movl   $0x1,-0x4(%rbp)
jmp    1175 <umap_file+0x65>
cmpl   $0x1,-0x14(%rbp)
jge    114f <umap_file+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1175 <umap_file+0x65>
cmpl   $0xffffffff,-0x18(%rbp)
je     1165 <umap_file+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1175 <umap_file+0x65>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umap_file>:
mov    $0x1,%eax
test   %rdi,%rdi
je     112f <umap_file+0x1f>
test   %esi,%esi
jle    112f <umap_file+0x1f>
cmp    $0xffffffff,%edx
jne    112f <umap_file+0x1f>
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @umap_file(i8* %0, i32 %1, i32 %2) {
%4 = icmp ne i8* %0, null
%5 = icmp sgt i32 %1, 0
%6 = and i1 %4, %5
%7 = icmp eq i32 %2, -1
%8 = and i1 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = tail call i32 @free(i8* %0)
br label %11
11: ; preds = %3, %9
%12 = phi i32 [ 0, %9 ], [ 1, %3 ]
ret i32 %12
}
/* Variables and functions */
unsigned short foo2(int);
__attribute__((no)) unsigned short int bar2(int x) { return foo2(x + 6); }


x86 assembly (clang, -O0):
<bar2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x6,%edi
call   1030 <foo2@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar2>:
add    $0x6,%edi
jmp    1030 <foo2@plt>

LLVM IR (-O0):
define zeroext i16 @bar2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 6
%5 = call zeroext i16 @foo2(i32 %4)
ret i16 %5
}

LLVM IR (-O2):
define zeroext i16 @bar2(i32 %0) {
%2 = add nsw i32 %0, 6
%3 = tail call zeroext i16 @foo2(i32 %2)
ret i16 %3
}
int tracecmd_host_bigendian(void) {
  unsigned char str[] = {0x1, 0x2, 0x3, 0x4};
  unsigned int *ptr;
  ptr = (unsigned int *)str;
  return *ptr == 0x01020304;
}


x86 assembly (clang, -O0):
<tracecmd_host_bigendian>:
push   %rbp
mov    %rsp,%rbp
mov    0xef6(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x1020304,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.tracecmd_host_bigendian.str = [4 x i8] c"\01\02\03\04"
define i32 @tracecmd_host_bigendian() {
%1 = alloca [4 x i8]
%2 = alloca i32*
%3 = bitcast [4 x i8]* %1 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 16909060
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @tracecmd_host_bigendian() {
ret i32 0
}
void foo027(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo027(i32 %0) {
ret void
}
void i2c_init(void) {}


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

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

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

LLVM IR (-O2):
define void @i2c_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ aesc_encrypt(unsigned char const *, unsigned char *,
                                unsigned char *);
int /*<<< orphan*/ aesc_keyexp(unsigned char const *, unsigned char *);
int /*<<< orphan*/ copy_block(unsigned char *, unsigned char *);
void AES_ENCRYPT(unsigned char *out, const unsigned char *in,
                 const unsigned char *key) {
  unsigned char buf[16];
  unsigned char expkey[11 * 16];
  aesc_keyexp(key, expkey);
  aesc_encrypt(in, buf, expkey);
  copy_block(out, buf);
}


x86 assembly (clang, -O0):
<AES_ENCRYPT>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1030 <aesc_keyexp@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1040 <aesc_encrypt@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <copy_block@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AES_ENCRYPT>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x10(%rsp),%r15
mov    %rdx,%rdi
mov    %r15,%rsi
call   1030 <aesc_keyexp@plt>
mov    %rsp,%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1040 <aesc_encrypt@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <copy_block@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @AES_ENCRYPT(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [16 x i8]
%8 = alloca [176 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = getelementptr inbounds [176 x i8], [176 x i8]* %8, i64 0, i64 0
%11 = call i32 @aesc_keyexp(i8* %9, i8* %10)
%12 = load i8*, i8** %5
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [176 x i8], [176 x i8]* %8, i64 0, i64 0
%15 = call i32 @aesc_encrypt(i8* %12, i8* %13, i8* %14)
%16 = load i8*, i8** %4
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%18 = call i32 @copy_block(i8* %16, i8* %17)
ret void
}

LLVM IR (-O2):
define void @AES_ENCRYPT(i8* %0, i8* %1, i8* %2) {
%4 = alloca [16 x i8]
%5 = alloca [176 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [176 x i8], [176 x i8]* %5, i64 0, i64 0
%8 = call i32 @aesc_keyexp(i8* %2, i8* %7)
%9 = call i32 @aesc_encrypt(i8* %1, i8* %6, i8* %7)
%10 = call i32 @copy_block(i8* %0, i8* %6)
ret void
}
void kore_accesslog_init(void) {}


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

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

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

LLVM IR (-O2):
define void @kore_accesslog_init() {
ret void
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int gettimeofday(struct timeval *, struct timezone *);
double mysecond(void) {
  struct timeval tp;
  struct timezone tzp;
  int i;
  i = gettimeofday(&tp, &tzp);
  return ((double)tp.tv_sec + (double)tp.tv_usec * 1.e-6);
}


x86 assembly (clang, -O0):
<mysecond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
mov    %eax,-0x1c(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec4(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mysecond>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xec9(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @mysecond() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = alloca i32
%4 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
store i32 %4, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 0x3EB0C6F7A0B5ED8D, double %7)
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @mysecond() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3EB0C6F7A0B5ED8D, double %8)
ret double %12
}
/* Type definitions */
struct vec_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vec_destroy(struct vec_t *);
int /*<<< orphan*/ vec_initfrom(struct vec_t *, struct vec_t const *);
void vec_copy(struct vec_t *dst, const struct vec_t *src) {
  ;
  vec_destroy(dst);
  vec_initfrom(dst, src);
  { return; };
}


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

x86 assembly (clang, -O2):
<vec_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <vec_destroy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <vec_initfrom@plt>

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

LLVM IR (-O2):
%struct.vec_t = type { i32 }
define void @vec_copy(%struct.vec_t* %0, %struct.vec_t* %1) {
%3 = tail call i32 @vec_destroy(%struct.vec_t* %0)
%4 = tail call i32 @vec_initfrom(%struct.vec_t* %0, %struct.vec_t* %1)
ret void
}
void vhdcRefresh() {}


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

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

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

LLVM IR (-O2):
define void @vhdcRefresh() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(char);
void ft_print_putchar(char a, char b, char c) {
  ft_putchar(a);
  ft_putchar(b);
  ft_putchar(c);
  ft_putchar(',');
  ft_putchar(' ');
}


x86 assembly (clang, -O0):
<ft_print_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <ft_putchar@plt>
movsbl -0x2(%rbp),%edi
call   1030 <ft_putchar@plt>
movsbl -0x3(%rbp),%edi
call   1030 <ft_putchar@plt>
mov    $0x2c,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_print_putchar>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1030 <ft_putchar@plt>
mov    %ebp,%edi
call   1030 <ft_putchar@plt>
mov    %ebx,%edi
call   1030 <ft_putchar@plt>
mov    $0x2c,%edi
call   1030 <ft_putchar@plt>
mov    $0x20,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
define void @ft_print_putchar(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %4
%8 = call i32 @ft_putchar(i8 signext %7)
%9 = load i8, i8* %5
%10 = call i32 @ft_putchar(i8 signext %9)
%11 = load i8, i8* %6
%12 = call i32 @ft_putchar(i8 signext %11)
%13 = call i32 @ft_putchar(i8 signext 44)
%14 = call i32 @ft_putchar(i8 signext 32)
ret void
}

LLVM IR (-O2):
define void @ft_print_putchar(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = tail call i32 @ft_putchar(i8 signext %0)
%5 = tail call i32 @ft_putchar(i8 signext %1)
%6 = tail call i32 @ft_putchar(i8 signext %2)
%7 = tail call i32 @ft_putchar(i8 signext 44)
%8 = tail call i32 @ft_putchar(i8 signext 32)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void ptyClose(int fd) { close(fd); }


x86 assembly (clang, -O0):
<ptyClose>:
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):
<ptyClose>:
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @ptyClose(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 @ptyClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
unsigned int hash(unsigned char *str) {
  unsigned int hash = 5381;
  int c;
  while ((c = *str++) != 0)
    hash = ((hash << 5) + hash) ^ c;
  return hash;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1141 <hash+0x41>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
add    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1138 <hash+0x38>
add    $0x1,%rdi
mov    $0x1505,%edx
mov    %edx,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl %cl,%ecx
shl    $0x5,%eax
add    %edx,%eax
xor    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1120 <hash+0x20>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 5381, %1 ]
%8 = zext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = mul i32 %7, 33
%11 = xor i32 %10, %8
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 5381, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Type definitions */
typedef int /*<<< orphan*/ buf2;
typedef int /*<<< orphan*/ buf1;

/* Variables and functions */
int BUFSIZ;
char *alloca(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  char buf1[BUFSIZ];
  char *buf2;
  buf2 = alloca(BUFSIZ);
  printf("sizeof buf1 = %zd\n", sizeof(buf1));
  printf("sizeof buf2 = %zd\n", sizeof(buf2));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x28(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1040 <alloca@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,-0x20(%rbp)
mov    %eax,%esi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1040 <alloca@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [19 x i8] c"sizeof buf1 = %zd\0A\00"
@.str.1 = [19 x i8] c"sizeof buf2 = %zd\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i32 0, i32* %1
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %2
%8 = alloca i8, i64 %6
store i64 %6, i64* %3
%9 = load i32, i32* @BUFSIZ
%10 = call i8* @alloca(i32 %9)
store i8* %10, i8** %4
%11 = trunc i64 %6 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 8)
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [19 x i8] c"sizeof buf1 = %zd\0A\00"
@.str.1 = [19 x i8] c"sizeof buf2 = %zd\0A\00"
define i32 @main() {
%1 = load i32, i32* @BUFSIZ
%2 = tail call i8* @alloca(i32 %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 8)
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ create_letter_distribution_diagram(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char EntryText[4000];
  scanf("%[^\n]s", EntryText);
  create_letter_distribution_diagram(EntryText);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xfb0(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
lea    -0xfb0(%rbp),%rdi
call   1030 <create_letter_distribution_diagram@plt>
xor    %eax,%eax
add    $0xfb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xfa0,%rsp
lea    0xed1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <create_letter_distribution_diagram@plt>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%[^\0A]s\00"
define i32 @main() {
%1 = alloca [4000 x i8]
%2 = getelementptr inbounds [4000 x i8], [4000 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @create_letter_distribution_diagram(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int len, size, x, y, newx1, newx2, newy1, newy2;
  int infile;
  infile = open(argv[1], O_RDONLY);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i32, i32* @O_RDONLY
%19 = call i32 @open(i8* %17, i32 %18)
store i32 %19, i32* %14
ret i32 0
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* %4, i32 %5)
ret i32 0
}