xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ test_self_similarity();
int /*<<< orphan*/ test_similarity();
int main(int argc, const char *argv[]) {
  test_similarity();
  test_self_similarity();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_similarity()
%4 = tail call i32 (...) @test_self_similarity()
ret i32 0
}
int isdelim(char simbol) {}


x86 assembly (clang, -O0):
<isdelim>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @isdelim(i8 signext %0) {
ret i32 undef
}
/* Type definitions */
typedef long long int64_t;

/* Variables and functions */
long long bytes2mbll(int64_t bytes) { return (bytes + (1ll << 20) - 1) >> 20; }


x86 assembly (clang, -O0):
<bytes2mbll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x100000,%rax
sub    $0x1,%rax
sar    $0x14,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes2mbll>:
lea    0xfffff(%rdi),%rax
sar    $0x14,%rax
ret

LLVM IR (-O0):
define i64 @bytes2mbll(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 1048576
%5 = sub nsw i64 %4, 1
%6 = ashr i64 %5, 20
ret i64 %6
}

LLVM IR (-O2):
define i64 @bytes2mbll(i64 %0) {
%2 = add nsw i64 %0, 1048575
%3 = ashr i64 %2, 20
ret i64 %3
}
void gusty_wind(struct battle_char *origin, struct battle_char *target) {}


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

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

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

LLVM IR (-O2):
%struct.battle_char = type opaque
define void @gusty_wind(%struct.battle_char* nocapture %0, %struct.battle_char* nocapture %1) {
ret void
}
char to_hex(char nb) { return "0123456789abcdef"[nb & 15]; }


