xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void usage(void) {
  static char *usage_str =
      "Usage: fw_encode [OPTION] [<NAME FILE>]...\n"
      "  -h, --help             display this help and exit\n"
      "  -n, --note=NOTE        note of this firmware, can be any text\n"
      "  -o, --output=FILENAME  output file\n"
      "  -V, --version=VERSION  firmware version\n"
      "                         in maj.min.rev format\n"
      "For example:\n"
      "  fw_encode -n \"some note\" -V 1.0.0 -o firmware.bin \\\n"
      "            kernel ./uImage-initramfs rootfs \\\n"
      "            rootfs ./rootfs_64k.squashfs\n"
      "";
  puts(usage_str);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f0d(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@usage.usage_str = internal global i8* getelementptr inbounds ([441 x i8], [441 x i8]* @.str, i32 0, i32 0)
@.str = [441 x i8] c"Usage: fw_encode [OPTION] [<NAME FILE>]...\0A -h, --help display this help and exit\0A -n, --note=NOTE note of this firmware, can be any text\0A -o, --output=FILENAME output file\0A -V, --version=VERSION firmware version\0A in maj.min.rev format\0AFor example:\0A fw_encode -n \22some note\22 -V 1.0.0 -o firmware.bin \\\0A kernel ./uImage-initramfs rootfs \\\0A rootfs ./rootfs_64k.squashfs\0A\00"
define void @usage() {
%1 = load i8*, i8** @usage.usage_str
%2 = call i32 @puts(i8* %1)
ret void
}

LLVM IR (-O2):
@.str = [441 x i8] c"Usage: fw_encode [OPTION] [<NAME FILE>]...\0A -h, --help display this help and exit\0A -n, --note=NOTE note of this firmware, can be any text\0A -o, --output=FILENAME output file\0A -V, --version=VERSION firmware version\0A in maj.min.rev format\0AFor example:\0A fw_encode -n \22some note\22 -V 1.0.0 -o firmware.bin \\\0A kernel ./uImage-initramfs rootfs \\\0A rootfs ./rootfs_64k.squashfs\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([441 x i8], [441 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LCDWrite(int, int);
int /*<<< orphan*/ gotoXY(int /*<<< orphan*/, int /*<<< orphan*/);
void LCDClear(void) {
  for (int index = 0; index < (84 * 48 / 8); index++)
    LCDWrite(1, 0x00);
  gotoXY(0, 0);
}


x86 assembly (clang, -O0):
<LCDClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x1f8,-0x4(%rbp)
jge    1156 <LCDClear+0x36>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <LCDWrite@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <LCDClear+0xf>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <gotoXY@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDClear>:
push   %rbx
mov    $0x1f8,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <LCDWrite@plt>
add    $0xffffffff,%ebx
jne    1130 <LCDClear+0x10>
xor    %edi,%edi
xor    %esi,%esi
pop    %rbx
jmp    1040 <gotoXY@plt>

LLVM IR (-O0):
define void @LCDClear() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %7, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 504
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = call i32 @LCDWrite(i32 1, i32 0)
br label %7
7: ; preds = %5
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
br label %2
10: ; preds = %2
%11 = call i32 @gotoXY(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @LCDClear() {
br label %3
1: ; preds = %3
%2 = tail call i32 @gotoXY(i32 0, i32 0)
ret void
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %6, %3 ]
%5 = tail call i32 @LCDWrite(i32 1, i32 0)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 504
br i1 %7, label %1, label %3
}
void gf8mul_01100011(void) {
  __asm__ __volatile__("\tpxor    %xmm7, %xmm2\n"
                       "\tpxor    %xmm7, %xmm1\n"
                       "\tpxor    %xmm6, %xmm1\n"
                       "\tpxor    %xmm6, %xmm0\n"
                       "\tpxor    %xmm5, %xmm7\n"
                       "\tpxor    %xmm5, %xmm3\n"
                       "\tpxor    %xmm5, %xmm0\n"
                       "\tpxor    %xmm4, %xmm7\n"
                       "\tpxor    %xmm4, %xmm6\n"
                       "\tpxor    %xmm4, %xmm3\n"
                       "\tpxor    %xmm4, %xmm2\n"
                       "\tpxor    %xmm3, %xmm6\n"
                       "\tpxor    %xmm3, %xmm5\n"
                       "\tpxor    %xmm3, %xmm2\n"
                       "\tpxor    %xmm3, %xmm1\n"
                       "\tpxor    %xmm2, %xmm5\n"
                       "\tpxor    %xmm2, %xmm4\n"
                       "\tpxor    %xmm2, %xmm1\n"
                       "\tpxor    %xmm2, %xmm0\n"
                       "\tpxor    %xmm1, %xmm7\n"
                       "\tpxor    %xmm1, %xmm6\n"
                       "\tpxor    %xmm1, %xmm2\n"
                       "\tpxor    %xmm0, %xmm6\n"
                       "\tpxor    %xmm0, %xmm5\n"
                       "\tpxor    %xmm0, %xmm1\n");
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
pxor   %xmm7,%xmm2
pxor   %xmm7,%xmm1
pxor   %xmm6,%xmm1
pxor   %xmm6,%xmm0
pxor   %xmm5,%xmm7
pxor   %xmm5,%xmm3
pxor   %xmm5,%xmm0
pxor   %xmm4,%xmm7
pxor   %xmm4,%xmm6
pxor   %xmm4,%xmm3
pxor   %xmm4,%xmm2
pxor   %xmm3,%xmm6
pxor   %xmm3,%xmm5
pxor   %xmm3,%xmm2
pxor   %xmm3,%xmm1
pxor   %xmm2,%xmm5
pxor   %xmm2,%xmm4
pxor   %xmm2,%xmm1
pxor   %xmm2,%xmm0
pxor   %xmm1,%xmm7
pxor   %xmm1,%xmm6
pxor   %xmm1,%xmm2
pxor   %xmm0,%xmm6
pxor   %xmm0,%xmm5
pxor   %xmm0,%xmm1
pop    %rbp
ret

x86 assembly (clang, -O2):
pxor   %xmm7,%xmm2
pxor   %xmm7,%xmm1
pxor   %xmm6,%xmm1
pxor   %xmm6,%xmm0
pxor   %xmm5,%xmm7
pxor   %xmm5,%xmm3
pxor   %xmm5,%xmm0
pxor   %xmm4,%xmm7
pxor   %xmm4,%xmm6
pxor   %xmm4,%xmm3
pxor   %xmm4,%xmm2
pxor   %xmm3,%xmm6
pxor   %xmm3,%xmm5
pxor   %xmm3,%xmm2
pxor   %xmm3,%xmm1
pxor   %xmm2,%xmm5
pxor   %xmm2,%xmm4
pxor   %xmm2,%xmm1
pxor   %xmm2,%xmm0
pxor   %xmm1,%xmm7
pxor   %xmm1,%xmm6
pxor   %xmm1,%xmm2
pxor   %xmm0,%xmm6
pxor   %xmm0,%xmm5
pxor   %xmm0,%xmm1
ret

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

LLVM IR (-O2):
define void @gf8mul_01100011() {
tail call void asm sideeffect "\09pxor %xmm7, %xmm2\0A\09pxor %xmm7, %xmm1\0A\09pxor %xmm6, %xmm1\0A\09pxor %xmm6, %xmm0\0A\09pxor %xmm5, %xmm7\0A\09pxor %xmm5, %xmm3\0A\09pxor %xmm5, %xmm0\0A\09pxor %xmm4, %xmm7\0A\09pxor %xmm4, %xmm6\0A\09pxor %xmm4, %xmm3\0A\09pxor %xmm4, %xmm2\0A\09pxor %xmm3, %xmm6\0A\09pxor %xmm3, %xmm5\0A\09pxor %xmm3, %xmm2\0A\09pxor %xmm3, %xmm1\0A\09pxor %xmm2, %xmm5\0A\09pxor %xmm2, %xmm4\0A\09pxor %xmm2, %xmm1\0A\09pxor %xmm2, %xmm0\0A\09pxor %xmm1, %xmm7\0A\09pxor %xmm1, %xmm6\0A\09pxor %xmm1, %xmm2\0A\09pxor %xmm0, %xmm6\0A\09pxor %xmm0, %xmm5\0A\09pxor %xmm0, %xmm1\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void ExttDeletedZoneAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttDeletedZoneAuxTable() {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int RAND_MAX;
int /*<<< orphan*/ printf(char *, int, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  ;
  printf("Random number between 0 and %d: %d\n", RAND_MAX, rand());
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1060 <rand@plt>
lea    0xe9a(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Random number between 0 and %d: %d\0A\00"
@RAND_MAX = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = load i32, i32* @RAND_MAX
%5 = call i32 (...) @rand()
%6 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@.str = [36 x i8] c"Random number between 0 and %d: %d\0A\00"
@RAND_MAX = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = load i32, i32* @RAND_MAX
%4 = tail call i32 (...) @rand()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}
int test_imm_EBint32_reg(int val) { return ((val) & (0xEB << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_EBint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xeb,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_EBint32_reg(i32 %0) {
%2 = and i32 %0, 235
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void CameraXClkSet(unsigned long ulBase, unsigned char bXClkFlags) {
  unsigned long ulReg;
  ulReg =
      ((*((volatile unsigned long *)(ulBase + 0x00000048))) & ~(0x0000001F));
  switch (bXClkFlags) {
  case 0x01:
    ulReg |= 0x00000001;
    break;
  case 0x02:
    ulReg |= 0x0000000F;
    break;
  }
  (*((volatile unsigned long *)(ulBase + 0x00000048))) = ulReg;
}


x86 assembly (clang, -O0):
<CameraXClkSet>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x48(%rax),%rax
and    $0xffffffffffffffe0,%rax
mov    %rax,-0x18(%rbp)
movzbl -0x9(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     1144 <CameraXClkSet+0x44>
jmp    1133 <CameraXClkSet+0x33>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     1155 <CameraXClkSet+0x55>
jmp    1161 <CameraXClkSet+0x61>
mov    -0x18(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1161 <CameraXClkSet+0x61>
mov    -0x18(%rbp),%rax
or     $0xf,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x48(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CameraXClkSet>:
mov    0x48(%rdi),%rax
and    $0xffffffffffffffe0,%rax
cmp    $0x2,%sil
je     111d <CameraXClkSet+0x1d>
cmp    $0x1,%sil
jne    1121 <CameraXClkSet+0x21>
or     $0x1,%rax
mov    %rax,0x48(%rdi)
ret
or     $0xf,%rax
mov    %rax,0x48(%rdi)
ret

LLVM IR (-O0):
define void @CameraXClkSet(i64 %0, i8 zeroext %1) {
%3 = alloca i64
%4 = alloca i8
%5 = alloca i64
store i64 %0, i64* %3
store i8 %1, i8* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 72
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, -32
store i64 %10, i64* %5
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
switch i32 %12, label %19 [
i32 1, label %13
i32 2, label %16
]
13: ; preds = %2
%14 = load i64, i64* %5
%15 = or i64 %14, 1
store i64 %15, i64* %5
br label %19
16: ; preds = %2
%17 = load i64, i64* %5
%18 = or i64 %17, 15
store i64 %18, i64* %5
br label %19
19: ; preds = %2, %16, %13
%20 = load i64, i64* %5
%21 = load i64, i64* %3
%22 = add i64 %21, 72
%23 = inttoptr i64 %22 to i64*
store volatile i64 %20, i64* %23
ret void
}

LLVM IR (-O2):
define void @CameraXClkSet(i64 %0, i8 zeroext %1) {
%3 = add i64 %0, 72
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, -32
switch i8 %1, label %11 [
i8 1, label %7
i8 2, label %9
]
7: ; preds = %2
%8 = or i64 %6, 1
br label %11
9: ; preds = %2
%10 = or i64 %6, 15
br label %11
11: ; preds = %2, %9, %7
%12 = phi i64 [ %6, %2 ], [ %10, %9 ], [ %8, %7 ]
store volatile i64 %12, i64* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srand(int);
void __InitRandom(int seed) {
  if (seed == -1)
    srand(4321);
  else
    srand(seed);
}


x86 assembly (clang, -O0):
<__InitRandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1134 <__InitRandom+0x24>
mov    $0x10e1,%edi
call   1030 <srand@plt>
jmp    113c <__InitRandom+0x2c>
mov    -0x4(%rbp),%edi
call   1030 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__InitRandom>:
cmp    $0xffffffff,%edi
mov    $0x10e1,%eax
cmove  %eax,%edi
jmp    1030 <srand@plt>

LLVM IR (-O0):
define void @__InitRandom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @srand(i32 4321)
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @srand(i32 %8)
br label %10
10: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @__InitRandom(i32 %0) {
%2 = icmp eq i32 %0, -1
%3 = select i1 %2, i32 4321, i32 %0
%4 = tail call i32 @srand(i32 %3)
ret void
}
double coefficient_of_restitution(const struct reb_simulation *r, double v) {
  return 0.5;
}


x86 assembly (clang, -O0):
<coefficient_of_restitution>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xeeb(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<coefficient_of_restitution>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
%struct.reb_simulation = type opaque
define double @coefficient_of_restitution(%struct.reb_simulation* %0, double %1) {
%3 = alloca %struct.reb_simulation*
%4 = alloca double
store %struct.reb_simulation* %0, %struct.reb_simulation** %3
store double %1, double* %4
ret double 5.000000e-01
}

LLVM IR (-O2):
%struct.reb_simulation = type opaque
define double @coefficient_of_restitution(%struct.reb_simulation* nocapture readnone %0, double %1) {
ret double 5.000000e-01
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void switch_lamp(int nlamp) { printf("switch_lamp(%d)\n", nlamp); }


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

x86 assembly (clang, -O2):
<switch_lamp>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c"switch_lamp(%d)\0A\00"
define void @switch_lamp(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
struct clk {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clk_disable(struct clk *);
int /*<<< orphan*/ clk_unprepare(struct clk *);
void clk_disable_unprepare(struct clk *clk) {
  clk_disable(clk);
  clk_unprepare(clk);
}


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

x86 assembly (clang, -O2):
<clk_disable_unprepare>:
push   %rbx
mov    %rdi,%rbx
call   1040 <clk_disable@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <clk_unprepare@plt>

LLVM IR (-O0):
%struct.clk = type { i32 }
define void @clk_disable_unprepare(%struct.clk* %0) {
%2 = alloca %struct.clk*
store %struct.clk* %0, %struct.clk** %2
%3 = load %struct.clk*, %struct.clk** %2
%4 = call i32 @clk_disable(%struct.clk* %3)
%5 = load %struct.clk*, %struct.clk** %2
%6 = call i32 @clk_unprepare(%struct.clk* %5)
ret void
}

LLVM IR (-O2):
%struct.clk = type { i32 }
define void @clk_disable_unprepare(%struct.clk* %0) {
%2 = tail call i32 @clk_disable(%struct.clk* %0)
%3 = tail call i32 @clk_unprepare(%struct.clk* %0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int, size_t);
void *smalloc(size_t nelem, size_t length) {
  void *result = malloc(nelem * length);
  if (result)
    memset(result, 0xAA, nelem * length);
  return result;
}


x86 assembly (clang, -O0):
<smalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1164 <smalloc+0x44>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
imul   -0x10(%rbp),%rdx
mov    $0xaa,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     114b <smalloc+0x2b>
mov    %r14,%rdi
mov    $0xaa,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @smalloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 170, i64 %3)
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHelp() {
  printf("Usage: cmusid [OPTION]... [DIRECTORY]\nIdentify and organize audio "
         "files within DIRECTORY\n\n  -i, --interactive\t prompt user for "
         "track names, artists, and albums instead of querying AcoustID "
         "database\n  -f, --fingerprint\t use Chromaprint library to generate "
         "unique fingerprints for each file\n  -r, --recursive\t identify "
         "files in subfolders of input directory\n  -v, --verbose\t\t use "
         "verbose logging (you'll want to pipe to `less`)\n");
}


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

x86 assembly (clang, -O2):
<printHelp>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [427 x i8] c"Usage: cmusid [OPTION]... [DIRECTORY]\0AIdentify and organize audio files within DIRECTORY\0A\0A -i, --interactive\09 prompt user for track names, artists, and albums instead of querying AcoustID database\0A -f, --fingerprint\09 use Chromaprint library to generate unique fingerprints for each file\0A -r, --recursive\09 identify files in subfolders of input directory\0A -v, --verbose\09\09 use verbose logging (you'll want to pipe to `less`)\0A\00"
define void @printHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([427 x i8], [427 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [426 x i8] c"Usage: cmusid [OPTION]... [DIRECTORY]\0AIdentify and organize audio files within DIRECTORY\0A\0A -i, --interactive\09 prompt user for track names, artists, and albums instead of querying AcoustID database\0A -f, --fingerprint\09 use Chromaprint library to generate unique fingerprints for each file\0A -r, --recursive\09 identify files in subfolders of input directory\0A -v, --verbose\09\09 use verbose logging (you'll want to pipe to `less`)\00"
define void @printHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([426 x i8], [426 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int header_length(int /*<<< orphan*/, int);
int object_length(int data_len) {
  return header_length(0, data_len) + data_len;
}


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

x86 assembly (clang, -O2):
<object_length>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <header_length@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @object_length(i32 %0) {
%2 = tail call i32 @header_length(i32 0, i32 %0)
%3 = add nsw i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int bar(int x, char **y) {
  if (x != 56)
    abort();
  if (**y != 'a')
    abort();
  *y = "def";
  return 1;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x38,-0x4(%rbp)
je     1130 <bar+0x20>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
je     114a <bar+0x3a>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
lea    0xeab(%rip),%rcx
mov    %rcx,(%rax)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
cmp    $0x38,%edi
jne    112f <bar+0x1f>
mov    (%rsi),%rax
cmpb   $0x61,(%rax)
jne    112f <bar+0x1f>
lea    0xedb(%rip),%rax
mov    %rax,(%rsi)
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"def\00"
define i32 @bar(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 56
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %2
%10 = load i8**, i8*** %4
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 97
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %9
%18 = load i8**, i8*** %4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %18
ret i32 1
}

LLVM IR (-O2):
@.str = [4 x i8] c"def\00"
define i32 @bar(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 56
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 97
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %6
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
ret i32 1
}
/* Variables and functions */
int binary_search(double, double *, int);
double frand();
int cmfrand(double *w, int n) {
  double r = frand();
  return binary_search(r, w, n);
}


x86 assembly (clang, -O0):
<cmfrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <frand@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <binary_search@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmfrand>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <frand@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <binary_search@plt>

LLVM IR (-O0):
define i32 @cmfrand(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
%6 = call double (...) @frand()
store double %6, double* %5
%7 = load double, double* %5
%8 = load double*, double** %3
%9 = load i32, i32* %4
%10 = call i32 @binary_search(double %7, double* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @cmfrand(double* %0, i32 %1) {
%3 = tail call double (...) @frand()
%4 = tail call i32 @binary_search(double %3, double* %0, i32 %1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ display_exit();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void exit_game(uint8_t code) {
  display_exit();
  exit(code);
}


x86 assembly (clang, -O0):
<exit_game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <display_exit@plt>
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<exit_game>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <display_exit@plt>
mov    %ebx,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
define void @exit_game(i32 %0) {
%2 = tail call i32 (...) @display_exit()
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ length;

/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ write(int, ...);
int write_text(int socket_fd, char *text) {
  int length = strlen(text) + 1;
  write(socket_fd, &length, sizeof(length));
  write(socket_fd, text, length);
}


x86 assembly (clang, -O0):
<write_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_text>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <write@plt>
mov    0x4(%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <write@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @write_text(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @strlen(i8* %1)
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = call i32 (i32, ...) @write(i32 %0, i32* %3, i64 4)
%8 = load i32, i32* %3
%9 = call i32 (i32, ...) @write(i32 %0, i8* %1, i32 %8)
ret i32 undef
}
main() { extern int local __attribute((weak)); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr1setBank4(int);
void m32setParamsBXX4(uint16_t addr, uint8_t val) {
  (void)addr;
  chr1setBank4(val << 10);
}


x86 assembly (clang, -O0):
<m32setParamsBXX4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
shl    $0xa,%edi
call   1030 <chr1setBank4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m32setParamsBXX4>:
mov    %esi,%edi
shl    $0xa,%edi
jmp    1030 <chr1setBank4@plt>

LLVM IR (-O0):
define void @m32setParamsBXX4(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 = shl i32 %6, 10
%8 = call i32 @chr1setBank4(i32 %7)
ret void
}

LLVM IR (-O2):
define void @m32setParamsBXX4(i32 %0, i32 %1) {
%3 = shl i32 %1, 10
%4 = tail call i32 @chr1setBank4(i32 %3)
ret void
}
char *READREF() { ; }


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

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

LLVM IR (-O0):
define i8* @READREF() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define noalias i8* @READREF() {
ret i8* undef
}
void prnArr(const int size, char *const *const arr) {
  for (int i = 0; i < size; i++) {
    printf("%s ", arr[i]);
  }
}


x86 assembly (clang, -O0):
<prnArr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <prnArr+0x4a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <prnArr+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prnArr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <prnArr+0x37>
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xed7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <prnArr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
define void @prnArr(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8**, i8*** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define void @prnArr(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_comment(const char *message) { printf("\n   --  %s\n\n", message); }


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

x86 assembly (clang, -O2):
<print_comment>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"\0A -- %s\0A\0A\00"
define void @print_comment(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR4D_get(void) { return U_WMRCORENONE_get("U_WMRSTARTDOC"); }


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

x86 assembly (clang, -O2):
<U_WMR4D_get>:
lea    0xee9(%rip),%rdi
jmp    1030 <U_WMRCORENONE_get@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"U_WMRSTARTDOC\00"
define i32 @U_WMR4D_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
char *stralloc(int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strsave(char *str) {
  char *sptr;
  int len = strlen(str);
  sptr = stralloc(len);
  strncpy(sptr, str, len);
  sptr[len] = 0;
  return (sptr);
}


x86 assembly (clang, -O0):
<strsave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <stralloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsave>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <stralloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @strsave(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i8* @stralloc(i32 %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = load i32, i32* %4
%12 = call i32 @strncpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @strsave(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i8* @stralloc(i32 %2)
%4 = tail call i32 @strncpy(i8* %3, i8* %0, i32 %2)
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
store i8 0, i8* %6
ret i8* %3
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
typedef int /*<<< orphan*/ netio_tv;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVTIMEO;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int os_setsock_timeout(int sock, int timeout_in_seconds) {
  struct timeval netio_tv;
  netio_tv.tv_sec = timeout_in_seconds;
  netio_tv.tv_usec = 0;
  return setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&netio_tv,
                    sizeof(netio_tv));
}


x86 assembly (clang, -O0):
<os_setsock_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb2(%rip),%rax
mov    (%rax),%esi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_setsock_timeout>:
sub    $0x18,%rsp
mov    %esi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
define i32 @os_setsock_timeout(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.timeval
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i64 0, i64* %8
%9 = load i32, i32* %3
%10 = load i32, i32* @SOL_SOCKET
%11 = load i32, i32* @SO_RCVTIMEO
%12 = bitcast %struct.timeval* %5 to i8*
%13 = call i32 @setsockopt(i32 %9, i32 %10, i32 %11, i8* %12, i32 16)
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@SOL_SOCKET = global i32 0
@SO_RCVTIMEO = global i32 0
define i32 @os_setsock_timeout(i32 %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 %1, i32* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 0, i64* %6
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_RCVTIMEO
%9 = call i32 @setsockopt(i32 %0, i32 %7, i32 %8, i8* %4, i32 16)
ret i32 %9
}
/* Type definitions */
struct tagStanza {
  int dummy;
};
struct hash {
  int dummy;
};

/* Variables and functions */
struct tagStanza *hashFindVal(struct hash *, char *);
struct tagStanza *tagStanzaFindInHash(struct hash *hash, char *key) {
  return hashFindVal(hash, key);
}


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

x86 assembly (clang, -O2):
<tagStanzaFindInHash>:
jmp    1030 <hashFindVal@plt>

LLVM IR (-O0):
%struct.tagStanza = type { i32 }
%struct.hash = type { i32 }
define %struct.tagStanza* @tagStanzaFindInHash(%struct.hash* %0, i8* %1) {
%3 = alloca %struct.hash*
%4 = alloca i8*
store %struct.hash* %0, %struct.hash** %3
store i8* %1, i8** %4
%5 = load %struct.hash*, %struct.hash** %3
%6 = load i8*, i8** %4
%7 = call %struct.tagStanza* @hashFindVal(%struct.hash* %5, i8* %6)
ret %struct.tagStanza* %7
}

LLVM IR (-O2):
%struct.tagStanza = type { i32 }
%struct.hash = type { i32 }
define %struct.tagStanza* @tagStanzaFindInHash(%struct.hash* %0, i8* %1) {
%3 = tail call %struct.tagStanza* @hashFindVal(%struct.hash* %0, i8* %1)
ret %struct.tagStanza* %3
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__4__GeneralIO__clr();
void CC2420ControlP__CSN__clr(void) { Msp430GpioC__4__GeneralIO__clr(); }


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

x86 assembly (clang, -O2):
<CC2420ControlP__CSN__clr>:
xor    %eax,%eax
jmp    1030 <Msp430GpioC__4__GeneralIO__clr@plt>

LLVM IR (-O0):
define void @CC2420ControlP__CSN__clr() {
%1 = call i32 (...) @Msp430GpioC__4__GeneralIO__clr()
ret void
}

LLVM IR (-O2):
define void @CC2420ControlP__CSN__clr() {
%1 = tail call i32 (...) @Msp430GpioC__4__GeneralIO__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void bzero(void *ptr, size_t n) { memset(ptr, 0, n); }


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

x86 assembly (clang, -O2):
<bzero>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @bzero(i8* %0, i64 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doublebuffer();
void doublebuffer_() { doublebuffer(); }


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

x86 assembly (clang, -O2):
<doublebuffer_>:
xor    %eax,%eax
jmp    1030 <doublebuffer@plt>

LLVM IR (-O0):
define void @doublebuffer_() {
%1 = call i32 (...) @doublebuffer()
ret void
}

LLVM IR (-O2):
define void @doublebuffer_() {
%1 = tail call i32 (...) @doublebuffer()
ret void
}
/* Type definitions */
typedef int u_int8_t;

/* Variables and functions */
int ipsec_validate_proto(u_int8_t proto) {
  return proto < 2 || proto > 4 ? -1 : 0;
}


x86 assembly (clang, -O0):
<ipsec_validate_proto>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x2,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <ipsec_validate_proto+0x20>
cmpl   $0x4,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0xffffffff,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipsec_validate_proto>:
add    $0xfffffffb,%edi
cmp    $0xfffffffd,%edi
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ipsec_validate_proto(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 2
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 4
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 -1, i32 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @ipsec_validate_proto(i32 %0) {
%2 = add i32 %0, -5
%3 = icmp ult i32 %2, -3
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int gen_conncpy(void *, void *);
int conncpy(void *o1, void *o2) { return gen_conncpy(o1, o2); }


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

x86 assembly (clang, -O2):
<conncpy>:
jmp    1030 <gen_conncpy@plt>

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

LLVM IR (-O2):
define i32 @conncpy(i8* %0, i8* %1) {
%3 = tail call i32 @gen_conncpy(i8* %0, i8* %1)
ret i32 %3
}
void encrypt(char *message) {
  char c;
  while (*message) {
    *message = *message ^ 31;
    ++message;
  }
}


x86 assembly (clang, -O0):
<encrypt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1138 <encrypt+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
xor    $0x1f,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <encrypt+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<encrypt>:
mov    (%rdi),%al
test   %al,%al
je     1120 <encrypt+0x20>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
xor    $0x1f,%al
mov    %al,-0x1(%rdi)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <encrypt+0x10>
ret

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

LLVM IR (-O2):
define void @encrypt(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = xor i8 %5, 31
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int fixup_regexp_dynamic_null(void **, int);
int fixup_codec_regexp(void **param, int param_no) {
  return fixup_regexp_dynamic_null(param, param_no);
}


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

x86 assembly (clang, -O2):
<fixup_codec_regexp>:
jmp    1030 <fixup_regexp_dynamic_null@plt>

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

LLVM IR (-O2):
define i32 @fixup_codec_regexp(i8** %0, i32 %1) {
%3 = tail call i32 @fixup_regexp_dynamic_null(i8** %0, i32 %1)
ret i32 %3
}
char *strrchr(const char *cp, int ch) {
  char *save;
  char c;
  for (save = (char *)0; (c = *cp); cp++) {
    if (c == ch)
      save = (char *)cp;
  }
  return save;
}


x86 assembly (clang, -O0):
<strrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
cmp    $0x0,%al
je     114f <strrchr+0x4f>
movsbl -0x19(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1139 <strrchr+0x39>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    113e <strrchr+0x3e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <strrchr+0x13>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrchr>:
mov    (%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1125 <strrchr+0x25>
nopl   0x0(%rax,%rax,1)
movsbl %cl,%ecx
cmp    %esi,%ecx
cmove  %rdi,%rax
movzbl 0x1(%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strrchr+0x10>
ret

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

LLVM IR (-O2):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i8* [ %11, %5 ], [ null, %2 ]
%9 = sext i8 %6 to i32
%10 = icmp eq i32 %9, %1
%11 = select i1 %10, i8* %7, i8* %8
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i8* [ null, %2 ], [ %11, %5 ]
ret i8* %16
}