xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ close(int);
void BasSockUdpClose(int sock) { close(sock); }


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

x86 assembly (clang, -O2):
<BasSockUdpClose>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @BasSockUdpClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int __acpi_release_global_lock(unsigned int *lock) {
  unsigned int old, new, val;
  do {
    old = *lock;
    new = old & ~0x3;
    val = ((__typeof__(*(lock)))__cmpxchg(
        (lock), (unsigned long)(old), (unsigned long)(new), sizeof(*(lock))));
  } while (__builtin_expect((val != old), 0));
  return old & 0x1;
}


x86 assembly (clang, -O0):
<__acpi_release_global_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfffffffc,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    %eax,%esi
mov    -0x10(%rbp),%eax
mov    %eax,%edx
mov    $0x4,%ecx
mov    $0x0,%al
call   1030 <__cmpxchg@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
cltq
cmp    $0x0,%rax
jne    111c <__acpi_release_global_lock+0xc>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__acpi_release_global_lock>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%r14),%ebx
mov    %ebx,%edx
and    $0xfffffffc,%edx
mov    $0x4,%ecx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <__cmpxchg@plt>
cmp    %ebx,%eax
jne    1117 <__acpi_release_global_lock+0x7>
and    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @__acpi_release_global_lock(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
br label %6
6: ; preds = %17, %1
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, -4
store i32 %10, i32* %4
%11 = load i32*, i32** %2
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = call i32 (i32*, i64, i64, i64, ...) bitcast (i32 (...)* @__cmpxchg to i32 (i32*, i64, i64, i64, ...)*)(i32* %11, i64 %13, i64 %15, i64 4)
store i32 %16, i32* %5
br label %17
17: ; preds = %6
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = icmp ne i32 %18, %19
%21 = zext i1 %20 to i32
%22 = sext i32 %21 to i64
%23 = icmp ne i64 %22, 0
br i1 %23, label %6, label %24
24: ; preds = %17
%25 = load i32, i32* %3
%26 = and i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
define i32 @__acpi_release_global_lock(i32* %0) {
br label %2
2: ; preds = %2, %1
%3 = load i32, i32* %0
%4 = and i32 %3, -4
%5 = zext i32 %3 to i64
%6 = zext i32 %4 to i64
%7 = tail call i32 (i32*, i64, i64, i64, ...) bitcast (i32 (...)* @__cmpxchg to i32 (i32*, i64, i64, i64, ...)*)(i32* %0, i64 %5, i64 %6, i64 4)
%8 = icmp eq i32 %7, %3
br i1 %8, label %9, label %2
9: ; preds = %2
%10 = and i32 %3, 1
ret i32 %10
}
/* Variables and functions */
void *q();
void *t(void) { return q(); }


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

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

LLVM IR (-O0):
define i8* @t() {
%1 = call i8* (...) @q()
ret i8* %1
}

LLVM IR (-O2):
define i8* @t() {
%1 = tail call i8* (...) @q()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ saa7114_read_reg(int, unsigned char *);
int saa7114_decoder_detect_video(void) {
  unsigned char video = 0xff;
  saa7114_read_reg(0x1F, &video);
  return !((video & 0x40) >> 6);
}


x86 assembly (clang, -O0):
<saa7114_decoder_detect_video>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0xff,-0x1(%rbp)
mov    $0x1f,%edi
lea    -0x1(%rbp),%rsi
call   1030 <saa7114_read_reg@plt>
movzbl -0x1(%rbp),%eax
and    $0x40,%eax
sar    $0x6,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saa7114_decoder_detect_video>:
push   %rax
movb   $0xff,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1f,%edi
call   1030 <saa7114_read_reg@plt>
movzbl 0x7(%rsp),%ecx
xor    %eax,%eax
test   $0x40,%cl
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @saa7114_decoder_detect_video() {
%1 = alloca i8
store i8 -1, i8* %1
%2 = call i32 @saa7114_read_reg(i32 31, i8* %1)
%3 = load i8, i8* %1
%4 = zext i8 %3 to i32
%5 = and i32 %4, 64
%6 = ashr i32 %5, 6
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @saa7114_decoder_detect_video() {
%1 = alloca i8
store i8 -1, i8* %1
%2 = call i32 @saa7114_read_reg(i32 31, i8* %1)
%3 = load i8, i8* %1
%4 = lshr i8 %3, 6
%5 = and i8 %4, 1
%6 = xor i8 %5, 1
%7 = zext i8 %6 to i32
ret i32 %7
}
int rule_V() {}


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

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

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

LLVM IR (-O2):
define i32 @rule_V() {
ret i32 undef
}
/* Type definitions */
struct cli_def {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cli_print(struct cli_def *, char *, char const *);
int hook_enable(struct cli_def *cli, const char *command, char *argv[],
                int argc) {
  cli_print(cli, "Hook (enable): %s", command);
  return 0;
}


x86 assembly (clang, -O0):
<hook_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeca(%rip),%rsi
call   1030 <cli_print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hook_enable>:
push   %rax
mov    %rsi,%rdx
lea    0xee5(%rip),%rsi
call   1030 <cli_print@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.cli_def = type { i32 }
@.str = [18 x i8] c"Hook (enable): %s\00"
define i32 @hook_enable(%struct.cli_def* %0, i8* %1, i8** %2, i32 %3) {
%5 = alloca %struct.cli_def*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
store %struct.cli_def* %0, %struct.cli_def** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load %struct.cli_def*, %struct.cli_def** %5
%10 = load i8*, i8** %6
%11 = call i32 @cli_print(%struct.cli_def* %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
%struct.cli_def = type { i32 }
@.str = [18 x i8] c"Hook (enable): %s\00"
define i32 @hook_enable(%struct.cli_def* %0, i8* %1, i8** nocapture readnone %2, i32 %3) {
%5 = tail call i32 @cli_print(%struct.cli_def* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *, char *, int /*<<< orphan*/);
void int_10(void) { panic("Invalid TSS", "#TS", 0); }


x86 assembly (clang, -O0):
<int_10>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeea(%rip),%rsi
xor    %edx,%edx
call   1030 <panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_10>:
lea    0xee9(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %edx,%edx
jmp    1030 <panic@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Invalid TSS\00"
@.str.1 = [4 x i8] c"#TS\00"
define void @int_10() {
%1 = call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Invalid TSS\00"
@.str.1 = [4 x i8] c"#TS\00"
define void @int_10() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f(int sig) { printf("OUCH!\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"OUCH!\00"
define void @f(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
main() { f(1, 3); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 1, i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1, i32 3)
ret i32 0
}
int q_isprint(int c) { return (c >= 0x20 && c <= 0x7e); }


x86 assembly (clang, -O0):
<q_isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <q_isprint+0x20>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<q_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @q_isprint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @q_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ g_free(void *);
void ssl_md5_info_delete(void *md5_info) { g_free(md5_info); }


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

x86 assembly (clang, -O2):
<ssl_md5_info_delete>:
jmp    1030 <g_free@plt>

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

LLVM IR (-O2):
define void @ssl_md5_info_delete(i8* %0) {
%2 = tail call i32 @g_free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ use(int *);
void foo(int n, int i) {
  int a[n];
  use(&a[i]);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <use@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,%rsp
movslq %esi,%rax
lea    (%rcx,%rax,4),%rdi
call   1030 <use@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
define void @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca i32, i64 %8
store i64 %8, i64* %6
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = call i32 @use(i32* %13)
%15 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = alloca i32, i64 %3
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %4, i64 %5
%7 = call i32 @use(i32* %6)
ret void
}
/* Type definitions */
struct eembed_log {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ eembed_sprintf_append(struct eembed_log *, char *);
void eembed_sprintf_append_eol(struct eembed_log *log) {
  eembed_sprintf_append(log, "\n");
}


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

x86 assembly (clang, -O2):
<eembed_sprintf_append_eol>:
lea    0xee9(%rip),%rsi
jmp    1030 <eembed_sprintf_append@plt>

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

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

/* Variables and functions */
int /*<<< orphan*/ strbuf_insert(struct strbuf *, int /*<<< orphan*/,
                                 char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void strbuf_setstr(struct strbuf *sb, const char *str) {
  strbuf_insert(sb, 0, str, strlen(str));
}


x86 assembly (clang, -O0):
<strbuf_setstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    %eax,%ecx
xor    %esi,%esi
call   1040 <strbuf_insert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strbuf_setstr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strbuf_insert@plt>

LLVM IR (-O0):
%struct.strbuf = type { i32 }
define void @strbuf_setstr(%struct.strbuf* %0, i8* %1) {
%3 = alloca %struct.strbuf*
%4 = alloca i8*
store %struct.strbuf* %0, %struct.strbuf** %3
store i8* %1, i8** %4
%5 = load %struct.strbuf*, %struct.strbuf** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @strbuf_insert(%struct.strbuf* %5, i32 0, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.strbuf = type { i32 }
define void @strbuf_setstr(%struct.strbuf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @strbuf_insert(%struct.strbuf* %0, i32 0, i8* %1, i32 %3)
ret void
}
void handler(int signum) {
  printf("\n %s: \n", __func__);
  printf("We have received signal :  %d \n", signum);
  sleep(10);
  printf(" exit from sighandler \n");
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1040 <sleep@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1050 <sleep@plt>
lea    0xec5(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__.handler = [8 x i8] c"handler\00"
@.str.1 = [32 x i8] c"We have received signal : %d \0A\00"
@.str.2 = [24 x i8] c" exit from sighandler \0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.handler, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 10)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0A %s: \0A\00"
@__func__.handler = [8 x i8] c"handler\00"
@.str.1 = [32 x i8] c"We have received signal : %d \0A\00"
@str = [23 x i8] c" exit from sighandler \00"
define void @handler(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__func__.handler, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void checkMallocFailure(void *ptr, char *message) {
  if (ptr == NULL) {
    printf("malloc for %s fail\n", message);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<checkMallocFailure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1159 <checkMallocFailure+0x39>
mov    -0x10(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkMallocFailure>:
test   %rdi,%rdi
je     1126 <checkMallocFailure+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"malloc for %s fail\0A\00"
@EXIT_FAILURE = global i32 0
define void @checkMallocFailure(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"malloc for %s fail\0A\00"
@EXIT_FAILURE = global i32 0
define void @checkMallocFailure(i8* readnone %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %2
ret void
}
int psh_exit(char **args) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @psh_exit(i8** nocapture readnone %0) {
ret i32 -1
}
void native_restore_fl(unsigned long flags) {
  asm volatile("push %0 ; popf" : : "g"(flags) : "memory", "cc");
}


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

x86 assembly (clang, -O2):
<native_restore_fl>:
mov    %rdi,-0x8(%rsp)
push   -0x8(%rsp)
popf
ret

LLVM IR (-O0):
define void @native_restore_fl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
ret void
}

LLVM IR (-O2):
define void @native_restore_fl(i64 %0) {
tail call void asm sideeffect "push $0 ; popf", "imr,~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
long long strtoll(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
void test7(char *array, char *endptr) {
  array[2] = 'z';
  long long r = strtoll(array + 2, NULL, 0);
  assert(r == 0);
}


x86 assembly (clang, -O0):
<test7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x7a,0x2(%rax)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test7>:
push   %rax
movb   $0x7a,0x2(%rdi)
add    $0x2,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <strtoll@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @test7(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** %3
%7 = getelementptr inbounds i8, i8* %6, i64 2
store i8 122, i8* %7
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = call i64 @strtoll(i8* %9, i32* null, i32 0)
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret void
}

LLVM IR (-O2):
define void @test7(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 2
store i8 122, i8* %3
%4 = tail call i64 @strtoll(i8* nocapture %3, i32* null, i32 0)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int write_dobldobl_target_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(232, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<write_dobldobl_target_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xe8,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_dobldobl_target_system>:
mov    $0xe8,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @write_dobldobl_target_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 232, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @write_dobldobl_target_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 232, i32* undef, i32* undef, double* undef)
ret i32 %1
}
int samecheck(char a[], int len, int j) {
  int i;
  for (i = 2; i < len; i++) {
    if (a[i] != j + '0')
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<samecheck>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115a <samecheck+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%ecx
add    $0x30,%ecx
cmp    %ecx,%eax
je     1147 <samecheck+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1161 <samecheck+0x61>
jmp    114c <samecheck+0x4c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <samecheck+0x15>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<samecheck>:
mov    $0x1,%eax
cmp    $0x3,%esi
jl     1131 <samecheck+0x31>
add    $0x30,%edx
mov    %esi,%r8d
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rdi,%rsi,1),%ecx
cmp    %ecx,%edx
jne    1132 <samecheck+0x32>
add    $0x1,%rsi
cmp    %rsi,%r8
jne    1120 <samecheck+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @samecheck(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 2
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = add nsw i32 %2, 48
%7 = zext i32 %1 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %16, %7
br i1 %9, label %17, label %10
10: ; preds = %5, %8
%11 = phi i64 [ 2, %5 ], [ %16, %8 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %6, %14
%16 = add nuw nsw i64 %11, 1
br i1 %15, label %8, label %17
17: ; preds = %10, %8, %3
%18 = phi i32 [ 1, %3 ], [ 1, %8 ], [ 0, %10 ]
ret i32 %18
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateLowBatSet(uint32_t ui32LowBatFlags) {
  ASSERT(!(ui32LowBatFlags & ~(0x00006000 | 0x000000A0)));
  (*((volatile uint32_t *)(0x400FC010))) =
      (ui32LowBatFlags |
       ((*((volatile uint32_t *)(0x400FC010))) & ~(0x00006000 | 0x000000A0)));
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateLowBatSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff9f5f,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%ecx
mov    $0x400fc010,%eax
mov    (%rax),%eax
and    $0xffff9f5f,%eax
or     %eax,%ecx
mov    $0x400fc010,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateLowBatSet>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
test   $0xffff9f5f,%ebx
sete   %dil
call   1040 <ASSERT@plt>
mov    $0xffff9f5f,%eax
and    0x400fc010,%eax
or     %ebx,%eax
mov    %eax,0x400fc010
xor    %eax,%eax
pop    %rbx
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateLowBatSet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -24737
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %2
%10 = load volatile i32, i32* inttoptr (i64 1074774032 to i32*)
%11 = and i32 %10, -24737
%12 = or i32 %9, %11
store volatile i32 %12, i32* inttoptr (i64 1074774032 to i32*)
%13 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateLowBatSet(i32 %0) {
%2 = and i32 %0, -24737
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = load volatile i32, i32* inttoptr (i64 1074774032 to i32*)
%7 = and i32 %6, -24737
%8 = or i32 %7, %0
store volatile i32 %8, i32* inttoptr (i64 1074774032 to i32*)
%9 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
int sec_box_ring_module_destroy(void) { return 0; }


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

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

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

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

/* Variables and functions */
void debug_msg(const char *fmt, va_list ap) {}


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

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

LLVM IR (-O0):
define void @debug_msg(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @debug_msg(i8* nocapture %0, i32 %1) {
ret void
}
long simple_hash(char *s) {
  long h = 1;
  do {
    h += (*s << 5) + *s;
  } while (*s++);
  return h;
}


x86 assembly (clang, -O0):
<simple_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
jne    1110 <simple_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_hash>:
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movsbq (%rdi),%rcx
mov    %rcx,%rdx
shl    $0x5,%rdx
add    %rcx,%rdx
add    %rdx,%rax
add    $0x1,%rdi
test   %rcx,%rcx
jne    1110 <simple_hash+0x10>
ret

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

LLVM IR (-O2):
define i64 @simple_hash(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %9, %2 ]
%4 = phi i64 [ 1, %1 ], [ %8, %2 ]
%5 = load i8, i8* %3
%6 = sext i8 %5 to i64
%7 = mul nsw i64 %6, 33
%8 = add nsw i64 %7, %4
%9 = getelementptr inbounds i8, i8* %3, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %2
11: ; preds = %2
ret i64 %8
}
__attribute__((no)) void foo1() {}


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

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

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

LLVM IR (-O2):
define void @foo1() {
ret void
}
int *max(int a, int b, int c) {
  int *m;
  if (a > b && a > c)
    m = &a;
  else if (b > a && b > c)
    m = &b;
  else
    m = &c;
  return m;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1132 <max+0x32>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1132 <max+0x32>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1164 <max+0x64>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    1157 <max+0x57>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1157 <max+0x57>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    115f <max+0x5f>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1164 <max+0x64>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
cmp    %edx,%esi
lea    -0x8(%rsp),%rcx
lea    -0xc(%rsp),%rax
cmovle %rax,%rcx
cmp    %edi,%esi
cmovle %rax,%rcx
cmp    %edx,%edi
lea    -0x4(%rsp),%rax
cmovle %rcx,%rax
cmp    %esi,%edi
cmovle %rcx,%rax
ret

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

LLVM IR (-O2):
define noalias i32* @max(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = icmp sgt i32 %0, %1
%8 = icmp sgt i32 %0, %2
%9 = and i1 %7, %8
%10 = icmp sgt i32 %1, %0
%11 = icmp sgt i32 %1, %2
%12 = and i1 %10, %11
%13 = select i1 %12, i32* %5, i32* %6
%14 = select i1 %9, i32* %4, i32* %13
ret i32* %14
}
/* Variables and functions */
int /*<<< orphan*/ __CrestInit();
void __globinit_function(void) {
  { __CrestInit(); }
}


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

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

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

LLVM IR (-O2):
define void @__globinit_function() {
%1 = tail call i32 (...) @__CrestInit()
ret void
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct fileinfo_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_shuffle(struct genlist *);
void fileinfo_list_shuffle(struct fileinfo_list *tthis) {
  genlist_shuffle((struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<fileinfo_list_shuffle>:
jmp    1030 <genlist_shuffle@plt>

LLVM IR (-O0):
%struct.fileinfo_list = type { i32 }
%struct.genlist = type { i32 }
define void @fileinfo_list_shuffle(%struct.fileinfo_list* %0) {
%2 = alloca %struct.fileinfo_list*
store %struct.fileinfo_list* %0, %struct.fileinfo_list** %2
%3 = load %struct.fileinfo_list*, %struct.fileinfo_list** %2
%4 = bitcast %struct.fileinfo_list* %3 to %struct.genlist*
%5 = call i32 @genlist_shuffle(%struct.genlist* %4)
ret void
}

LLVM IR (-O2):
%struct.fileinfo_list = type { i32 }
%struct.genlist = type { i32 }
define void @fileinfo_list_shuffle(%struct.fileinfo_list* %0) {
%2 = bitcast %struct.fileinfo_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_shuffle(%struct.genlist* %2)
ret void
}
void prog_abort() {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<prog_abort>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <prog_abort+0x9>
jmp    1109 <prog_abort+0x9>

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

LLVM IR (-O0):
define void @prog_abort() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @prog_abort() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Type definitions */
struct text_tag_list {
  int dummy;
};
struct genlist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_sort(struct genlist *,
                                int (*)(void const *, void const *));
void text_tag_list_sort(struct text_tag_list *tthis,
                        int (*compar)(const struct text_tag *const *,
                                      const struct text_tag *const *)) {
  genlist_sort(((struct genlist *)(tthis)),
               (int (*)(const void *, const void *))compar);
}


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

x86 assembly (clang, -O2):
<text_tag_list_sort>:
jmp    1030 <genlist_sort@plt>

LLVM IR (-O0):
%struct.text_tag_list = type { i32 }
%struct.text_tag = type opaque
%struct.genlist = type { i32 }
define void @text_tag_list_sort(%struct.text_tag_list* %0, i32 (%struct.text_tag**, %struct.text_tag**)* %1) {
%3 = alloca %struct.text_tag_list*
%4 = alloca i32 (%struct.text_tag**, %struct.text_tag**)*
store %struct.text_tag_list* %0, %struct.text_tag_list** %3
store i32 (%struct.text_tag**, %struct.text_tag**)* %1, i32 (%struct.text_tag**, %struct.text_tag**)** %4
%5 = load %struct.text_tag_list*, %struct.text_tag_list** %3
%6 = bitcast %struct.text_tag_list* %5 to %struct.genlist*
%7 = load i32 (%struct.text_tag**, %struct.text_tag**)*, i32 (%struct.text_tag**, %struct.text_tag**)** %4
%8 = bitcast i32 (%struct.text_tag**, %struct.text_tag**)* %7 to i32 (i8*, i8*)*
%9 = call i32 @genlist_sort(%struct.genlist* %6, i32 (i8*, i8*)* %8)
ret void
}

LLVM IR (-O2):
%struct.text_tag_list = type { i32 }
%struct.text_tag = type opaque
%struct.genlist = type { i32 }
define void @text_tag_list_sort(%struct.text_tag_list* %0, i32 (%struct.text_tag**, %struct.text_tag**)* %1) {
%3 = bitcast %struct.text_tag_list* %0 to %struct.genlist*
%4 = bitcast i32 (%struct.text_tag**, %struct.text_tag**)* %1 to i32 (i8*, i8*)*
%5 = tail call i32 @genlist_sort(%struct.genlist* %3, i32 (i8*, i8*)* %4)
ret void
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ unix_error(char *);
void Connect(int sockfd, struct sockaddr *serv_addr, int addrlen) {
  int n;
  if ((n = connect(sockfd, serv_addr, addrlen)) < 0)
    unix_error("connect error");
}


x86 assembly (clang, -O0):
<Connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <connect@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1159 <Connect+0x39>
lea    0xeac(%rip),%rdi
call   1030 <unix_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Connect>:
push   %rax
call   1040 <connect@plt>
test   %eax,%eax
js     112c <Connect+0xc>
pop    %rax
ret
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <unix_error@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [14 x i8] c"connect error\00"
define void @Connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load %struct.sockaddr*, %struct.sockaddr** %5
%10 = load i32, i32* %6
%11 = call i32 @connect(i32 %8, %struct.sockaddr* %9, i32 %10)
store i32 %11, i32* %7
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @unix_error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [14 x i8] c"connect error\00"
define void @Connect(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i32 @connect(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @unix_error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int sqrt(double);
double functionTest3(double x) { return x * x + x - 2 * sqrt(x); }


x86 assembly (clang, -O0):
<functionTest3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  -0x10(%rbp),%xmm0
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<functionTest3>:
push   %rax
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <sqrt@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
subsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @functionTest3(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = call double @llvm.fmuladd.f64(double %3, double %4, double %5)
%7 = load double, double* %2
%8 = call i32 @sqrt(double %7)
%9 = mul nsw i32 2, %8
%10 = sitofp i32 %9 to double
%11 = fsub double %6, %10
ret double %11
}

LLVM IR (-O2):
define double @functionTest3(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %0)
%3 = tail call i32 @sqrt(double %0)
%4 = shl nsw i32 %3, 1
%5 = sitofp i32 %4 to double
%6 = fsub double %2, %5
ret double %6
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_int4func1(void) { return GppcFinfoV1(); }


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

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

LLVM IR (-O0):
define i8* @pg_finfo_int4func1() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_int4func1() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  while (1) {
    int value = getchar();
    printf("You entered '%c'\n", (char)value);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
lea    0xebd(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
@.str = [18 x i8] c"You entered '%c'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = trunc i32 %5 to i8
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %6)
br label %3
}

LLVM IR (-O2):
@.str = [18 x i8] c"You entered '%c'\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @getchar()
%3 = trunc i32 %2 to i8
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %3)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int k;
  for (k = 0; k <= 255; k++) {
    printf(" %d , %c \n", k, k);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jg     1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c" %d , %c \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 = %10, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 255
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c" %d , %c \0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ net_send(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *,
                            char *);
void irc_kick(char *channel, char *nick, char *message) {
  char msg[(512 - 3)];
  snprintf(msg, (512 - 3), "%s %s %s :%s", "KICK", channel, nick, message);
  net_send(msg);
}


x86 assembly (clang, -O0):
<irc_kick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x18(%rbp),%rax
mov    $0x1fd,%esi
lea    0xeaa(%rip),%rdx
lea    0xeb0(%rip),%rcx
mov    %rax,(%rsp)
call   1030 <snprintf@plt>
lea    -0x220(%rbp),%rdi
call   1040 <net_send@plt>
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_kick>:
push   %rbx
sub    $0x210,%rsp
mov    %rsi,%r9
mov    %rdi,%r8
mov    %rdx,(%rsp)
lea    0xec7(%rip),%rdx
lea    0xecd(%rip),%rcx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1fd,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <net_send@plt>
add    $0x210,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%s %s %s :%s\00"
@.str.1 = [5 x i8] c"KICK\00"
define void @irc_kick(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [509 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [509 x i8], [509 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @snprintf(i8* %8, i32 509, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%13 = getelementptr inbounds [509 x i8], [509 x i8]* %7, i64 0, i64 0
%14 = call i32 @net_send(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s %s %s :%s\00"
@.str.1 = [5 x i8] c"KICK\00"
define void @irc_kick(i8* %0, i8* %1, i8* %2) {
%4 = alloca [509 x i8]
%5 = getelementptr inbounds [509 x i8], [509 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 509, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%7 = call i32 @net_send(i8* %5)
ret void
}