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

/* Variables and functions */
int /*<<< orphan*/ integer_downshift(struct Integer *, int);
int /*<<< orphan*/ integer_trim_leading_zeroes(struct Integer *);
void integer_halve_in_place(struct Integer *a) {
  integer_downshift(a, 1);
  integer_trim_leading_zeroes(a);
}


x86 assembly (clang, -O0):
<integer_halve_in_place>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <integer_downshift@plt>
mov    -0x8(%rbp),%rdi
call   1040 <integer_trim_leading_zeroes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integer_halve_in_place>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%esi
call   1030 <integer_downshift@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <integer_trim_leading_zeroes@plt>

LLVM IR (-O0):
%struct.Integer = type { i32 }
define void @integer_halve_in_place(%struct.Integer* %0) {
%2 = alloca %struct.Integer*
store %struct.Integer* %0, %struct.Integer** %2
%3 = load %struct.Integer*, %struct.Integer** %2
%4 = call i32 @integer_downshift(%struct.Integer* %3, i32 1)
%5 = load %struct.Integer*, %struct.Integer** %2
%6 = call i32 @integer_trim_leading_zeroes(%struct.Integer* %5)
ret void
}

LLVM IR (-O2):
%struct.Integer = type { i32 }
define void @integer_halve_in_place(%struct.Integer* %0) {
%2 = tail call i32 @integer_downshift(%struct.Integer* %0, i32 1)
%3 = tail call i32 @integer_trim_leading_zeroes(%struct.Integer* %0)
ret void
}
int test_imm_ADint8_mem(signed char *val) {
  return ((*val) & (-0xAD << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_ADint8_mem>:
movsbl (%rdi),%eax
test   $0xffffff53,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_ADint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -173
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int HECMW_partlex();
int HECMW_partlex_next_token(void) { return HECMW_partlex(); }


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

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

LLVM IR (-O0):
define i32 @HECMW_partlex_next_token() {
%1 = call i32 (...) @HECMW_partlex()
ret i32 %1
}

LLVM IR (-O2):
define i32 @HECMW_partlex_next_token() {
%1 = tail call i32 (...) @HECMW_partlex()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
int x41_teardown() {
  char cmd[256];
  sprintf(cmd,
          "iptables -D INPUT -p tcp -m multiport --sport 53,80 --tcp-flags "
          "SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d",
          1);
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<x41_teardown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x1,%edx
call   1040 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x41_teardown>:
push   %rbx
sub    $0x100,%rsp
lea    0xed1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [106 x i8] c"iptables -D INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x41_teardown() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @system(i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [106 x i8] c"iptables -D INPUT -p tcp -m multiport --sport 53,80 --tcp-flags SYN,ACK SYN,ACK -j NFQUEUE --queue-num %d\00"
define i32 @x41_teardown() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i32 @system(i8* %2)
ret i32 0
}
OP(fd, f5) { op_f5(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_f5()
ret i32 undef
}
void coresight_cti_disable_gate(struct coresight_cti *cti, int ch) {}


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

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

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

LLVM IR (-O2):
%struct.coresight_cti = type opaque
define void @coresight_cti_disable_gate(%struct.coresight_cti* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ command_loadrom();
int /*<<< orphan*/ kprintf(char *);
int /*<<< orphan*/ run(int);
void auto_run(void) {
  kprintf("*** AUTO-RUN ***\n");
  command_loadrom();
  run((0x00000000));
}


x86 assembly (clang, -O0):
<auto_run>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <kprintf@plt>
mov    $0x0,%al
call   1030 <command_loadrom@plt>
xor    %edi,%edi
call   1040 <run@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<auto_run>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <kprintf@plt>
xor    %eax,%eax
call   1030 <command_loadrom@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <run@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"*** AUTO-RUN ***\0A\00"
define void @auto_run() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @command_loadrom()
%3 = call i32 @run(i32 0)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"*** AUTO-RUN ***\0A\00"
define void @auto_run() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @command_loadrom()
%3 = tail call i32 @run(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int /*<<< orphan*/ __VERIFIER_assume(int);
int __VERIFIER_nondet_int();
void main() {
  int n = __VERIFIER_nondet_int();
  __VERIFIER_assume(n >= 0);
  int x = n, y = 0;
  while (x > 0) {
    x--;
    y++;
  }
  __VERIFIER_assert(y != n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__VERIFIER_assume@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1181 <main+0x51>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <main+0x30>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
mov    %eax,%edi
not    %edi
shr    $0x1f,%edi
call   1050 <__VERIFIER_assume@plt>
shr    $0x1f,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <__VERIFIER_assert@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp sge i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @__VERIFIER_assume(i32 %7)
%9 = load i32, i32* %1
store i32 %9, i32* %2
store i32 0, i32* %3
br label %10
10: ; preds = %13, %0
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %2
%15 = add nsw i32 %14, -1
store i32 %15, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %10
18: ; preds = %10
%19 = load i32, i32* %3
%20 = load i32, i32* %1
%21 = icmp ne i32 %19, %20
%22 = zext i1 %21 to i32
%23 = call i32 @__VERIFIER_assert(i32 %22)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = xor i32 %1, -1
%3 = lshr i32 %2, 31
%4 = tail call i32 @__VERIFIER_assume(i32 %3)
%5 = lshr i32 %1, 31
%6 = tail call i32 @__VERIFIER_assert(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sink(int /*<<< orphan*/, char);
__attribute__((noipa)) void fca2(char a[2]) {
  sink(0, a[0]);
  sink(0, a[1]);
  sink(0, a[2]);
}


x86 assembly (clang, -O0):
<fca2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xor    %edi,%edi
movsbl (%rax),%esi
call   1030 <sink@plt>
mov    -0x8(%rbp),%rax
xor    %edi,%edi
movsbl 0x1(%rax),%esi
call   1030 <sink@plt>
mov    -0x8(%rbp),%rax
xor    %edi,%edi
movsbl 0x2(%rax),%esi
call   1030 <sink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fca2>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%esi
xor    %edi,%edi
call   1030 <sink@plt>
movsbl 0x1(%rbx),%esi
xor    %edi,%edi
call   1030 <sink@plt>
movsbl 0x2(%rbx),%esi
xor    %edi,%edi
pop    %rbx
jmp    1030 <sink@plt>

LLVM IR (-O0):
define void @fca2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = call i32 @sink(i32 0, i8 signext %5)
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = call i32 @sink(i32 0, i8 signext %9)
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8, i8* %12
%14 = call i32 @sink(i32 0, i8 signext %13)
ret void
}

LLVM IR (-O2):
define void @fca2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @sink(i32 0, i8 signext %2)
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = tail call i32 @sink(i32 0, i8 signext %5)
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = load i8, i8* %7
%9 = tail call i32 @sink(i32 0, i8 signext %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
void *hello_world(void *arg) {
  long thread_id = (long)arg;
  int i;
  for (i = 0; i < 2; ++i) {
    printf("Hello World from thread %ld\n", thread_id);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<hello_world>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1153 <hello_world+0x43>
mov    -0x10(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <hello_world+0x1b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello_world>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Hello World from thread %ld\0A\00"
define i8* @hello_world(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %3
store i32 0, i32* %4
br label %7
7: ; preds = %13, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i64, i64* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %7
16: ; preds = %7
ret i8* null
}

LLVM IR (-O2):
@.str = [29 x i8] c"Hello World from thread %ld\0A\00"
define noalias i8* @hello_world(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ *opendir(char const *);
DIR *xopendir(const char *name) {
  DIR *d = opendir(name);
  if (d == NULL) {
    ;
  }
  return d;
}


x86 assembly (clang, -O0):
<xopendir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1139 <xopendir+0x29>
jmp    1139 <xopendir+0x29>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xopendir>:
jmp    1030 <opendir@plt>

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

LLVM IR (-O2):
define noalias i32* @xopendir(i8* nocapture %0) {
%2 = tail call i32* @opendir(i8* %0)
ret i32* %2
}
/* Variables and functions */
bool is_dot(const char *e) {
  return e[0] == '.' && (!e[1] || (e[1] == '.' && !e[2]));
}


x86 assembly (clang, -O0):
<is_dot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0x9(%rbp)
jne    1162 <is_dot+0x62>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,0x1(%rcx)
mov    %al,-0xa(%rbp)
je     115c <is_dot+0x5c>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0xb(%rbp)
jne    1156 <is_dot+0x56>
mov    -0x8(%rbp),%rax
cmpb   $0x0,0x2(%rax)
setne  %al
xor    $0xff,%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dot>:
xor    %eax,%eax
cmpb   $0x2e,(%rdi)
jne    111c <is_dot+0x1c>
mov    0x1(%rdi),%cl
test   %cl,%cl
je     111d <is_dot+0x1d>
cmp    $0x2e,%cl
jne    111c <is_dot+0x1c>
xor    %eax,%eax
cmpb   $0x0,0x2(%rdi)
sete   %al
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_dot(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 46
br i1 %7, label %8, label %29
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %27
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 46
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
%24 = xor i1 %23, true
br label %25
25: ; preds = %19, %13
%26 = phi i1 [ false, %13 ], [ %24, %19 ]
br label %27
27: ; preds = %25, %8
%28 = phi i1 [ true, %8 ], [ %26, %25 ]
br label %29
29: ; preds = %27, %1
%30 = phi i1 [ false, %1 ], [ %28, %27 ]
%31 = zext i1 %30 to i32
ret i32 %31
}

LLVM IR (-O2):
define i32 @is_dot(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 46
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
switch i8 %6, label %12 [
i8 0, label %13
i8 46, label %7
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = zext i1 %10 to i32
br label %13
12: ; preds = %4
br label %13
13: ; preds = %4, %12, %7, %1
%14 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %11, %7 ], [ 0, %12 ]
ret i32 %14
}
void ptrace_sandbox_free(struct pt_sandbox *p_sandbox) { (void)p_sandbox; }


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

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

LLVM IR (-O0):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_free(%struct.pt_sandbox* %0) {
%2 = alloca %struct.pt_sandbox*
store %struct.pt_sandbox* %0, %struct.pt_sandbox** %2
%3 = load %struct.pt_sandbox*, %struct.pt_sandbox** %2
ret void
}

LLVM IR (-O2):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_free(%struct.pt_sandbox* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int system(char *);
void do_child(char *command) {
  int res = system(command);
  _exit(0);
}


x86 assembly (clang, -O0):
<do_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<do_child>:
push   %rax
call   1040 <system@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @do_child(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @system(i8* %4)
store i32 %5, i32* %3
%6 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @do_child(i8* nocapture %0) {
%2 = tail call i32 @system(i8* %0)
%3 = tail call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
int get_fpu_endian();
int main(int argc, char **argv) {
  (void)(argc);
  (void)(argv);
  return get_fpu_endian();
}


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 <get_fpu_endian@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 (...) @get_fpu_endian()
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @get_fpu_endian()
ret i32 %3
}
unsigned int uint_gcd(unsigned int a, unsigned int b) {
  unsigned int r;
  while (b > 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}


x86 assembly (clang, -O0):
<uint_gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    1130 <uint_gcd+0x30>
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <uint_gcd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint_gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111e <uint_gcd+0x1e>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
xor    %edx,%edx
div    %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <uint_gcd+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @uint_gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %6
6: ; preds = %9, %2
%7 = load i32, i32* %4
%8 = icmp ugt i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = urem i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %4
store i32 %13, i32* %3
%14 = load i32, i32* %5
store i32 %14, i32* %4
br label %6
15: ; preds = %6
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @uint_gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = urem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
/* Variables and functions */
int inportb(int);
int /*<<< orphan*/ outportb(int, int);
void nosound(void) { outportb(0x61, inportb(0x61) & ~3); }


x86 assembly (clang, -O0):
<nosound>:
push   %rbp
mov    %rsp,%rbp
mov    $0x61,%edi
call   1030 <inportb@plt>
mov    %eax,%esi
and    $0xfffffffc,%esi
mov    $0x61,%edi
call   1040 <outportb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nosound>:
push   %rax
mov    $0x61,%edi
call   1030 <inportb@plt>
and    $0xfffffffc,%eax
mov    $0x61,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <outportb@plt>

LLVM IR (-O0):
define void @nosound() {
%1 = call i32 @inportb(i32 97)
%2 = and i32 %1, -4
%3 = call i32 @outportb(i32 97, i32 %2)
ret void
}

LLVM IR (-O2):
define void @nosound() {
%1 = tail call i32 @inportb(i32 97)
%2 = and i32 %1, -4
%3 = tail call i32 @outportb(i32 97, i32 %2)
ret void
}
/* Variables and functions */
double rand_beebs();
long TestingMostlyDescending(long index, long total) {
  return total - index + rand_beebs() * 1.0 / ((1U << 15) - 1) * 5 - 2.5;
}


x86 assembly (clang, -O0):
<TestingMostlyDescending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand_beebs@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xed2(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xebe(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  0xeaa(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe92(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestingMostlyDescending>:
push   %rax
sub    %rdi,%rsi
cvtsi2sd %rsi,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand_beebs@plt>
divsd  0xed3(%rip),%xmm0
mulsd  0xed3(%rip),%xmm0
addsd  (%rsp),%xmm0
addsd  0xece(%rip),%xmm0
cvttsd2si %xmm0,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @TestingMostlyDescending(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = sub nsw i64 %5, %6
%8 = sitofp i64 %7 to double
%9 = call double (...) @rand_beebs()
%10 = fmul double %9, 1.000000e+00
%11 = fdiv double %10, 3.276700e+04
%12 = call double @llvm.fmuladd.f64(double %11, double 5.000000e+00, double %8)
%13 = fsub double %12, 2.500000e+00
%14 = fptosi double %13 to i64
ret i64 %14
}

LLVM IR (-O2):
define i64 @TestingMostlyDescending(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = sitofp i64 %3 to double
%5 = tail call double (...) @rand_beebs()
%6 = fdiv double %5, 3.276700e+04
%7 = tail call double @llvm.fmuladd.f64(double %6, double 5.000000e+00, double %4)
%8 = fadd double %7, -2.500000e+00
%9 = fptosi double %8 to i64
ret i64 %9
}
/* Type definitions */
struct value {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_reference(struct value *);
int /*<<< orphan*/ collect(struct value *);
struct value *pop();
int /*<<< orphan*/ remove_reference(struct value *);
void pop_to_var(struct value **var) {
  remove_reference(*var);
  collect(*var);
  *var = pop();
  add_reference(*var);
}


x86 assembly (clang, -O0):
<pop_to_var>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <remove_reference@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1060 <collect@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <add_reference@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pop_to_var>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <remove_reference@plt>
mov    (%rbx),%rdi
call   1060 <collect@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
pop    %rbx
jmp    1030 <add_reference@plt>

LLVM IR (-O0):
%struct.value = type { i32 }
define void @pop_to_var(%struct.value** %0) {
%2 = alloca %struct.value**
store %struct.value** %0, %struct.value*** %2
%3 = load %struct.value**, %struct.value*** %2
%4 = load %struct.value*, %struct.value** %3
%5 = call i32 @remove_reference(%struct.value* %4)
%6 = load %struct.value**, %struct.value*** %2
%7 = load %struct.value*, %struct.value** %6
%8 = call i32 @collect(%struct.value* %7)
%9 = call %struct.value* (...) @pop()
%10 = load %struct.value**, %struct.value*** %2
store %struct.value* %9, %struct.value** %10
%11 = load %struct.value**, %struct.value*** %2
%12 = load %struct.value*, %struct.value** %11
%13 = call i32 @add_reference(%struct.value* %12)
ret void
}

LLVM IR (-O2):
%struct.value = type { i32 }
define void @pop_to_var(%struct.value** nocapture %0) {
%2 = load %struct.value*, %struct.value** %0
%3 = tail call i32 @remove_reference(%struct.value* %2)
%4 = load %struct.value*, %struct.value** %0
%5 = tail call i32 @collect(%struct.value* %4)
%6 = tail call %struct.value* (...) @pop()
store %struct.value* %6, %struct.value** %0
%7 = tail call i32 @add_reference(%struct.value* %6)
ret void
}
/* Variables and functions */
scalar_t__ LINES;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ move(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
void ScreenEnd() {
  move(LINES - 1, 0);
  refresh();
  endwin();
}


x86 assembly (clang, -O0):
<ScreenEnd>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
xor    %esi,%esi
call   1050 <move@plt>
mov    $0x0,%al
call   1030 <refresh@plt>
mov    $0x0,%al
call   1040 <endwin@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScreenEnd>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%rdi
add    $0xffffffffffffffff,%rdi
xor    %esi,%esi
call   1050 <move@plt>
xor    %eax,%eax
call   1030 <refresh@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <endwin@plt>

LLVM IR (-O0):
@LINES = global i64 0
define void @ScreenEnd() {
%1 = load i64, i64* @LINES
%2 = sub nsw i64 %1, 1
%3 = call i32 @move(i64 %2, i32 0)
%4 = call i32 (...) @refresh()
%5 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
@LINES = global i64 0
define void @ScreenEnd() {
%1 = load i64, i64* @LINES
%2 = add nsw i64 %1, -1
%3 = tail call i32 @move(i64 %2, i32 0)
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void send_delete_to_proc() { printf("TODO: send_delete_to_procn\n"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"TODO: send_delete_to_procn\0A\00"
define void @send_delete_to_proc() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"TODO: send_delete_to_procn\00"
define void @send_delete_to_proc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void usage(void) {
  static char *usage_str =
      "Usage: fw_decode [OPTION] FILE\n"
      "  -d, --dest=DIR         destination directory to extract\n"
      "  -h, --help             display this help and exit\n"
      "  -l, --list             list the files in the firmware\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 ([198 x i8], [198 x i8]* @.str, i32 0, i32 0)
@.str = [198 x i8] c"Usage: fw_decode [OPTION] FILE\0A -d, --dest=DIR destination directory to extract\0A -h, --help display this help and exit\0A -l, --list list the files in the firmware\0A\00"
define void @usage() {
%1 = load i8*, i8** @usage.usage_str
%2 = call i32 @puts(i8* %1)
ret void
}

LLVM IR (-O2):
@.str = [198 x i8] c"Usage: fw_decode [OPTION] FILE\0A -d, --dest=DIR destination directory to extract\0A -h, --help display this help and exit\0A -l, --list list the files in the firmware\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0))
ret void
}
int bitcount(unsigned x) {
  int b = 1;
  if (x == 0)
    b--;
  while (x &= (x - 1))
    b++;
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1121 <bitcount+0x21>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <bitcount+0x26>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1149 <bitcount+0x49>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <bitcount+0x26>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
cmp    $0x1,%edi
sbb    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
br label %4
4: ; preds = %4, %1
%5 = phi i32 [ %0, %1 ], [ %8, %4 ]
%6 = phi i32 [ %3, %1 ], [ %10, %4 ]
%7 = add i32 %5, -1
%8 = and i32 %7, %5
%9 = icmp eq i32 %8, 0
%10 = add nuw nsw i32 %6, 1
br i1 %9, label %11, label %4
11: ; preds = %4
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
void bimaru_fnumbers(char *s, FILE *fh) {
  while (*s != '\0')
    fputc('0' + *(s++) - 1, fh);
}


x86 assembly (clang, -O0):
<bimaru_fnumbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1156 <bimaru_fnumbers+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
add    $0x30,%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <fputc@plt>
jmp    1120 <bimaru_fnumbers+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bimaru_fnumbers>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1149 <bimaru_fnumbers+0x39>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
add    $0x2f,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <bimaru_fnumbers+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @bimaru_fnumbers(i8* nocapture %0, i32* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %12, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = add nsw i32 %8, 47
%11 = tail call i32 @fputc(i32 %10, i32* %1)
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: affine [-d] a b\n"
                  "a: integer > 0 and coprime with 26\n"
                  "b: integer between 0 and 25\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [87 x i8] c"usage: affine [-d] a b\0Aa: integer > 0 and coprime with 26\0Ab: integer between 0 and 25\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [87 x i8] c"usage: affine [-d] a b\0Aa: integer > 0 and coprime with 26\0Ab: integer between 0 and 25\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int rand_norm();
int rand_index(void) {
  int i = rand_norm() * (1000);
  if (i == (1000))
    return (1000) - 1;
  else
    return i;
}


x86 assembly (clang, -O0):
<rand_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand_norm@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jne    1141 <rand_index+0x31>
movl   $0x3e7,-0x4(%rbp)
jmp    1147 <rand_index+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_index>:
push   %rax
xor    %eax,%eax
call   1030 <rand_norm@plt>
imul   $0x3e8,%eax,%ecx
cmp    $0x1,%eax
mov    $0x3e7,%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rand_index() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @rand_norm()
%4 = mul nsw i32 %3, 1000
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1000
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 999, i32* %1
br label %10
8: ; preds = %0
%9 = load i32, i32* %2
store i32 %9, i32* %1
br label %10
10: ; preds = %8, %7
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @rand_index() {
%1 = tail call i32 (...) @rand_norm()
%2 = icmp eq i32 %1, 1
%3 = mul nsw i32 %1, 1000
%4 = select i1 %2, i32 999, i32 %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void xs_err_abort(void) { abort(); }


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

x86 assembly (clang, -O2):
<xs_err_abort>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @xs_err_abort() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @xs_err_abort() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int strncasecmp(char const *, char const *, size_t);
int iks_strncasecmp(const char *a, const char *b, size_t n) {
  if (!a || !b)
    return -1;
  return strncasecmp(a, b, n);
}


x86 assembly (clang, -O0):
<iks_strncasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113a <iks_strncasecmp+0x2a>
cmpq   $0x0,-0x18(%rbp)
jne    1146 <iks_strncasecmp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <iks_strncasecmp+0x4a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <strncasecmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iks_strncasecmp>:
test   %rdi,%rdi
je     111f <iks_strncasecmp+0xf>
test   %rsi,%rsi
je     111f <iks_strncasecmp+0xf>
jmp    1030 <strncasecmp@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @iks_strncasecmp(i8* %0, i8* %1, i64 %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @strncasecmp(i8* %0, i8* %1, i64 %2)
br label %9
9: ; preds = %3, %7
%10 = phi i32 [ %8, %7 ], [ -1, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void C_Utils_free_sbyte_ptr(signed char *item) { free(item); }


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

x86 assembly (clang, -O2):
<C_Utils_free_sbyte_ptr>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @C_Utils_free_sbyte_ptr(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int const u_int16_t;
typedef int u_char;

/* Variables and functions */
u_int16_t __get_unaligned_le16(const u_char *p) { return p[0] | p[1] << 8; }


x86 assembly (clang, -O0):
<__get_unaligned_le16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__get_unaligned_le16>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @__get_unaligned_le16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
uint32_t SWAP32(const void *addr) { return htonl(*((uint32_t *)(addr))); }


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

x86 assembly (clang, -O2):
<SWAP32>:
mov    (%rdi),%edi
jmp    1030 <htonl@plt>

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

LLVM IR (-O2):
define i32 @SWAP32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @htonl(i32 %3)
ret i32 %4
}
/* Variables and functions */
double exp(double);
void dexp(int xlength, double *x, int skip) {
  int i;
  for (i = 0; i < xlength; i += skip) {
    x[i] = exp(x[i]);
  }
}


x86 assembly (clang, -O0):
<dexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1162 <dexp+0x52>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <exp@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1129 <dexp+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dexp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1149 <dexp+0x39>
mov    %rsi,%r12
movslq %edx,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rbx,8),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,(%r12,%rbx,8)
add    %r14,%rbx
cmp    %r15,%rbx
jl     1130 <dexp+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dexp(i32 %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = load double*, double** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = call double @exp(double %17)
%19 = load double*, double** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
store double %18, double* %22
br label %23
23: ; preds = %12
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = add nsw i32 %25, %24
store i32 %26, i32* %7
br label %8
27: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @dexp(i32 %0, double* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = sext i32 %2 to i64
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %13, %8 ]
%10 = getelementptr inbounds double, double* %1, i64 %9
%11 = load double, double* %10
%12 = tail call double @exp(double %11)
store double %12, double* %10
%13 = add i64 %9, %6
%14 = icmp slt i64 %13, %7
br i1 %14, label %8, label %15
15: ; preds = %8, %3
ret void
}
void XtDisplayOfObject() {}


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

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

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

LLVM IR (-O2):
define void @XtDisplayOfObject() {
ret void
}
void outl(unsigned int v, int p) {
  __asm__ __volatile__("outl %k0, %w1" : : "a"(v), "Nd"(p));
}


x86 assembly (clang, -O0):
<outl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
out    %eax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outl>:
mov    %esi,%edx
mov    %edi,%eax
out    %eax,(%dx)
ret

LLVM IR (-O0):
define void @outl(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
ret void
}

LLVM IR (-O2):
define void @outl(i32 %0, i32 %1) {
tail call void asm sideeffect "outl ${0:k}, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *realloc(void *, unsigned int);
void *mem_realloc(void *p, unsigned int size) {
  p = realloc(p, size);
  if (!p)
    error("memory allocation failed (no memory left?) [mem_realloc]\n");
  return p;
}


x86 assembly (clang, -O0):
<mem_realloc>:
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 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1156 <mem_realloc+0x36>
lea    0xeaf(%rip),%rdi
call   1040 <error@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_realloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <mem_realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"memory allocation failed (no memory left?) [mem_realloc]\0A\00"
define i8* @mem_realloc(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 i8* @realloc(i8* %5, i32 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @error(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [58 x i8] c"memory allocation failed (no memory left?) [mem_realloc]\0A\00"
define i8* @mem_realloc(i8* %0, i32 %1) {
%3 = tail call i8* @realloc(i8* %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @error(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
int test_imm_90int8_reg(signed char val) {
  return ((val) & (0x90 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_90int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x90,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_90int8_reg(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, 144
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_90int8_reg(i8 signext %0) {
%2 = and i8 %0, -112
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}