xunge/DecIR huggingface dataset:
int fun_coverage_switch_nobreak(int x) {
  int ret = 0;
  switch (x) {
  case 1: {
    ret += 2;
    break;
  }
  case 2: {
    ret += 3;
  }
  case 3: {
    ret += 4;
    break;
  }
  default: {
    ret += 100;
    break;
  }
  }
  return ret;
}


x86 assembly (clang, -O0):
<fun_coverage_switch_nobreak>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1144 <fun_coverage_switch_nobreak+0x44>
jmp    1122 <fun_coverage_switch_nobreak+0x22>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1152 <fun_coverage_switch_nobreak+0x52>
jmp    1133 <fun_coverage_switch_nobreak+0x33>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     115b <fun_coverage_switch_nobreak+0x5b>
jmp    1169 <fun_coverage_switch_nobreak+0x69>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <fun_coverage_switch_nobreak+0x72>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
jmp    1172 <fun_coverage_switch_nobreak+0x72>
mov    -0x8(%rbp),%eax
add    $0x64,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_coverage_switch_nobreak>:
cmp    $0x1,%edi
je     1115 <fun_coverage_switch_nobreak+0x15>
cmp    $0x3,%edi
je     111b <fun_coverage_switch_nobreak+0x1b>
cmp    $0x2,%edi
jne    1121 <fun_coverage_switch_nobreak+0x21>
mov    $0x7,%eax
ret
mov    $0x2,%eax
ret
mov    $0x4,%eax
ret
mov    $0x64,%eax
ret

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

