xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ add();
int /*<<< orphan*/ by_ptr_pp(int /*<<< orphan*/);
void add_by_ptr_pp(uint32_t x) {
  by_ptr_pp(x);
  add();
}


x86 assembly (clang, -O0):
<add_by_ptr_pp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <by_ptr_pp@plt>
mov    $0x0,%al
call   1030 <add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_by_ptr_pp>:
push   %rax
call   1040 <by_ptr_pp@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <add@plt>

LLVM IR (-O0):
define void @add_by_ptr_pp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @by_ptr_pp(i32 %3)
%5 = call i32 (...) @add()
ret void
}

LLVM IR (-O2):
define void @add_by_ptr_pp(i32 %0) {
%2 = tail call i32 @by_ptr_pp(i32 %0)
%3 = tail call i32 (...) @add()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
ret() { ol("RET"); }


x86 assembly (clang, -O0):
<ret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"RET\00"
define i32 @ret() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"RET\00"
define i32 @ret() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void _exit(int code) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <_exit+0x7>

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

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1, %3
br label %3
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Variables and functions */
void stub1(double);
void testClosureDrV(void (*closure)(double), double a1) {
  if (closure != NULL)
    (*closure)(a1);
}


x86 assembly (clang, -O0):
<testClosureDrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1127 <testClosureDrV+0x27>
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureDrV>:
test   %rdi,%rdi
je     1107 <testClosureDrV+0x7>
jmp    *%rdi
ret

LLVM IR (-O0):
define void @testClosureDrV(void (double)* %0, double %1) {
%3 = alloca void (double)*
%4 = alloca double
store void (double)* %0, void (double)** %3
store double %1, double* %4
%5 = load void (double)*, void (double)** %3
%6 = icmp ne void (double)* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load void (double)*, void (double)** %3
%9 = load double, double* %4
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @testClosureDrV(void (double)* %0, double %1) {
%3 = icmp eq void (double)* %0, null
br i1 %3, label %5, label %4
4: ; preds = %2
tail call void %0(double %1)
br label %5
5: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dummy_handler_default();
void dummy_handler(void) { dummy_handler_default(); }


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

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

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

LLVM IR (-O2):
define void @dummy_handler() {
%1 = tail call i32 (...) @dummy_handler_default()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ val;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_NODELAY;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int tcp_nodelay(int fd, int val) {
  if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)) == -1) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<tcp_nodelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1157 <tcp_nodelay+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <tcp_nodelay+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_nodelay>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
mov    0x2ec3(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @tcp_nodelay(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* @IPPROTO_TCP
%8 = load i32, i32* @TCP_NODELAY
%9 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, i32* %5, i32 4)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @tcp_nodelay(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_NODELAY
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %3, i32 4)
%7 = icmp eq i32 %6, -1
%8 = sext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int putc(int, int /*<<< orphan*/ *);
int fputs(const char *str, FILE *stream) {
  int c;
  int ret = 0;
  while ((c = *str++) != '\0')
    ret = putc(c, stream);
  return (ret);
}


x86 assembly (clang, -O0):
<fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1159 <fputs+0x49>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
mov    %eax,-0x18(%rbp)
jmp    1127 <fputs+0x17>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputs>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%cl
test   %cl,%cl
je     1148 <fputs+0x38>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %cl,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1130 <fputs+0x20>
jmp    114a <fputs+0x3a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @fputs(i8* nocapture %0, i32* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %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 = tail call i32 @putc(i32 %8, i32* %1)
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i32 [ 0, %2 ], [ %10, %5 ]
ret i32 %14
}
void __restore_rt() {}


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

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

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

LLVM IR (-O2):
define void @__restore_rt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vuln();
int main(int argc, char *argv[]) {
  printf("Try to exec /bin/sh");
  vuln();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <vuln@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Try to exec /bin/sh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @vuln()
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Try to exec /bin/sh\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @vuln()
ret i32 0
}
int Operand_imms_decode(unsigned int *valp) {
  unsigned imms_0, s_0;
  s_0 = *valp & 0xf;
  imms_0 = s_0;
  *valp = imms_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_imms_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_imms_decode>:
andl   $0xf,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Operand_imms_decode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = and i32 %6, 15
store i32 %7, i32* %4
%8 = load i32, i32* %4
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32*, i32** %2
store i32 %9, i32* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_imms_decode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 15
store i32 %3, i32* %0
ret i32 0
}
/* Variables and functions */
int *alloca(int);
int main() {
  int *i = alloca(sizeof(int));
  int *c = alloca(sizeof(int));
  *i = 0;
  *c = 0;
  while (1) {
    if (*i > 10)
      break;
    (*i)++;
    (*c)++;
  }
  return *c;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xa,(%rax)
jle    1161 <main+0x51>
jmp    117c <main+0x6c>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    114f <main+0x3f>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
movl   $0x0,(%rbx)
movl   $0x0,(%rax)
mov    (%rbx),%edx
xor    %ecx,%ecx
cmp    $0xa,%edx
jg     1153 <main+0x43>
nopl   (%rax)
add    $0x1,%edx
mov    %edx,(%rbx)
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    (%rbx),%edx
cmp    $0xb,%edx
jl     1140 <main+0x30>
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 10
br i1 %4, label %12, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %10, %5 ], [ %3, %0 ]
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 10
br i1 %11, label %12, label %5
12: ; preds = %5, %0
%13 = phi i32 [ 0, %0 ], [ %9, %5 ]
ret i32 %13
}
unsigned int rotl(const unsigned int value, int shift) {
  if ((shift &= sizeof(value) * 8 - 1) == 0)
    return value;
  return (value << shift) | (value >> (sizeof(value) * 8 - shift));
}


x86 assembly (clang, -O0):
<rotl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
and    $0x1f,%rax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    1129 <rotl+0x29>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1149 <rotl+0x49>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%edx
movslq -0xc(%rbp),%rsi
mov    $0x20,%ecx
sub    %rsi,%rcx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rotl(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = and i64 %7, 31
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %24
13: ; preds = %2
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = shl i32 %14, %15
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = sub i64 32, %19
%21 = trunc i64 %20 to i32
%22 = lshr i32 %17, %21
%23 = or i32 %16, %22
store i32 %23, i32* %3
br label %24
24: ; preds = %13, %11
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @rotl(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
struct sigaction {
  void (*sa_handler)(int);
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_mask;
};

/* Variables and functions */
int /*<<< orphan*/ sigaction(int, struct sigaction *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void install_handler(int sig, void (*sig_handler)(int)) {
  struct sigaction sa;
  sa.sa_handler = sig_handler;
  sigemptyset(&sa.sa_mask);
  sa.sa_flags = 0;
  sigaction(sig, &sa, 0);
}


x86 assembly (clang, -O0):
<install_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
add    $0x10,%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<install_handler>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
mov    %rsi,0x8(%rsp)
lea    0x18(%rsp),%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @install_handler(i32 %0, void (i32)* %1) {
%3 = alloca i32
%4 = alloca void (i32)*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store void (i32)* %1, void (i32)** %4
%6 = load void (i32)*, void (i32)** %4
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
store void (i32)* %6, void (i32)** %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 2
%9 = call i32 @sigemptyset(i32* %8)
%10 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 1
store i64 0, i64* %10
%11 = load i32, i32* %3
%12 = call i32 @sigaction(i32 %11, %struct.sigaction* %5, i32 0)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @install_handler(i32 %0, void (i32)* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store void (i32)* %1, void (i32)** %5
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 2
%7 = call i32 @sigemptyset(i32* %6)
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 1
store i64 0, i64* %8
%9 = call i32 @sigaction(i32 %0, %struct.sigaction* %3, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write(int, char *, int);
void waitWhileBusy(int fd) {
  char response[6];
  do {
    write(fd, "ID;", 3);
    usleep(100e3);
    read(fd, response, 6);
    sleep(20000);
  } while (response[0] == '?');
}


x86 assembly (clang, -O0):
<waitWhileBusy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xeab(%rip),%rsi
mov    $0x3,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
mov    -0x4(%rbp),%edi
lea    -0xa(%rbp),%rsi
mov    $0x6,%edx
call   1040 <read@plt>
mov    $0x4e20,%edi
call   1050 <sleep@plt>
movsbl -0xa(%rbp),%eax
cmp    $0x3f,%eax
je     114b <waitWhileBusy+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waitWhileBusy>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xeae(%rip),%r14
lea    0xa(%rsp),%r15
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <write@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x6,%edx
call   1040 <read@plt>
mov    $0x4e20,%edi
call   1050 <sleep@plt>
cmpb   $0x3f,0xa(%rsp)
je     1160 <waitWhileBusy+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"ID;\00"
define void @waitWhileBusy(i32 %0) {
%2 = alloca i32
%3 = alloca [6 x i8]
store i32 %0, i32* %2
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %2
%6 = call i32 @write(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = call i32 @usleep(i32 100000)
%8 = load i32, i32* %2
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%10 = call i32 @read(i32 %8, i8* %9, i32 6)
%11 = call i32 @sleep(i32 20000)
br label %12
12: ; preds = %4
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 63
br i1 %16, label %4, label %17
17: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"ID;\00"
define void @waitWhileBusy(i32 %0) {
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %4, %1
%5 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = tail call i32 @usleep(i32 100000)
%7 = call i32 @read(i32 %0, i8* %3, i32 6)
%8 = tail call i32 @sleep(i32 20000)
%9 = load i8, i8* %3
%10 = icmp eq i8 %9, 63
br i1 %10, label %4, label %11
11: ; preds = %4
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int main() {
  char *foo;
  char *bar;
  foo = (char *)malloc(12);
  bar = (char *)malloc(10);
  memcpy(foo + 1, bar + 1, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0xa,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    $0xa,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0xa,%edi
call   1040 <malloc@plt>
add    $0x1,%rbx
lea    0x1(%rax),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i64 @malloc(i32 12)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = call i64 @malloc(i32 10)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = call i32 @memcpy(i8* %9, i8* %11, i32 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 12)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @malloc(i32 10)
%4 = inttoptr i64 %3 to i8*
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = tail call i32 @memcpy(i8* %5, i8* %6, i32 10)
ret i32 0
}
/* Type definitions */
struct list_it {
  int dummy;
};
struct list {
  int dummy;
};

/* Variables and functions */
int list_it_append_(struct list *, struct list_it *, int /*<<< orphan*/);
int /*<<< orphan*/ object_copy(void const *);
int list_it_append(struct list *list, struct list_it *it, const void *data) {
  return list_it_append_(list, it, object_copy(data));
}


x86 assembly (clang, -O0):
<list_it_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <object_copy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <list_it_append_@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_it_append>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1040 <object_copy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <list_it_append_@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
%struct.list_it = type { i32 }
define i32 @list_it_append(%struct.list* %0, %struct.list_it* %1, i8* %2) {
%4 = alloca %struct.list*
%5 = alloca %struct.list_it*
%6 = alloca i8*
store %struct.list* %0, %struct.list** %4
store %struct.list_it* %1, %struct.list_it** %5
store i8* %2, i8** %6
%7 = load %struct.list*, %struct.list** %4
%8 = load %struct.list_it*, %struct.list_it** %5
%9 = load i8*, i8** %6
%10 = call i32 @object_copy(i8* %9)
%11 = call i32 @list_it_append_(%struct.list* %7, %struct.list_it* %8, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.list = type { i32 }
%struct.list_it = type { i32 }
define i32 @list_it_append(%struct.list* %0, %struct.list_it* %1, i8* %2) {
%4 = tail call i32 @object_copy(i8* %2)
%5 = tail call i32 @list_it_append_(%struct.list* %0, %struct.list_it* %1, i32 %4)
ret i32 %5
}
unsigned char minimum(unsigned char v1, unsigned char v2, unsigned char v3) {
  unsigned char min = v1;
  if (v2 < min)
    min = v2;
  if (v3 < min)
    min = v3;
  return min;
}


x86 assembly (clang, -O0):
<minimum>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x4(%rbp)
movzbl -0x2(%rbp),%eax
movzbl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    1131 <minimum+0x31>
mov    -0x2(%rbp),%al
mov    %al,-0x4(%rbp)
movzbl -0x3(%rbp),%eax
movzbl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jge    1147 <minimum+0x47>
mov    -0x3(%rbp),%al
mov    %al,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimum>:
mov    %edi,%eax
cmp    %al,%sil
cmovb  %esi,%eax
cmp    %dl,%al
cmova  %edx,%eax
ret

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

LLVM IR (-O2):
define zeroext i8 @minimum(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = icmp ult i8 %1, %0
%5 = select i1 %4, i8 %1, i8 %0
%6 = icmp ugt i8 %5, %2
%7 = select i1 %6, i8 %2, i8 %5
ret i8 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ umount_cmd;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *);
int /*<<< orphan*/ system(char *);
void fuse_unmount(const char *mountpoint) {
  const char *mountprog = "fusermount";
  char umount_cmd[1024];
  snprintf(umount_cmd, sizeof(umount_cmd) - 1, "%s -u %s", mountprog,
           mountpoint);
  umount_cmd[sizeof(umount_cmd) - 1] = '\0';
  system(umount_cmd);
}


x86 assembly (clang, -O0):
<fuse_unmount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    $0x3ff,%esi
lea    0xeb6(%rip),%rdx
call   1040 <snprintf@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fuse_unmount>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%r8
lea    0xed9(%rip),%rdx
lea    0xec7(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3ff,%esi
call   1040 <snprintf@plt>
movb   $0x0,0x3ff(%rsp)
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"fusermount\00"
@.str.1 = [9 x i8] c"%s -u %s\00"
define void @fuse_unmount(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [1024 x i8]
store i8* %0, i8** %2
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %3
%7 = load i8*, i8** %2
%8 = call i32 @snprintf(i8* %5, i32 1023, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7)
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 1023
store i8 0, i8* %9
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = call i32 @system(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"fusermount\00"
@.str.1 = [9 x i8] c"%s -u %s\00"
define void @fuse_unmount(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 1023, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 1023
store i8 0, i8* %5
%6 = call i32 @system(i8* %3)
ret void
}
/* Variables and functions */
char const *strerror(int);
const char *c_strerror(int errnum) { return strerror(errnum); }


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

x86 assembly (clang, -O2):
<c_strerror>:
jmp    1030 <strerror@plt>

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

LLVM IR (-O2):
define i8* @c_strerror(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ XClassHint;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XClassHint(void) {
  XClassHint *_p = (XClassHint *)malloc(sizeof(XClassHint));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XClassHint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XClassHint+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XClassHint>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XClassHint+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XClassHint() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XClassHint() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pn_free(void *p) { free(p); }


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

LLVM IR (-O0):
define void @pn_free(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 @pn_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char const);
void print_as_hex(const void *input, size_t bytes) {
  const unsigned char *p;
  for (p = (const unsigned char *)input; bytes > 0; --bytes, ++p)
    printf("%02x", *p);
}


x86 assembly (clang, -O0):
<print_as_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    1163 <print_as_hex+0x53>
mov    -0x18(%rbp),%rax
lea    0xec2(%rip),%rdi
movzbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <print_as_hex+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_as_hex>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1146 <print_as_hex+0x36>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_as_hex+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
define void @print_as_hex(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
store i8* %6, i8** %5
br label %7
7: ; preds = %14, %2
%8 = load i64, i64* %4
%9 = icmp ugt i64 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
br label %14
14: ; preds = %10
%15 = load i64, i64* %4
%16 = add i64 %15, -1
store i64 %16, i64* %4
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %5
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @print_as_hex(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = phi i64 [ %9, %4 ], [ %1, %2 ]
%7 = load i8, i8* %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %7)
%9 = add i64 %6, -1
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = icmp eq i64 %9, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
unsigned int round_up(uint64_t a, uint64_t b) {
  return (unsigned int)((a + b - 1) / b);
}


x86 assembly (clang, -O0):
<round_up>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @round_up(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 = add nsw i32 %5, %6
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @round_up(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sdiv i32 %4, %1
ret i32 %5
}
void intel_init_thermal(struct cpuinfo_x86 *c) {}


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

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

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

LLVM IR (-O2):
%struct.cpuinfo_x86 = type opaque
define void @intel_init_thermal(%struct.cpuinfo_x86* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 0; i >= 5000; i += 2) {
    printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1388,-0x8(%rbp)
jl     1150 <main+0x40>
mov    -0x8(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
void *dosaddr_to_unixaddr(unsigned int);
void *LINEAR2UNIX(unsigned int addr) { return dosaddr_to_unixaddr(addr); }


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

x86 assembly (clang, -O2):
<LINEAR2UNIX>:
jmp    1030 <dosaddr_to_unixaddr@plt>

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

LLVM IR (-O2):
define i8* @LINEAR2UNIX(i32 %0) {
%2 = tail call i8* @dosaddr_to_unixaddr(i32 %0)
ret i8* %2
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint64_t;

/* Variables and functions */
scalar_t__ uint32_log2(int const);
uint8_t uint64_log2(const uint64_t x) {
  if (x < 0x100000000LL)
    return uint32_log2(x);
  return uint32_log2(x >> 32) + 32;
}


x86 assembly (clang, -O0):
<uint64_log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
movabs $0x100000000,%rcx
cmp    %rcx,%rax
jge    1143 <uint64_log2+0x33>
mov    -0xc(%rbp),%edi
call   1030 <uint32_log2@plt>
mov    %rax,-0x8(%rbp)
jmp    115a <uint64_log2+0x4a>
mov    -0xc(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <uint32_log2@plt>
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint64_log2>:
jmp    1030 <uint32_log2@plt>

LLVM IR (-O0):
define i64 @uint64_log2(i32 %0) {
%2 = alloca i64
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = icmp slt i64 %5, 4294967296
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i64 @uint32_log2(i32 %8)
store i64 %9, i64* %2
br label %15
10: ; preds = %1
%11 = load i32, i32* %3
%12 = ashr i32 %11, 32
%13 = call i64 @uint32_log2(i32 %12)
%14 = add nsw i64 %13, 32
store i64 %14, i64* %2
br label %15
15: ; preds = %10, %7
%16 = load i64, i64* %2
ret i64 %16
}

LLVM IR (-O2):
define i64 @uint64_log2(i32 %0) {
%2 = tail call i64 @uint32_log2(i32 %0)
ret i64 %2
}
/* Variables and functions */
double exp(double);
double Bbp2b(double x) { return x * exp(-x) / (1.0 - exp(-x)); }


x86 assembly (clang, -O0):
<Bbp2b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bbp2b>:
sub    $0x28,%rsp
movapd %xmm0,%xmm1
movapd %xmm0,(%rsp)
movapd 0xedb(%rip),%xmm0
xorpd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0xebf(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @Bbp2b(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fneg double %4
%6 = call double @exp(double %5)
%7 = fmul double %3, %6
%8 = load double, double* %2
%9 = fneg double %8
%10 = call double @exp(double %9)
%11 = fsub double 1.000000e+00, %10
%12 = fdiv double %7, %11
ret double %12
}

LLVM IR (-O2):
define double @Bbp2b(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
%4 = fmul double %3, %0
%5 = tail call double @exp(double %2)
%6 = fsub double 1.000000e+00, %5
%7 = fdiv double %4, %6
ret double %7
}
void parasite_end() {}


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

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

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

LLVM IR (-O2):
define void @parasite_end() {
ret void
}
/* Variables and functions */
long double strtold(char const *, char **);
long double __scan_float(const char **_str, int flags) {
  return strtold(*_str, (char **)_str);
}


x86 assembly (clang, -O0):
<__scan_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    (%rsi),%rdi
call   1030 <strtold@plt>
fld    %st(0)
fstp   %st(0)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__scan_float>:
mov    %rdi,%rsi
mov    (%rdi),%rdi
jmp    1030 <strtold@plt>

LLVM IR (-O0):
define x86_fp80 @__scan_float(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 i8*, i8** %5
%7 = load i8**, i8*** %3
%8 = call x86_fp80 @strtold(i8* %6, i8** %7)
ret x86_fp80 %8
}

LLVM IR (-O2):
define x86_fp80 @__scan_float(i8** nocapture %0, i32 %1) {
%3 = load i8*, i8** %0
%4 = tail call x86_fp80 @strtold(i8* %3, i8** %0)
ret x86_fp80 %4
}
void record_perf_data(struct uftrace_perf_writer *perf, int cpu, int sock) {}


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

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

LLVM IR (-O0):
%struct.uftrace_perf_writer = type opaque
define void @record_perf_data(%struct.uftrace_perf_writer* %0, i32 %1, i32 %2) {
%4 = alloca %struct.uftrace_perf_writer*
%5 = alloca i32
%6 = alloca i32
store %struct.uftrace_perf_writer* %0, %struct.uftrace_perf_writer** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
%struct.uftrace_perf_writer = type opaque
define void @record_perf_data(%struct.uftrace_perf_writer* nocapture %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void printhelp() {
  printf("\nUsage: xee <-?|r|x|c|d|q> <-b=baud> <-s=device> <-g=parameter> "
         "<-w=parameter:value>"
         "\n   -? = display help [help]"
         "\n   -r = raw display of tos packets [raw]"
         "\n   -c = convert data to engineering units [cooked]"
         "\n   -d = debug serial port by dumping bytes [debug]"
         "\n   -b = set the baudrate [baud=#|mica2|mica2dot]"
         "\n   -s = set serial port device [device=com1]"
         "\n   -q = quiet mode (suppress headers)"
         "\n   -g = get parameter [parameter=nodeid]"
         "\n   -w = write parameter as value [nodeid:5]"
         "\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [474 x i8] c"\0AUsage: xee <-?|r|x|c|d|q> <-b=baud> <-s=device> <-g=parameter> <-w=parameter:value>\0A -? = display help [help]\0A -r = raw display of tos packets [raw]\0A -c = convert data to engineering units [cooked]\0A -d = debug serial port by dumping bytes [debug]\0A -b = set the baudrate [baud=#|mica2|mica2dot]\0A -s = set serial port device [device=com1]\0A -q = quiet mode (suppress headers)\0A -g = get parameter [parameter=nodeid]\0A -w = write parameter as value [nodeid:5]\0A\00"
define void @printhelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([474 x i8], [474 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [473 x i8] c"\0AUsage: xee <-?|r|x|c|d|q> <-b=baud> <-s=device> <-g=parameter> <-w=parameter:value>\0A -? = display help [help]\0A -r = raw display of tos packets [raw]\0A -c = convert data to engineering units [cooked]\0A -d = debug serial port by dumping bytes [debug]\0A -b = set the baudrate [baud=#|mica2|mica2dot]\0A -s = set serial port device [device=com1]\0A -q = quiet mode (suppress headers)\0A -g = get parameter [parameter=nodeid]\0A -w = write parameter as value [nodeid:5]\00"
define void @printhelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([473 x i8], [473 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int quot;
  int rem;
};
typedef TYPE_1__ div_t;

/* Variables and functions */
div_t div(int numer, int denom) {
  div_t result;
  result.quot = numer / denom;
  result.rem = numer % denom;
  return result;
}


x86 assembly (clang, -O0):
<div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<div>:
mov    %edi,%eax
cltd
idiv   %esi
shl    $0x20,%rdx
or     %rdx,%rax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
define i64 @div(i32 %0, i32 %1) {
%3 = alloca %struct.TYPE_3__
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = sdiv i32 %6, %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i32 %8, i32* %9
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = srem i32 %10, %11
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i32 %12, i32* %13
%14 = bitcast %struct.TYPE_3__* %3 to i64*
%15 = load i64, i64* %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @div(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
%4 = srem i32 %0, %1
%5 = zext i32 %4 to i64
%6 = shl nuw i64 %5, 32
%7 = zext i32 %3 to i64
%8 = or i64 %6, %7
ret i64 %8
}
void roadmap_search_menu(void) {}


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

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

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

LLVM IR (-O2):
define void @roadmap_search_menu() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ malloc(int);
void alloc_is_zero_Bad() { malloc(0 * sizeof(int)); }


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

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

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

LLVM IR (-O2):
define void @alloc_is_zero_Bad() {
%1 = tail call i32 @malloc(i32 0)
ret void
}