x86 assembly (clang, -O0):
<to_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xee5(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_hex>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789abcdef\00"
define signext i8 @to_hex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 15
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define signext i8 @to_hex(i8 signext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ esperar();
int main(void) {
  volatile unsigned char *puerto_b = (unsigned char *)0x25;
  while (1) {
    *puerto_b = *puerto_b | (0x20);
    esperar();
    *puerto_b = *puerto_b & (~(0x20));
    esperar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x25,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
movzbl %al,%eax
or     $0x20,%eax
mov    %eax,-0x18(%rbp)
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <esperar@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
movzbl %al,%eax
and    $0xffffffdf,%eax
mov    %eax,-0x14(%rbp)
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <esperar@plt>
jmp    1128 <main+0x18>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
orb    $0x20,0x25
20
xor    %eax,%eax
call   1030 <esperar@plt>
andb   $0xdf,0x25
df
xor    %eax,%eax
call   1030 <esperar@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* inttoptr (i64 37 to i8*), i8** %2
br label %3
3: ; preds = %0, %3
%4 = load i8*, i8** %2
%5 = load volatile i8, i8* %4
%6 = zext i8 %5 to i32
%7 = or i32 %6, 32
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %2
store volatile i8 %8, i8* %9
%10 = call i32 (...) @esperar()
%11 = load i8*, i8** %2
%12 = load volatile i8, i8* %11
%13 = zext i8 %12 to i32
%14 = and i32 %13, -33
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %2
store volatile i8 %15, i8* %16
%17 = call i32 (...) @esperar()
br label %3
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i8, i8* inttoptr (i64 37 to i8*)
%3 = or i8 %2, 32
store volatile i8 %3, i8* inttoptr (i64 37 to i8*)
%4 = tail call i32 (...) @esperar()
%5 = load volatile i8, i8* inttoptr (i64 37 to i8*)
%6 = and i8 %5, -33
store volatile i8 %6, i8* inttoptr (i64 37 to i8*)
%7 = tail call i32 (...) @esperar()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("dyngen (c) 2003 Fabrice Bellard\n"
         "usage: dyngen [-o outfile] [-c] objfile\n"
         "Generate a dynamic code generator from an object file\n"
         "-c     output enum of operations\n"
         "-g     output gen_op_xx() functions\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [196 x i8] c"dyngen (c) 2003 Fabrice Bellard\0Ausage: dyngen [-o outfile] [-c] objfile\0AGenerate a dynamic code generator from an object file\0A-c output enum of operations\0A-g output gen_op_xx() functions\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [195 x i8] c"dyngen (c) 2003 Fabrice Bellard\0Ausage: dyngen [-o outfile] [-c] objfile\0AGenerate a dynamic code generator from an object file\0A-c output enum of operations\0A-g output gen_op_xx() functions\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([195 x i8], [195 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t rotr32(const uint32_t w, const unsigned int c) {
  return (w >> c) | (w << (32 - c));
}


x86 assembly (clang, -O0):
<rotr32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotr32>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @rotr32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rotr32(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
void sigusr2_handler(int signal) {}


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

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

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

LLVM IR (-O2):
define void @sigusr2_handler(i32 %0) {
ret void
}
void RandomFunc(unsigned int input[1], unsigned int output[1]) {
  unsigned int state[1];
  unsigned int local2;
  unsigned int local1;
  {
    state[0UL] = (input[0UL] | 51238316UL) >> 3U;
    local1 = 0UL;
    while (local1 < 0U) {
      local2 = 0UL;
      while (local2 < 0U) {
        local2 += 2UL;
      }
      local1 += 2UL;
    }
    output[0UL] = state[0UL] | 458711886UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
or     $0x30dd5ac,%rax
shr    $0x3,%rax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jae    115f <RandomFunc+0x5f>
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jae    1150 <RandomFunc+0x50>
mov    -0x18(%rbp),%eax
add    $0x2,%rax
mov    %eax,-0x18(%rbp)
jmp    1137 <RandomFunc+0x37>
mov    -0x1c(%rbp),%eax
add    $0x2,%rax
mov    %eax,-0x1c(%rbp)
jmp    1126 <RandomFunc+0x26>
mov    -0x14(%rbp),%eax
or     $0x1b57634e,%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%eax
shr    $0x3,%eax
or     $0x1b77fbff,%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [1 x i32]
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = zext i32 %10 to i64
%12 = or i64 %11, 51238316
%13 = lshr i64 %12, 3
%14 = trunc i64 %13 to i32
%15 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
store i32 %14, i32* %15
store i32 0, i32* %7
br label %16
16: ; preds = %28, %2
%17 = load i32, i32* %7
%18 = icmp ult i32 %17, 0
br i1 %18, label %19, label %33
19: ; preds = %16
store i32 0, i32* %6
br label %20
20: ; preds = %23, %19
%21 = load i32, i32* %6
%22 = icmp ult i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %6
%25 = zext i32 %24 to i64
%26 = add i64 %25, 2
%27 = trunc i64 %26 to i32
store i32 %27, i32* %6
br label %20
28: ; preds = %20
%29 = load i32, i32* %7
%30 = zext i32 %29 to i64
%31 = add i64 %30, 2
%32 = trunc i64 %31 to i32
store i32 %32, i32* %7
br label %16
33: ; preds = %16
%34 = getelementptr inbounds [1 x i32], [1 x i32]* %5, i64 0, i64 0
%35 = load i32, i32* %34
%36 = zext i32 %35 to i64
%37 = or i64 %36, 458711886
%38 = trunc i64 %37 to i32
%39 = load i32*, i32** %4
%40 = getelementptr inbounds i32, i32* %39, i64 0
store i32 %38, i32* %40
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = lshr i32 %3, 3
%5 = or i32 %4, 460848127
store i32 %5, i32* %1
ret void
}
void sanb_smp_store_memory_barrier(void) {
  asm volatile("sfence" ::: "memory");
}


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

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

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

LLVM IR (-O2):
define void @sanb_smp_store_memory_barrier() {
tail call void asm sideeffect "sfence", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ loop();
void main() {
  init();
  for (;;) {
    loop();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <init@plt>
mov    $0x0,%al
call   1030 <loop@plt>
jmp    112b <main+0xb>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <loop@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @init()
br label %2
2: ; preds = %2, %0
%3 = call i32 (...) @loop()
br label %2
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @init()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @loop()
br label %2
}
/* Variables and functions */
int getstrings(char **, char **, int);
char *getfname(char *desc, char *fname, int field) {
  char *fieldname[2];
  char *fieldbuf[1];
  fieldname[0] = desc;
  fieldname[1] = 0;
  fieldbuf[0] = fname;
  return (getstrings(fieldname, fieldbuf, field) == 0x1b) ? NULL : fname;
}


x86 assembly (clang, -O0):
<getfname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <getstrings@plt>
cmp    $0x1b,%eax
jne    115f <getfname+0x4f>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    1167 <getfname+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfname>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %rdi,0x10(%rsp)
movq   $0x0,0x18(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <getstrings@plt>
xor    %ecx,%ecx
cmp    $0x1b,%eax
cmovne %rbx,%rcx
mov    %rcx,%rax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @getfname(i8* %0, i8* %1, i32 %2) {
%4 = alloca [2 x i8*]
%5 = alloca [1 x i8*]
%6 = bitcast [2 x i8*]* %4 to i8*
%7 = bitcast [1 x i8*]* %5 to i8*
%8 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
store i8* %0, i8** %8
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 1
store i8* null, i8** %9
%10 = getelementptr inbounds [1 x i8*], [1 x i8*]* %5, i64 0, i64 0
store i8* %1, i8** %10
%11 = call i32 @getstrings(i8** %8, i8** %10, i32 %2)
%12 = icmp eq i32 %11, 27
%13 = select i1 %12, i8* null, i8* %1
ret i8* %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
void skipIDLine(FILE *fIn) {
  char c;
  c = fgetc(fIn);
  while (c != '\n')
    c = fgetc(fIn);
}


x86 assembly (clang, -O0):
<skipIDLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     1146 <skipIDLine+0x36>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
jmp    1128 <skipIDLine+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipIDLine>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <fgetc@plt>
cmp    $0xa,%al
je     112e <skipIDLine+0x1e>
mov    %rbx,%rdi
jmp    1120 <skipIDLine+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @skipIDLine(i32* nocapture %0) {
%2 = tail call signext i8 @fgetc(i32* %0)
%3 = icmp eq i8 %2, 10
br i1 %3, label %7, label %4
4: ; preds = %1, %4
%5 = tail call signext i8 @fgetc(i32* %0)
%6 = icmp eq i8 %5, 10
br i1 %6, label %7, label %4
7: ; preds = %4, %1
ret void
}
void f12(a13, a14) int a13;
struct file *a14;
{
}


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

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

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

LLVM IR (-O2):
%struct.file = type opaque
define void @f12(i32 %0, %struct.file* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exercise_two();
int main(int argc, char **argv) {
  exercise_two();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @exercise_two()
ret i32 0
}
void glmReverseVector3d(double v[3]) {
  v[0] = -v[0];
  v[1] = -v[1];
  v[2] = -v[2];
}


x86 assembly (clang, -O0):
<glmReverseVector3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmReverseVector3d>:
movups (%rdi),%xmm0
movaps 0xef6(%rip),%xmm1
xorps  %xmm1,%xmm0
movups %xmm0,(%rdi)
movsd  0x10(%rdi),%xmm0
xorps  %xmm1,%xmm0
movlps %xmm0,0x10(%rdi)
ret

LLVM IR (-O0):
define void @glmReverseVector3d(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = fneg double %5
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 0
store double %6, double* %8
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = fneg double %11
%13 = load double*, double** %2
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %2
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = fneg double %17
%19 = load double*, double** %2
%20 = getelementptr inbounds double, double* %19, i64 2
store double %18, double* %20
ret void
}

LLVM IR (-O2):
define void @glmReverseVector3d(double* nocapture %0) {
%2 = bitcast double* %0 to <2 x double>*
%3 = load <2 x double>, <2 x double>* %2
%4 = fneg <2 x double> %3
%5 = bitcast double* %0 to <2 x double>*
store <2 x double> %4, <2 x double>* %5
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = fneg double %7
store double %8, double* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ io_init(int);
int /*<<< orphan*/ io_set_port_direction(int, int);
int /*<<< orphan*/ io_write_pin(int, int);
int /*<<< orphan*/ io_write_port(int /*<<< orphan*/, int);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  io_init(1);
  io_set_port_direction(0, 0x00);
  io_set_port_direction(1, 0x00);
  io_write_port(0, 0x00);
  while (1) {
    io_write_pin(1, 1);
    usleep(1000000);
    io_write_pin(1, 0);
    usleep(1000000);
  }
  (void)argc;
  (void)argv;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <io_init@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <io_set_port_direction@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <io_set_port_direction@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1060 <io_write_port@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <io_write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <io_write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
jmp    118e <main+0x3e>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <io_init@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <io_set_port_direction@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <io_set_port_direction@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1060 <io_write_port@plt>
nopl   0x0(%rax)
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <io_write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <io_write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
jmp    1180 <main+0x30>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @io_init(i32 1)
%7 = call i32 @io_set_port_direction(i32 0, i32 0)
%8 = call i32 @io_set_port_direction(i32 1, i32 0)
%9 = call i32 @io_write_port(i32 0, i32 0)
br label %10
10: ; preds = %2, %10
%11 = call i32 @io_write_pin(i32 1, i32 1)
%12 = call i32 @usleep(i32 1000000)
%13 = call i32 @io_write_pin(i32 1, i32 0)
%14 = call i32 @usleep(i32 1000000)
br label %10
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @io_init(i32 1)
%4 = tail call i32 @io_set_port_direction(i32 0, i32 0)
%5 = tail call i32 @io_set_port_direction(i32 1, i32 0)
%6 = tail call i32 @io_write_port(i32 0, i32 0)
br label %7
7: ; preds = %2, %7
%8 = tail call i32 @io_write_pin(i32 1, i32 1)
%9 = tail call i32 @usleep(i32 1000000)
%10 = tail call i32 @io_write_pin(i32 1, i32 0)
%11 = tail call i32 @usleep(i32 1000000)
br label %7
}
/* Variables and functions */
int /*<<< orphan*/ sorter_1();
int main() {
  sorter_1();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @sorter_1()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sorter_1()
ret i32 0
}
/* Variables and functions */
double atan2(double, double);
double Double_atan2(double y, double x) { return atan2(y, x); }


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

x86 assembly (clang, -O2):
<Double_atan2>:
jmp    1030 <atan2@plt>

LLVM IR (-O0):
define double @Double_atan2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @atan2(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @Double_atan2(double %0, double %1) {
%3 = tail call double @atan2(double %0, double %1)
ret double %3
}
/* Variables and functions */
scalar_t__ strtold(char const *, char **);
float strtof(const char *nptr, char **endptr) {
  return (float)strtold(nptr, endptr);
}


x86 assembly (clang, -O0):
<strtof>:
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 <strtold@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtof>:
push   %rax
call   1030 <strtold@plt>
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @strtof(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 i64 @strtold(i8* %5, i8** %6)
%8 = sitofp i64 %7 to float
ret float %8
}

LLVM IR (-O2):
define float @strtof(i8* %0, i8** nocapture %1) {
%3 = tail call i64 @strtold(i8* %0, i8** %1)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Type definitions */
struct stat {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
scalar_t__ ENOENT;
int /*<<< orphan*/ assert(int);
scalar_t__ errno;
int lstat(char const *, struct stat *);
void test_lookup_fail(const char *pathname) {
  struct stat st;
  ssize_t rv;
  rv = lstat(pathname, &st);
  assert(rv == -1 && errno == ENOENT);
}


x86 assembly (clang, -O0):
<test_lookup_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <lstat@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jne    1165 <test_lookup_fail+0x45>
mov    0x2e8e(%rip),%rax
mov    (%rax),%rax
mov    0x2e74(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lookup_fail>:
push   %rax
mov    %rsp,%rsi
call   1030 <lstat@plt>
cmp    $0xffffffff,%eax
sete   %al
mov    0x2eaa(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2e90(%rip),%rdx
cmp    (%rdx),%rcx
sete   %cl
and    %al,%cl
movzbl %cl,%edi
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@errno = global i64 0
@ENOENT = global i64 0
define void @test_lookup_fail(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @lstat(i8* %5, %struct.stat* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i64, i64* @errno
%11 = load i64, i64* @ENOENT
%12 = icmp eq i64 %10, %11
br label %13
13: ; preds = %9, %1
%14 = phi i1 [ false, %1 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@errno = global i64 0
@ENOENT = global i64 0
define void @test_lookup_fail(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @lstat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
%6 = load i64, i64* @errno
%7 = load i64, i64* @ENOENT
%8 = icmp eq i64 %6, %7
%9 = select i1 %5, i1 %8, i1 false
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ numbers(int);
void printMinute(int m) {
  if (m <= 20) {
    numbers(m);
  } else {
    numbers(20);
    numbers(m % 10);
  }
}


x86 assembly (clang, -O0):
<printMinute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x14,-0x4(%rbp)
jg     1132 <printMinute+0x22>
mov    -0x4(%rbp),%edi
call   1030 <numbers@plt>
jmp    114e <printMinute+0x3e>
mov    $0x14,%edi
call   1030 <numbers@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <numbers@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMinute>:
push   %rbx
mov    %edi,%ebx
cmp    $0x15,%edi
jl     1138 <printMinute+0x28>
mov    $0x14,%edi
call   1030 <numbers@plt>
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <numbers@plt>

LLVM IR (-O0):
define void @printMinute(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 20
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @numbers(i32 %6)
br label %13
8: ; preds = %1
%9 = call i32 @numbers(i32 20)
%10 = load i32, i32* %2
%11 = srem i32 %10, 10
%12 = call i32 @numbers(i32 %11)
br label %13
13: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
define void @printMinute(i32 %0) {
%2 = icmp slt i32 %0, 21
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @numbers(i32 20)
%5 = urem i32 %0, 10
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ %0, %1 ]
%8 = tail call i32 @numbers(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kprint(char *, char *, int /*<<< orphan*/, int, int);
void init() {
  kprint("Qernel init. Version: %s", "Version: %u.%u.%u", 0, 1, 1);
  while (1) {
  }
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef7(%rip),%rsi
xor    %edx,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <kprint@plt>
jmp    1132 <init+0x22>

x86 assembly (clang, -O2):
<init>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xefa(%rip),%rsi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <kprint@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1140 <init+0x30>

LLVM IR (-O0):
@.str = [25 x i8] c"Qernel init. Version: %s\00"
@.str.1 = [18 x i8] c"Version: %u.%u.%u\00"
define void @init() {
%1 = call i32 @kprint(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i32 1)
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [25 x i8] c"Qernel init. Version: %s\00"
@.str.1 = [18 x i8] c"Version: %u.%u.%u\00"
define void @init() {
%1 = tail call i32 @kprint(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i32 1)
br label %2
2: ; preds = %0, %2
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t l2cap_event_channel_opened_get_status(const uint8_t *event) {
  return event[2];
}


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

x86 assembly (clang, -O2):
<l2cap_event_channel_opened_get_status>:
mov    0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @l2cap_event_channel_opened_get_status(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @l2cap_event_channel_opened_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
int nfactors(long long n) {
  long long f;
  int c = 2;
  for (f = 2; f * f < n; ++f) {
    if (n % f == 0)
      c += 2;
  }
  if (f * f == n)
    ++c;
  return c;
}


x86 assembly (clang, -O0):
<nfactors>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x2,-0x14(%rbp)
movq   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jge    115d <nfactors+0x5d>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    1147 <nfactors+0x47>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <nfactors+0x4c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <nfactors+0x17>
mov    -0x10(%rbp),%rax
imul   -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jne    1179 <nfactors+0x79>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfactors>:
mov    %rdi,%r8
mov    $0x4,%edx
mov    $0x2,%esi
cmp    $0x5,%rdi
jl     1158 <nfactors+0x58>
mov    $0x2,%ecx
jmp    1143 <nfactors+0x43>
nopw   0x0(%rax,%rax,1)
mov    %r8,%rax
cqto
idiv   %rcx
lea    0x2(%rsi),%edi
test   %rdx,%rdx
cmovne %esi,%edi
add    $0x1,%rcx
mov    %rcx,%rdx
imul   %rcx,%rdx
mov    %edi,%esi
cmp    %r8,%rdx
jge    115d <nfactors+0x5d>
mov    %r8,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1120 <nfactors+0x20>
mov    %r8d,%eax
xor    %edx,%edx
div    %ecx
jmp    1128 <nfactors+0x28>
mov    $0x2,%edi
xor    %eax,%eax
cmp    %r8,%rdx
sete   %al
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @nfactors(i64 %0) {
%2 = icmp sgt i64 %0, 4
br i1 %2, label %3, label %13
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 2, %1 ]
%5 = phi i64 [ %10, %3 ], [ 2, %1 ]
%6 = srem i64 %0, %5
%7 = icmp eq i64 %6, 0
%8 = add nsw i32 %4, 2
%9 = select i1 %7, i32 %8, i32 %4
%10 = add nuw nsw i64 %5, 1
%11 = mul nsw i64 %10, %10
%12 = icmp slt i64 %11, %0
br i1 %12, label %3, label %13
13: ; preds = %3, %1
%14 = phi i32 [ 2, %1 ], [ %9, %3 ]
%15 = phi i64 [ 4, %1 ], [ %11, %3 ]
%16 = icmp eq i64 %15, %0
%17 = zext i1 %16 to i32
%18 = add nsw i32 %14, %17
ret i32 %18
}
unsigned ring_hash(unsigned pid) { return pid / 1000 % 100; }


x86 assembly (clang, -O0):
<ring_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ring_hash>:
mov    %edi,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
imul   $0x51eb851f,%rax,%rcx
shr    $0x25,%rcx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ring_hash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 1000
%5 = urem i32 %4, 100
ret i32 %5
}

LLVM IR (-O2):
define i32 @ring_hash(i32 %0) {
%2 = udiv i32 %0, 1000
%3 = urem i32 %2, 100
ret i32 %3
}
dectst(pn) int pn;
{ brc2(2, pn, 'y'); }


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

x86 assembly (clang, -O2):
<dectst>:
mov    %edi,%esi
mov    $0x2,%edi
mov    $0x79,%edx
xor    %eax,%eax
jmp    1030 <brc2@plt>

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

LLVM IR (-O2):
define i32 @dectst(i32 %0) {
%2 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @brc2 to i32 (i32, i32, i32, ...)*)(i32 2, i32 %0, i32 121)
ret i32 undef
}
/* Type definitions */
typedef int dev_t;

/* Variables and functions */
unsigned int minor(dev_t dev) {
  return (dev & 0xff) | ((unsigned int)(dev >> 12) & ~0xff);
}


x86 assembly (clang, -O0):
<minor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
sar    $0xc,%ecx
and    $0xffffff00,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minor>:
movzbl %dil,%eax
sar    $0xc,%edi
and    $0xffffff00,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @minor(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = load i32, i32* %2
%6 = ashr i32 %5, 12
%7 = and i32 %6, -256
%8 = or i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @minor(i32 %0) {
%2 = and i32 %0, 255
%3 = ashr i32 %0, 12
%4 = and i32 %3, -256
%5 = or i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int f486(int *);
int f487(int *p) { return f486(p); }


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

x86 assembly (clang, -O2):
<f487>:
jmp    1030 <f486@plt>

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

LLVM IR (-O2):
define i32 @f487(i32* %0) {
%2 = tail call i32 @f486(i32* %0)
ret i32 %2
}
unsigned int ft_nbrlen(int nbr) {
  unsigned int len;
  len = (nbr < 0) ? 2 : 1;
  while (nbr < -9 || nbr > 9) {
    nbr /= 10;
    len++;
  }
  return (len);
}


x86 assembly (clang, -O0):
<ft_nbrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%eax
mov    $0x2,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0xfffffff7,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jl     1136 <ft_nbrlen+0x36>
cmpl   $0x9,-0x4(%rbp)
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1146 <ft_nbrlen+0x46>
jmp    1162 <ft_nbrlen+0x62>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111d <ft_nbrlen+0x1d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_nbrlen>:
mov    %edi,%eax
shr    $0x1f,%eax
add    $0x1,%eax
lea    -0xa(%rdi),%ecx
cmp    $0xffffffec,%ecx
ja     1135 <ft_nbrlen+0x35>
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
lea    (%rcx,%rdx,1),%edi
add    $0x1,%eax
add    %edx,%ecx
add    $0xfffffff6,%ecx
cmp    $0xffffffed,%ecx
jb     1110 <ft_nbrlen+0x10>
ret

LLVM IR (-O0):
define i32 @ft_nbrlen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 2, i32 1
store i32 %7, i32* %3
br label %8
8: ; preds = %16, %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, -9
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 9
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ]
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = load i32, i32* %2
%18 = sdiv i32 %17, 10
store i32 %18, i32* %2
%19 = load i32, i32* %3
%20 = add i32 %19, 1
store i32 %20, i32* %3
br label %8
21: ; preds = %14
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @ft_nbrlen(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = select i1 %2, i32 2, i32 1
%4 = add i32 %0, -10
%5 = icmp ult i32 %4, -19
br i1 %5, label %6, label %13
6: ; preds = %1, %6
%7 = phi i32 [ %10, %6 ], [ %3, %1 ]
%8 = phi i32 [ %9, %6 ], [ %0, %1 ]
%9 = sdiv i32 %8, 10
%10 = add i32 %7, 1
%11 = add nsw i32 %9, -10
%12 = icmp ult i32 %11, -19
br i1 %12, label %6, label %13
13: ; preds = %6, %1
%14 = phi i32 [ %3, %1 ], [ %10, %6 ]
ret i32 %14
}
int d_gt_rm1(double a1, double *a2) { return (((a1) > (*a2))); }


x86 assembly (clang, -O0):
<d_gt_rm1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_gt_rm1>:
xor    %eax,%eax
ucomisd (%rdi),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @d_gt_rm1(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
store double %0, double* %3
store double* %1, double** %4
%5 = load double, double* %3
%6 = load double*, double** %4
%7 = load double, double* %6
%8 = fcmp ogt double %5, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @d_gt_rm1(double %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = fcmp olt double %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ triexit(int);
int *trimalloc(int size) {
  int *memptr;
  memptr = (int *)malloc((unsigned int)size);
  if (memptr == (int *)NULL) {
    printf("Error:  Out of memory.\n");
    triexit(1);
  }
  return (memptr);
}


x86 assembly (clang, -O0):
<trimalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <trimalloc+0x38>
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <triexit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trimalloc>:
push   %rbx
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1154 <trimalloc+0x24>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <triexit@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Error: Out of memory.\0A\00"
define i32* @trimalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @triexit(i32 1)
br label %12
12: ; preds = %9, %1
%13 = load i32*, i32** %3
ret i32* %13
}

LLVM IR (-O2):
@str = [23 x i8] c"Error: Out of memory.\00"
define i32* @trimalloc(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @triexit(i32 1)
br label %7
7: ; preds = %4, %1
%8 = inttoptr i64 %2 to i32*
ret i32* %8
}
/* Variables and functions */
int get_clcsbb1(int, int, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int);
void print_clcsbb1(int a, int b, int mask) {
  int f, r;
  f = get_clcsbb1(a, b, &r);
  f &= mask;
  printf("clcsbb"
         " 1"
         " %08x %08x %08x %08x %08x\n",
         a, b, r, f, mask);
}


x86 assembly (clang, -O0):
<print_clcsbb1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1040 <get_clcsbb1@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0xc(%rbp),%r9d
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_clcsbb1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xc(%rsp),%rdx
call   1040 <get_clcsbb1@plt>
and    %r14d,%eax
mov    0xc(%rsp),%ecx
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%r8d
mov    %r14d,%r9d
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"clcsbb 1 %08x %08x %08x %08x %08x\0A\00"
define void @print_clcsbb1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = call i32 @get_clcsbb1(i32 %9, i32 %10, i32* %8)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = and i32 %13, %12
store i32 %14, i32* %7
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"clcsbb 1 %08x %08x %08x %08x %08x\0A\00"
define void @print_clcsbb1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i32 @get_clcsbb1(i32 %0, i32 %1, i32* %4)
%7 = and i32 %6, %2
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %8, i32 %7, i32 %2)
ret void
}