LLVM IR (-O2):
define i32 @fun_coverage_switch_nobreak(i32 %0) {
switch i32 %0, label %5 [
i32 1, label %6
i32 2, label %2
i32 3, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 4, %1 ], [ 7, %2 ]
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %3
%7 = phi i32 [ 100, %5 ], [ %4, %3 ], [ 2, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ open_file(int /*<<< orphan*/);
void op_openpath() { open_file(0); }


x86 assembly (clang, -O0):
<op_openpath>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <open_file@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_openpath>:
xor    %edi,%edi
jmp    1030 <open_file@plt>

LLVM IR (-O0):
define void @op_openpath() {
%1 = call i32 @open_file(i32 0)
ret void
}

LLVM IR (-O2):
define void @op_openpath() {
%1 = tail call i32 @open_file(i32 0)
ret void
}
/* Type definitions */
struct group {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct group *getgrnam(const char *name) {
  assert(!"NYI");
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.group = type { i32 }
@.str = [4 x i8] c"NYI\00"
define %struct.group* @getgrnam(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @assert(i32 0)
ret %struct.group* null
}

LLVM IR (-O2):
%struct.group = type { i32 }
define noalias %struct.group* @getgrnam(i8* nocapture readnone %0) {
%2 = tail call i32 @assert(i32 0)
ret %struct.group* null
}
void test52_HelloWorld_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test52_HelloWorld_targetInit__I() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long serial;
};
typedef TYPE_1__ XFocusChangeEvent;

/* Variables and functions */
void set_XFocusChangeEvent_serial(void *_p, unsigned long _v) {
  ((XFocusChangeEvent *)_p)->serial = (unsigned long)_v;
}


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

x86 assembly (clang, -O2):
<set_XFocusChangeEvent_serial>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XFocusChangeEvent_serial(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XFocusChangeEvent_serial(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int f91(int *);
int f92(int *p) { return f91(p); }


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

x86 assembly (clang, -O2):
<f92>:
jmp    1030 <f91@plt>

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

LLVM IR (-O2):
define i32 @f92(i32* %0) {
%2 = tail call i32 @f91(i32* %0)
ret i32 %2
}
/* Variables and functions */
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int confirm() {
  int res = 0;
  printf("Ready? ");
  res = fgetc(stdin);
  while (fgetc(stdin) != '\n')
    ;
  if (res == 'y' || res == 'Y')
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
movsbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     116e <confirm+0x4e>
jmp    114f <confirm+0x2f>
cmpl   $0x79,-0x8(%rbp)
je     1182 <confirm+0x62>
cmpl   $0x59,-0x8(%rbp)
jne    118e <confirm+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1195 <confirm+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confirm>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb2(%rip),%rbx
mov    (%rbx),%edi
call   1040 <fgetc@plt>
mov    %eax,%ebp
nop
mov    (%rbx),%edi
call   1040 <fgetc@plt>
cmp    $0xa,%al
jne    1140 <confirm+0x20>
and    $0xdf,%bpl
xor    %eax,%eax
cmp    $0x59,%bpl
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Ready? \00"
@stdin = global i32 0
define i32 @confirm() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call signext i8 @fgetc(i32 %4)
%6 = sext i8 %5 to i32
store i32 %6, i32* %2
br label %7
7: ; preds = %12, %0
%8 = load i32, i32* @stdin
%9 = call signext i8 @fgetc(i32 %8)
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %7
br label %7
13: ; preds = %7
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 121
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 89
br i1 %18, label %19, label %20
19: ; preds = %16, %13
store i32 1, i32* %1
br label %21
20: ; preds = %16
store i32 0, i32* %1
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [8 x i8] c"Ready? \00"
@stdin = global i32 0
define i32 @confirm() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdin
%3 = tail call signext i8 @fgetc(i32 %2)
br label %4
4: ; preds = %4, %0
%5 = load i32, i32* @stdin
%6 = tail call signext i8 @fgetc(i32 %5)
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %4
8: ; preds = %4
%9 = and i8 %3, -33
%10 = icmp eq i8 %9, 89
%11 = zext i1 %10 to i32
ret i32 %11
}
int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm) { return 0; }


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

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

LLVM IR (-O0):
%struct.dlm_ctxt = type opaque
define i32 @dlm_create_debugfs_subroot(%struct.dlm_ctxt* %0) {
%2 = alloca %struct.dlm_ctxt*
store %struct.dlm_ctxt* %0, %struct.dlm_ctxt** %2
ret i32 0
}

LLVM IR (-O2):
%struct.dlm_ctxt = type opaque
define i32 @dlm_create_debugfs_subroot(%struct.dlm_ctxt* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ find_one(char *);
void find_one_index_large_test() {
  find_one("benchmarks"
           ".index.large");
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"benchmarks.index.large\00"
define void @find_one_index_large_test() {
%1 = call i32 @find_one(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"benchmarks.index.large\00"
define void @find_one_index_large_test() {
%1 = tail call i32 @find_one(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ jlog(int /*<<< orphan*/, char *);
void enough_mem(const void *ptr) {
  if (ptr == (void *)0) {
    jlog(0, "Not enough memory for malloc. Exiting.");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<enough_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114f <enough_mem+0x2f>
xor    %edi,%edi
lea    0xec0(%rip),%rsi
call   1030 <jlog@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enough_mem>:
test   %rdi,%rdi
je     1126 <enough_mem+0x6>
ret
push   %rax
lea    0xed2(%rip),%rsi
xor    %edi,%edi
call   1030 <jlog@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Not enough memory for malloc. Exiting.\00"
define void @enough_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = call i32 @jlog(i32 0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"Not enough memory for malloc. Exiting.\00"
define void @enough_mem(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @jlog(i32 0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, size_t);
size_t strlen(char *);
char *strapp(char *x, char *y) {
  if (y) {
    size_t l = strlen(y);
    memcpy(x, y, l);
    x += l;
  }
  return x;
}


x86 assembly (clang, -O0):
<strapp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1165 <strapp+0x45>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strapp>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %rsi,%rsi
je     114c <strapp+0x2c>
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <memcpy@plt>
add    %r15,%r14
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strapp(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i64 @strlen(i8* %1)
%6 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %5)
%7 = getelementptr inbounds i8, i8* %0, i64 %5
br label %8
8: ; preds = %4, %2
%9 = phi i8* [ %7, %4 ], [ %0, %2 ]
ret i8* %9
}
/* Variables and functions */
scalar_t__ WIFSIGNALED(int);
int WTERMSIG(int);
int getWaitExitSig(int *statp) {
  if (WIFSIGNALED(*statp))
    return WTERMSIG(*statp);
  else
    return -1;
}


x86 assembly (clang, -O0):
<getWaitExitSig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     1154 <getWaitExitSig+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <WTERMSIG@plt>
mov    %eax,-0x4(%rbp)
jmp    115b <getWaitExitSig+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWaitExitSig>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <WIFSIGNALED@plt>
test   %rax,%rax
je     1138 <getWaitExitSig+0x18>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <WTERMSIG@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @getWaitExitSig(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i64 @WIFSIGNALED(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %0
%7 = tail call i32 @WTERMSIG(i32 %6)
br label %8
8: ; preds = %1, %5
%9 = phi i32 [ %7, %5 ], [ -1, %1 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ lprintf(int, char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *mydup(register char *s) {
  register char *p = (char *)malloc(strlen(s) + 1);
  if (!p) {
    lprintf(1, "mydup can't malloc");
    exit(1);
  }
  strcpy(p, s);
  return (p);
}


x86 assembly (clang, -O0):
<mydup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    119b <mydup+0x4b>
mov    $0x1,%edi
lea    0xe74(%rip),%rsi
call   1070 <lprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mydup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1183 <mydup+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe76(%rip),%rsi
mov    $0x1,%edi
call   1070 <lprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"mydup can't malloc\00"
define i8* @mydup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %1
%12 = call i32 @lprintf(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [19 x i8] c"mydup can't malloc\00"
define i8* @mydup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @lprintf(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ coloncmd(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void docmd(char *cmd, char *line) {
  char buf[256];
  sprintf(buf, "%s %s", cmd, line);
  coloncmd(buf);
}


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

x86 assembly (clang, -O2):
<docmd>:
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <coloncmd@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
define void @docmd(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = call i32 @coloncmd(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
define void @docmd(i8* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i32 @coloncmd(i8* %4)
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char ch;
  int len = 0;
  printf("Enter your messages: ");
  while ((ch = getchar()) != '\n') {
    len++;
  }
  printf("Your message was %d length long.\n", len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     116f <main+0x4f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
mov    -0x18(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    $0xa,%al
jne    1140 <main+0x20>
lea    0xec1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter your messages: \00"
@.str.1 = [34 x i8] c"Your message was %d length long.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %13, %2
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %6
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
br label %9
16: ; preds = %9
%17 = load i32, i32* %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter your messages: \00"
@.str.1 = [34 x i8] c"Your message was %d length long.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ 0, %2 ], [ %8, %4 ]
%6 = tail call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 10
%8 = add nuw nsw i32 %5, 1
br i1 %7, label %9, label %4
9: ; preds = %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int convert_to_hex(int x) {
  char *hex_string;
  sprintf(hex_string, "%x", x);
  printf(hex_string);
}


x86 assembly (clang, -O0):
<convert_to_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_hex>:
push   %rax
lea    0xed8(%rip),%rsi
mov    %edi,%edx
call   1040 <sprintf@plt>
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
define i32 @convert_to_hex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* %8)
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define i32 @convert_to_hex(i32 %0) {
%2 = tail call i32 @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @printf(i8* dereferenceable(1) undef)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ st103_ep_set_tx_status(int, int);
int /*<<< orphan*/ st103_set_tx_count(int, size_t);
void usb_lld_tx_enable(int ep_num, size_t len) {
  st103_set_tx_count(ep_num, len);
  st103_ep_set_tx_status(ep_num, (0x0030));
}


x86 assembly (clang, -O0):
<usb_lld_tx_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <st103_set_tx_count@plt>
mov    -0x4(%rbp),%edi
mov    $0x30,%esi
call   1040 <st103_ep_set_tx_status@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_lld_tx_enable>:
push   %rbx
mov    %edi,%ebx
call   1030 <st103_set_tx_count@plt>
mov    %ebx,%edi
mov    $0x30,%esi
pop    %rbx
jmp    1040 <st103_ep_set_tx_status@plt>

LLVM IR (-O0):
define void @usb_lld_tx_enable(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = load i64, i64* %4
%7 = call i32 @st103_set_tx_count(i32 %5, i64 %6)
%8 = load i32, i32* %3
%9 = call i32 @st103_ep_set_tx_status(i32 %8, i32 48)
ret void
}

LLVM IR (-O2):
define void @usb_lld_tx_enable(i32 %0, i64 %1) {
%3 = tail call i32 @st103_set_tx_count(i32 %0, i64 %1)
%4 = tail call i32 @st103_ep_set_tx_status(i32 %0, i32 48)
ret void
}
/* Variables and functions */
int O_NONBLOCK;
int socket(int, int, int);
int ab_socket(int domain, int type, int protocol) {
  return socket(domain, type | O_NONBLOCK, protocol);
}


x86 assembly (clang, -O0):
<ab_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2eba(%rip),%rax
or     (%rax),%esi
mov    -0xc(%rbp),%edx
call   1030 <socket@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ab_socket>:
mov    0x2ed1(%rip),%rax
or     (%rax),%esi
jmp    1030 <socket@plt>

LLVM IR (-O0):
@O_NONBLOCK = global i32 0
define i32 @ab_socket(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* @O_NONBLOCK
%10 = or i32 %8, %9
%11 = load i32, i32* %6
%12 = call i32 @socket(i32 %7, i32 %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@O_NONBLOCK = global i32 0
define i32 @ab_socket(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @O_NONBLOCK
%5 = or i32 %4, %1
%6 = tail call i32 @socket(i32 %0, i32 %5, i32 %2)
ret i32 %6
}
/* Type definitions */
struct blob_buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ blob_nest_end(struct blob_buf *, void *);
void blobmsg_close_table(struct blob_buf *buf, void *cookie) {
  blob_nest_end(buf, cookie);
}


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

x86 assembly (clang, -O2):
<blobmsg_close_table>:
jmp    1030 <blob_nest_end@plt>

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

LLVM IR (-O2):
%struct.blob_buf = type { i32 }
define void @blobmsg_close_table(%struct.blob_buf* %0, i8* %1) {
%3 = tail call i32 @blob_nest_end(%struct.blob_buf* %0, i8* %1)
ret void
}
void bthost_stop(struct bthost *bthost) {}


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

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

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

LLVM IR (-O2):
%struct.bthost = type opaque
define void @bthost_stop(%struct.bthost* nocapture %0) {
ret void
}
unsigned numbits(unsigned v) {
  unsigned int c;
  for (c = 0; v; c++) {
    v &= v - 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<numbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <numbits+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <numbits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numbits>:
xor    %eax,%eax
test   %edi,%edi
je     111c <numbits+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <numbits+0x10>
ret

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

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

/* Variables and functions */
int getsockopt(int, int, int, void *, int /*<<< orphan*/ *);
int getsockopt_portable(int s, int level, int optname, void *optval,
                        socklen_t *optlen) {
  return getsockopt(s, level, optname, optval, optlen);
}


x86 assembly (clang, -O0):
<getsockopt_portable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <getsockopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsockopt_portable>:
jmp    1030 <getsockopt@plt>

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

LLVM IR (-O2):
define i32 @getsockopt_portable(i32 %0, i32 %1, i32 %2, i8* %3, i32* %4) {
%6 = tail call i32 @getsockopt(i32 %0, i32 %1, i32 %2, i8* %3, i32* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
unsigned int distance(unsigned int, unsigned int, int, unsigned int);
unsigned int ringbuffer_distance(unsigned int a, unsigned int b, int mode,
                                 unsigned int begin, unsigned int end) {
  assert(end >= begin);
  assert(a >= begin);
  return distance(a, b, mode, end - begin);
}


x86 assembly (clang, -O0):
<ringbuffer_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    -0x10(%rbp),%ecx
call   1040 <distance@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ringbuffer_distance>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%ebx
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%r12d
xor    %edi,%edi
sub    %ecx,%ebx
setae  %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmp    %ebp,%r12d
setae  %dil
call   1030 <assert@plt>
mov    %r12d,%edi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <distance@plt>

LLVM IR (-O0):
define i32 @ringbuffer_distance(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
%12 = load i32, i32* %9
%13 = icmp uge i32 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32, i32* %6
%17 = load i32, i32* %9
%18 = icmp uge i32 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i32, i32* %10
%25 = load i32, i32* %9
%26 = sub i32 %24, %25
%27 = call i32 @distance(i32 %21, i32 %22, i32 %23, i32 %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @ringbuffer_distance(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp uge i32 %4, %3
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp uge i32 %0, %3
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = sub i32 %4, %3
%13 = tail call i32 @distance(i32 %0, i32 %1, i32 %2, i32 %12)
ret i32 %13
}
/* Type definitions */
struct smp_str_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ smp_str_cmp(struct smp_str_s const *,
                               struct smp_str_s const *);
int smp_kv_keyIsequal_bystrs(const struct smp_str_s *key1,
                             const struct smp_str_s *key2) {
  if (smp_str_cmp(key1, key2) == (0))
    return (0);
  return (-2);
}


x86 assembly (clang, -O0):
<smp_kv_keyIsequal_bystrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <smp_str_cmp@plt>
cmp    $0x0,%eax
jne    1142 <smp_kv_keyIsequal_bystrs+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1149 <smp_kv_keyIsequal_bystrs+0x39>
movl   $0xfffffffe,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_kv_keyIsequal_bystrs>:
push   %rax
call   1030 <smp_str_cmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    (%rcx,%rcx,1),%eax
add    $0xfffffffe,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.smp_str_s = type { i32 }
define i32 @smp_kv_keyIsequal_bystrs(%struct.smp_str_s* %0, %struct.smp_str_s* %1) {
%3 = alloca i32
%4 = alloca %struct.smp_str_s*
%5 = alloca %struct.smp_str_s*
store %struct.smp_str_s* %0, %struct.smp_str_s** %4
store %struct.smp_str_s* %1, %struct.smp_str_s** %5
%6 = load %struct.smp_str_s*, %struct.smp_str_s** %4
%7 = load %struct.smp_str_s*, %struct.smp_str_s** %5
%8 = call i32 @smp_str_cmp(%struct.smp_str_s* %6, %struct.smp_str_s* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %12
11: ; preds = %2
store i32 -2, i32* %3
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
%struct.smp_str_s = type { i32 }
define i32 @smp_kv_keyIsequal_bystrs(%struct.smp_str_s* %0, %struct.smp_str_s* %1) {
%3 = tail call i32 @smp_str_cmp(%struct.smp_str_s* %0, %struct.smp_str_s* %1)
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 0, i32 -2
ret i32 %5
}
int bar1(int c) {
  if (c < 50)
    c += 10;
  else
    c -= 10;
  return c * c;
}


x86 assembly (clang, -O0):
<bar1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    111f <bar1+0x1f>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1128 <bar1+0x28>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar1>:
lea    -0xa(%rdi),%ecx
lea    0xa(%rdi),%eax
cmp    $0x32,%edi
cmovge %ecx,%eax
imul   %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @bar1(i32 %0) {
%2 = icmp slt i32 %0, 50
%3 = select i1 %2, i32 10, i32 -10
%4 = add nsw i32 %3, %0
%5 = mul nsw i32 %4, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void hash_data_clear(char *dst) { memset(dst, 0, 256); }


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

x86 assembly (clang, -O2):
<hash_data_clear>:
xor    %esi,%esi
mov    $0x100,%edx
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @hash_data_clear(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 256)
ret void
}
void av_fmt_ctx_get_duration_estimation_method() {}


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

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

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

LLVM IR (-O2):
define void @av_fmt_ctx_get_duration_estimation_method() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void esft_stor_utils_delete(void *m) { free(m); }


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

LLVM IR (-O0):
define void @esft_stor_utils_delete(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 @esft_stor_utils_delete(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
void PERDummyFlush(void) {}


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

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

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

LLVM IR (-O2):
define void @PERDummyFlush() {
ret void
}
/* Type definitions */
struct timespec {
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, struct timespec *);
void sleep_ns(int nanoseconds) {
  static struct timespec time;
  struct timespec rem;
  time.tv_nsec = nanoseconds;
  nanosleep(&time, &rem);
}


x86 assembly (clang, -O0):
<sleep_ns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,0x2f08(%rip)
lea    0x2f01(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <nanosleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_ns>:
push   %rax
mov    %edi,0x2f15(%rip)
lea    0x2f0e(%rip),%rdi
mov    %rsp,%rsi
call   1030 <nanosleep@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@sleep_ns.time = internal global %struct.timespec zeroinitializer
define void @sleep_ns(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* getelementptr inbounds (%struct.timespec, %struct.timespec* @sleep_ns.time, i32 0, i32 0)
%5 = call i32 @nanosleep(%struct.timespec* @sleep_ns.time, %struct.timespec* %3)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@sleep_ns.time = internal global %struct.timespec zeroinitializer
define void @sleep_ns(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
store i32 %0, i32* getelementptr inbounds (%struct.timespec, %struct.timespec* @sleep_ns.time, i64 0, i32 0)
%4 = call i32 @nanosleep(%struct.timespec* @sleep_ns.time, %struct.timespec* %2)
ret void
}
/* Variables and functions */
double floor(double);
double SDL_floor(double x) { return floor(x); }


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

x86 assembly (clang, -O2):
<SDL_floor>:
jmp    1030 <floor@plt>

LLVM IR (-O0):
define double @SDL_floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.floor.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @SDL_floor(double %0) {
%2 = tail call double @llvm.floor.f64(double %0)
ret double %2
}
int fun770() { return 770; }


x86 assembly (clang, -O0):
<fun770>:
push   %rbp
mov    %rsp,%rbp
mov    $0x302,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun770>:
mov    $0x302,%eax
ret

LLVM IR (-O0):
define i32 @fun770() {
ret i32 770
}

LLVM IR (-O2):
define i32 @fun770() {
ret i32 770
}
void NoSoundDrv_MIDI_Lock(void) {}


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

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

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

LLVM IR (-O2):
define void @NoSoundDrv_MIDI_Lock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  register void *val = realloc(ptr, size);
  if (val == 0)
    error("not enough virtual memory!");
  return val;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <xrealloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [27 x i8] c"not enough virtual memory!\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [27 x i8] c"not enough virtual memory!\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %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 ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ puerto_excitaColumnaTeclado();
void tecladoInic(void) { puerto_excitaColumnaTeclado(); }


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

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

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

LLVM IR (-O2):
define void @tecladoInic() {
%1 = tail call i32 (...) @puerto_excitaColumnaTeclado()
ret void
}
int _min(int i, int j) { return (i < j ? i : j); }


x86 assembly (clang, -O0):
<_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <_min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @_min(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
char **load_indexed_ar(char *, int *);
char **load_functions(char *file) {
  int sz;
  return load_indexed_ar(file, &sz);
}


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

x86 assembly (clang, -O2):
<load_functions>:
push   %rax
lea    0x4(%rsp),%rsi
call   1030 <load_indexed_ar@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i8** @load_functions(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i8** @load_indexed_ar(i8* %0, i32* %2)
ret i8** %4
}