xunge/DecIR huggingface dataset:
void sgx_thread_setwait_untrusted_events_ocall() {}


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

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

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

LLVM IR (-O2):
define void @sgx_thread_setwait_untrusted_events_ocall() {
ret void
}
void serv_handle_error() {}


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

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

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

LLVM IR (-O2):
define void @serv_handle_error() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  fprintf(stdout, "%d\n", (int)sizeof(long));
  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)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
mov    $0x8,%edx
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
mov    $0x8,%edx
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\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 = load i32, i32* @stdout
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int countLines(FILE *f) {
  int lines = 1;
  int c;
  while ((c = getc(f)) != EOF)
    if (c == '\n')
      ++lines;
  rewind(f);
  return lines;
}


x86 assembly (clang, -O0):
<countLines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getc@plt>
mov    %eax,-0x10(%rbp)
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%eax
je     1166 <countLines+0x46>
cmpl   $0xa,-0x10(%rbp)
jne    1161 <countLines+0x41>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <countLines+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countLines>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <getc@plt>
mov    0x2eb5(%rip),%r14
mov    $0x1,%ebp
cmp    (%r14),%eax
je     1167 <countLines+0x47>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebp
mov    %rbx,%rdi
call   1040 <getc@plt>
cmp    (%r14),%eax
jne    1150 <countLines+0x30>
mov    %rbx,%rdi
call   1030 <rewind@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @countLines(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %14, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %11, %5 ], [ %2, %1 ]
%7 = phi i32 [ %10, %5 ], [ 1, %1 ]
%8 = icmp eq i32 %6, 10
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %7, %9
%11 = tail call i32 @getc(i32* %0)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %5
14: ; preds = %5, %1
%15 = phi i32 [ 1, %1 ], [ %10, %5 ]
%16 = tail call i32 @rewind(i32* %0)
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ LABELED();
void test_goto() {
  goto L;
L:
  LABELED();
}


x86 assembly (clang, -O0):
<test_goto>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <test_goto+0x9>
mov    $0x0,%al
call   1030 <LABELED@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_goto() {
br label %1
1: ; preds = %0
%2 = call i32 (...) @LABELED()
ret void
}

LLVM IR (-O2):
define void @test_goto() {
%1 = tail call i32 (...) @LABELED()
ret void
}
float VCUtils_MinF(float a, float b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<VCUtils_MinF>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <VCUtils_MinF+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <VCUtils_MinF+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<VCUtils_MinF>:
minss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @VCUtils_MinF(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @VCUtils_MinF(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int strcmp(char *, char *);
int mycompar(const void *p1, const void *p2) {
  char **str1, **str2;
  str1 = (char **)p1;
  str2 = (char **)p2;
  return strcmp(*str1, *str2);
}


x86 assembly (clang, -O0):
<mycompar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @mycompar(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
int main(void) {
  enum {
    LOL = 1,
  } a;
  a = LOL;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Type definitions */
typedef unsigned char uint32_t;
typedef unsigned char int32_t;

/* Variables and functions */
uint32_t getuint32le(unsigned char *buf) {
  int32_t res = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
  return res;
}


x86 assembly (clang, -O0):
<getuint32le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
or     %ecx,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getuint32le>:
mov    (%rdi),%al
ret

LLVM IR (-O0):
define zeroext i8 @getuint32le(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 3
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl i32 %7, 24
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 16
%14 = or i32 %8, %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = or i32 %14, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = or i32 %20, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %3
%27 = load i8, i8* %3
ret i8 %27
}

LLVM IR (-O2):
define zeroext i8 @getuint32le(i8* nocapture %0) {
%2 = load i8, i8* %0
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ check_report(int, char const *, int);
int /*<<< orphan*/ printf(char *, char const *, char const *, int);
__attribute__((hcos_noinstrument)) void
__entry_hook(const char *func, const char *filename, int lineno) {
  printf("Entry hook: %s at %s:%d\n", func, filename, lineno);
  check_report(1, func, lineno);
}


x86 assembly (clang, -O0):
<__entry_hook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x1,%edi
call   1040 <check_report@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__entry_hook>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%ecx
call   1030 <printf@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <check_report@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Entry hook: %s at %s:%d\0A\00"
define void @__entry_hook(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i32 %9)
%11 = load i8*, i8** %4
%12 = load i32, i32* %6
%13 = call i32 @check_report(i32 1, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Entry hook: %s at %s:%d\0A\00"
define void @__entry_hook(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2)
%5 = tail call i32 @check_report(i32 1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ local_flush_tlb();
int /*<<< orphan*/ outb(int, int);
scalar_t__ phys_to_virt(int);
void smpboot_restore_warm_reset_vector(void) {
  local_flush_tlb();
  outb(0x0f, 0x37);
  *((volatile long *)phys_to_virt(0x404)) = 0;
}


x86 assembly (clang, -O0):
<smpboot_restore_warm_reset_vector>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <local_flush_tlb@plt>
mov    $0xf,%edi
mov    $0x37,%esi
call   1040 <outb@plt>
mov    $0x404,%edi
call   1030 <phys_to_virt@plt>
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpboot_restore_warm_reset_vector>:
push   %rax
xor    %eax,%eax
call   1050 <local_flush_tlb@plt>
mov    $0xf,%edi
mov    $0x37,%esi
call   1040 <outb@plt>
mov    $0x404,%edi
call   1030 <phys_to_virt@plt>
movq   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @smpboot_restore_warm_reset_vector() {
%1 = call i32 (...) @local_flush_tlb()
%2 = call i32 @outb(i32 15, i32 55)
%3 = call i64 @phys_to_virt(i32 1028)
%4 = inttoptr i64 %3 to i64*
store volatile i64 0, i64* %4
ret void
}

LLVM IR (-O2):
define void @smpboot_restore_warm_reset_vector() {
%1 = tail call i32 (...) @local_flush_tlb()
%2 = tail call i32 @outb(i32 15, i32 55)
%3 = tail call i64 @phys_to_virt(i32 1028)
%4 = inttoptr i64 %3 to i64*
store volatile i64 0, i64* %4
ret void
}
const char *f2() { return "set"; }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"set\00"
define i8* @f2() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"set\00"
define i8* @f2() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
void relay_network_set_ssl_cert_key(int verbose) { (void)verbose; }


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

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

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

LLVM IR (-O2):
define void @relay_network_set_ssl_cert_key(i32 %0) {
ret void
}
void watchdog_reload(void) {}


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

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

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

LLVM IR (-O2):
define void @watchdog_reload() {
ret void
}
/* Variables and functions */
char *marker_string_prepend(char const *, char const *, char *, size_t);
char *marker_string_append(const char *str, const char *addition, char *buffer,
                           size_t buffer_size) {
  return marker_string_prepend(addition, str, buffer, buffer_size);
}


x86 assembly (clang, -O0):
<marker_string_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <marker_string_prepend@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<marker_string_append>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <marker_string_prepend@plt>

LLVM IR (-O0):
define i8* @marker_string_append(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = load i8*, i8** %7
%12 = load i64, i64* %8
%13 = call i8* @marker_string_prepend(i8* %9, i8* %10, i8* %11, i64 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @marker_string_append(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i8* @marker_string_prepend(i8* %1, i8* %0, i8* %2, i64 %3)
ret i8* %5
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct entry_list {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_copy(struct genlist const *);
struct entry_list *entry_list_copy(const struct entry_list *tthis) {
  return (struct entry_list *)genlist_copy((const struct genlist *)tthis);
}


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

x86 assembly (clang, -O2):
<entry_list_copy>:
jmp    1030 <genlist_copy@plt>

LLVM IR (-O0):
%struct.entry_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.entry_list* @entry_list_copy(%struct.entry_list* %0) {
%2 = alloca %struct.entry_list*
store %struct.entry_list* %0, %struct.entry_list** %2
%3 = load %struct.entry_list*, %struct.entry_list** %2
%4 = bitcast %struct.entry_list* %3 to %struct.genlist*
%5 = call i64 @genlist_copy(%struct.genlist* %4)
%6 = inttoptr i64 %5 to %struct.entry_list*
ret %struct.entry_list* %6
}

LLVM IR (-O2):
%struct.entry_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.entry_list* @entry_list_copy(%struct.entry_list* %0) {
%2 = bitcast %struct.entry_list* %0 to %struct.genlist*
%3 = tail call i64 @genlist_copy(%struct.genlist* %2)
%4 = inttoptr i64 %3 to %struct.entry_list*
ret %struct.entry_list* %4
}
/* Variables and functions */
size_t strlen(char *);
char *strncat(char *, char const *, size_t);
char *idhash_strncat(char *dest, size_t dest_size, char const *src,
                     size_t count) {
  return strlen(dest) + count + 1 <= dest_size ? strncat(dest, src, count)
                                               : NULL;
}


x86 assembly (clang, -O0):
<idhash_strncat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x20(%rbp),%rax
add    $0x1,%rax
cmp    -0x10(%rbp),%rax
ja     116d <idhash_strncat+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <strncat@plt>
mov    %rax,-0x28(%rbp)
jmp    1178 <idhash_strncat+0x58>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1178 <idhash_strncat+0x58>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<idhash_strncat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1030 <strlen@plt>
add    %r14,%rax
add    $0x1,%rax
cmp    %r12,%rax
jbe    1149 <idhash_strncat+0x29>
xor    %ebx,%ebx
jmp    1157 <idhash_strncat+0x37>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <strncat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @idhash_strncat(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
%11 = load i64, i64* %8
%12 = add i64 %10, %11
%13 = add i64 %12, 1
%14 = load i64, i64* %6
%15 = icmp ule i64 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %4
%17 = load i8*, i8** %5
%18 = load i8*, i8** %7
%19 = load i64, i64* %8
%20 = call i8* @strncat(i8* %17, i8* %18, i64 %19)
br label %22
21: ; preds = %4
br label %22
22: ; preds = %21, %16
%23 = phi i8* [ %20, %16 ], [ null, %21 ]
ret i8* %23
}

LLVM IR (-O2):
define i8* @idhash_strncat(i8* %0, i64 %1, i8* nocapture %2, i64 %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add i64 %3, 1
%7 = add i64 %6, %5
%8 = icmp ugt i64 %7, %1
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i8* @strncat(i8* dereferenceable(1) %0, i8* %2, i64 %3)
br label %11
11: ; preds = %4, %9
%12 = phi i8* [ %0, %9 ], [ null, %4 ]
ret i8* %12
}
int equal_int(void *ip, void *jp) { return (int *)ip == (int *)jp; }


x86 assembly (clang, -O0):
<equal_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_int>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @equal_int(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 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to i32*
%9 = icmp eq i32* %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @equal_int(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *getenv(char *);
char *safe_strdup(char *);
char *safe_getenv(char *env, char *def) {
  char *t;
  if ((t = getenv(env)) != NULL)
    def = t;
  return safe_strdup(def);
}


x86 assembly (clang, -O0):
<safe_getenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     114f <safe_getenv+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <safe_strdup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_getenv>:
push   %rbx
mov    %rsi,%rbx
call   1030 <getenv@plt>
test   %rax,%rax
cmovne %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <safe_strdup@plt>

LLVM IR (-O0):
define i8* @safe_getenv(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i8* @getenv(i8* %6)
store i8* %7, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i8*, i8** %5
store i8* %10, i8** %4
br label %11
11: ; preds = %9, %2
%12 = load i8*, i8** %4
%13 = call i8* @safe_strdup(i8* %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @safe_getenv(i8* nocapture %0, i8* %1) {
%3 = tail call i8* @getenv(i8* %0)
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* %1, i8* %3
%6 = tail call i8* @safe_strdup(i8* %5)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void printUsage() {
  fprintf(stderr, "Wrong usage of this utility.\n Right format is: uSAPI -b "
                  "<byte_array> -p <devname> [-r <number_of_waiting "
                  "responces>] [--callback] [--debug]\n");
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printUsage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [141 x i8] c"Wrong usage of this utility.\0A Right format is: uSAPI -b <byte_array> -p <devname> [-r <number_of_waiting responces>] [--callback] [--debug]\0A\00"
define void @printUsage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [141 x i8] c"Wrong usage of this utility.\0A Right format is: uSAPI -b <byte_array> -p <devname> [-r <number_of_waiting responces>] [--callback] [--debug]\0A\00"
define void @printUsage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0))
ret void
}
float nvg__triarea2(float ax, float ay, float bx, float by, float cx,
                    float cy) {
  float abx = bx - ax;
  float aby = by - ay;
  float acx = cx - ax;
  float acy = cy - ay;
  return acx * aby - abx * acy;
}


x86 assembly (clang, -O0):
<nvg__triarea2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x1c(%rbp),%xmm1
mulss  -0x28(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvg__triarea2>:
subss  %xmm0,%xmm2
subss  %xmm1,%xmm3
subss  %xmm0,%xmm4
mulss  %xmm3,%xmm4
subss  %xmm1,%xmm5
mulss  %xmm2,%xmm5
subss  %xmm5,%xmm4
movaps %xmm4,%xmm0
ret

LLVM IR (-O0):
define float @nvg__triarea2(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%17 = load float, float* %9
%18 = load float, float* %7
%19 = fsub float %17, %18
store float %19, float* %13
%20 = load float, float* %10
%21 = load float, float* %8
%22 = fsub float %20, %21
store float %22, float* %14
%23 = load float, float* %11
%24 = load float, float* %7
%25 = fsub float %23, %24
store float %25, float* %15
%26 = load float, float* %12
%27 = load float, float* %8
%28 = fsub float %26, %27
store float %28, float* %16
%29 = load float, float* %15
%30 = load float, float* %14
%31 = load float, float* %13
%32 = load float, float* %16
%33 = fmul float %31, %32
%34 = fneg float %33
%35 = call float @llvm.fmuladd.f32(float %29, float %30, float %34)
ret float %35
}

LLVM IR (-O2):
define float @nvg__triarea2(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = fsub float %2, %0
%8 = fsub float %3, %1
%9 = fsub float %4, %0
%10 = fsub float %5, %1
%11 = fneg float %7
%12 = fmul float %10, %11
%13 = tail call float @llvm.fmuladd.f32(float %9, float %8, float %12)
ret float %13
}
/* Variables and functions */
char *getenv(char *);
const char *conf_get_configname(void) {
  char *name = getenv("KCONFIG_CONFIG");
  return name ? name : "config";
}


x86 assembly (clang, -O0):
<conf_get_configname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1140 <conf_get_configname+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1150 <conf_get_configname+0x40>
lea    0xec8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1150 <conf_get_configname+0x40>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_get_configname>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xee8(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"KCONFIG_CONFIG\00"
@.str.1 = [7 x i8] c"config\00"
define i8* @conf_get_configname() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i8*, i8** %1
br label %8
7: ; preds = %0
br label %8
8: ; preds = %7, %5
%9 = phi i8* [ %6, %5 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %7 ]
ret i8* %9
}

LLVM IR (-O2):
@.str = [15 x i8] c"KCONFIG_CONFIG\00"
@.str.1 = [7 x i8] c"config\00"
define i8* @conf_get_configname() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int do_cls(int argc, char **argv) {
  printf("\033[1;1H");
  for (int i = 0; i < 8 * 24; i++) {
    printf("          ");
  }
  printf("\033[1;1H");
  return 0;
}


x86 assembly (clang, -O0):
<do_cls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xc0,-0x14(%rbp)
jge    1159 <do_cls+0x49>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <do_cls+0x22>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cls>:
push   %rbp
push   %rbx
push   %rax
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    $0xc0,%ebp
lea    0xedc(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <do_cls+0x20>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"\1B[1;1H\00"
@.str.1 = [11 x i8] c" \00"
define i32 @do_cls(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %6
4: ; preds = %6
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
6: ; preds = %2, %6
%7 = phi i32 [ 0, %2 ], [ %9, %6 ]
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, 192
br i1 %10, label %4, label %6
}
/* Variables and functions */
int columns;
int tty_columns() { return columns; }


x86 assembly (clang, -O0):
<tty_columns>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tty_columns>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@columns = global i32 0
define i32 @tty_columns() {
%1 = load i32, i32* @columns
ret i32 %1
}

LLVM IR (-O2):
@columns = global i32 0
define i32 @tty_columns() {
%1 = load i32, i32* @columns
ret i32 %1
}
/* Variables and functions */
int execvp(char const *, char **);
int /*<<< orphan*/ g_mk_temp_dir(int /*<<< orphan*/);
int /*<<< orphan*/ g_rm_temp_dir();
int g_execvp(const char *p1, char *args[]) {
  int rv;
  g_rm_temp_dir();
  rv = execvp(p1, args);
  g_mk_temp_dir(0);
  return rv;
}


x86 assembly (clang, -O0):
<g_execvp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <g_rm_temp_dir@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <execvp@plt>
mov    %eax,-0x14(%rbp)
xor    %edi,%edi
call   1050 <g_mk_temp_dir@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_execvp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <g_rm_temp_dir@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <execvp@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1050 <g_mk_temp_dir@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @g_execvp(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
store i8* %0, i8** %3
store i8** %1, i8*** %4
%6 = call i32 (...) @g_rm_temp_dir()
%7 = load i8*, i8** %3
%8 = load i8**, i8*** %4
%9 = call i32 @execvp(i8* %7, i8** %8)
store i32 %9, i32* %5
%10 = call i32 @g_mk_temp_dir(i32 0)
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @g_execvp(i8* %0, i8** %1) {
%3 = tail call i32 (...) @g_rm_temp_dir()
%4 = tail call i32 @execvp(i8* %0, i8** %1)
%5 = tail call i32 @g_mk_temp_dir(i32 0)
ret i32 %4
}
void GET_PROMPT_BTS(s, t) int *s;
char *t;
{
  puts((char *)t);
  GET_BTS(s);
}


x86 assembly (clang, -O0):
<GET_PROMPT_BTS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <GET_BTS@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GET_PROMPT_BTS>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <GET_BTS@plt>

LLVM IR (-O0):
define void @GET_PROMPT_BTS(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %5)
%7 = load i32*, i32** %3
%8 = call i32 (i32*, ...) bitcast (i32 (...)* @GET_BTS to i32 (i32*, ...)*)(i32* %7)
ret void
}

LLVM IR (-O2):
define void @GET_PROMPT_BTS(i32* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %1)
%4 = tail call i32 (i32*, ...) bitcast (i32 (...)* @GET_BTS to i32 (i32*, ...)*)(i32* %0)
ret void
}
void _sys_memset32(void *dest, const char src, unsigned int count) {
  asm volatile("pushf				\n"
               "cld				\n"
               "movb	%0, %%al	\n"
               "movl	%1, %%ecx	\n"
               "movl	%2, %%edi	\n"
               "rep				\n"
               "stosb				\n"
               "popf				\n"
               :
               : "m"(src), "m"(count), "m"(dest)
               : "%al", "%ecx", "%edi");
}


x86 assembly (clang, -O0):
<_sys_memset32>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
pushf
cld
mov    -0x9(%rbp),%al
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%edi
rep stos %al,%es:(%rdi)
popf
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sys_memset32>:
mov    %rdi,-0x8(%rsp)
mov    %sil,-0xd(%rsp)
mov    %edx,-0xc(%rsp)
pushf
cld
mov    -0xd(%rsp),%al
mov    -0xc(%rsp),%ecx
mov    -0x8(%rsp),%edi
rep stos %al,%es:(%rdi)
popf
ret

LLVM IR (-O0):
define void @_sys_memset32(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @_sys_memset32(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("usage:\n\n  trixd00r -h <arg> [options]\n    \noptions:\n\n  -h "
         "<host>     - trixd00rd host\n  -t <type>     - magic packet - ? to "
         "list all (default TCP SYN)\n  -s <mode>     - shell mode - ? to list "
         "all (default TCP connect)\n  -m <string>   - magic payload (default "
         "opensesame)\n  -p <port>     - port to connect or listen (default "
         "31337)\n  -v            - verbose mode (default quiet)\n  -V         "
         "   - show trixd00r version\n  -H            - show help and usage\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [457 x i8] c"usage:\0A\0A trixd00r -h <arg> [options]\0A \0Aoptions:\0A\0A -h <host> - trixd00rd host\0A -t <type> - magic packet - ? to list all (default TCP SYN)\0A -s <mode> - shell mode - ? to list all (default TCP connect)\0A -m <string> - magic payload (default opensesame)\0A -p <port> - port to connect or listen (default 31337)\0A -v - verbose mode (default quiet)\0A -V - show trixd00r version\0A -H - show help and usage\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([457 x i8], [457 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [456 x i8] c"usage:\0A\0A trixd00r -h <arg> [options]\0A \0Aoptions:\0A\0A -h <host> - trixd00rd host\0A -t <type> - magic packet - ? to list all (default TCP SYN)\0A -s <mode> - shell mode - ? to list all (default TCP connect)\0A -m <string> - magic payload (default opensesame)\0A -p <port> - port to connect or listen (default 31337)\0A -v - verbose mode (default quiet)\0A -V - show trixd00r version\0A -H - show help and usage\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([456 x i8], [456 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ chdir(char const *);
int /*<<< orphan*/ die(char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void xchdir(const char *path) {
  if (chdir(path) != 0) {
    die("chdir to `%s' failed: %s\n", path, strerror(errno));
  }
}


x86 assembly (clang, -O0):
<xchdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <chdir@plt>
cmp    $0x0,%rax
je     1177 <xchdir+0x47>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xe8e(%rip),%rdi
call   1040 <die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xchdir>:
push   %rbx
mov    %rdi,%rbx
call   1030 <chdir@plt>
test   %rax,%rax
je     115e <xchdir+0x2e>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xead(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1040 <die@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"chdir to `%s' failed: %s\0A\00"
@errno = global i32 0
define void @xchdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @chdir(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i32, i32* @errno
%9 = call i32 @strerror(i32 %8)
%10 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
br label %11
11: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"chdir to `%s' failed: %s\0A\00"
@errno = global i32 0
define void @xchdir(i8* %0) {
%2 = tail call i64 @chdir(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @strerror(i32 %5)
%7 = tail call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6)
br label %8
8: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test();
int /*<<< orphan*/ testf();
int /*<<< orphan*/ testl();
int main() {
  testf();
  test();
  testl();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <testf@plt>
mov    $0x0,%al
call   1050 <test@plt>
mov    $0x0,%al
call   1040 <testl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <testf@plt>
xor    %eax,%eax
call   1050 <test@plt>
xor    %eax,%eax
call   1040 <testl@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @testf()
%3 = call i32 (...) @test()
%4 = call i32 (...) @testl()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @testf()
%2 = tail call i32 (...) @test()
%3 = tail call i32 (...) @testl()
ret i32 0
}
void extend_box(struct box *pbox) { return; }


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

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

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

LLVM IR (-O2):
%struct.box = type opaque
define void @extend_box(%struct.box* nocapture %0) {
ret void
}
unsigned xrop3_224_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D | S;
  stk1 = T & stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_224_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_224_1_0>:
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
mov    %edi,%eax
xor    $0xff,%eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_224_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %7
%26 = load i32, i32* %9
%27 = and i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = xor i32 %29, -1
%31 = and i32 %28, %30
%32 = load i32, i32* %5
%33 = load i32, i32* %6
%34 = and i32 %32, %33
%35 = or i32 %31, %34
ret i32 %35
}

LLVM IR (-O2):
define i32 @xrop3_224_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = zext i8 %1 to i32
%5 = mul nuw nsw i32 %4, 257
%6 = xor i32 %3, 255
%7 = and i32 %6, %5
%8 = or i32 %7, %3
ret i32 %8
}
int default_gap(char x) { return 2; }


x86 assembly (clang, -O0):
<default_gap>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x2,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @default_gap(i8 signext %0) {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  setuid(0);
  system("python ./proximity.py");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"python ./proximity.py\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 0)
%3 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"python ./proximity.py\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *calloc(int count, int size) {
  void *ret = malloc(count * size);
  memset(ret, 0, (count * size));
  return ret;
}


x86 assembly (clang, -O0):
<calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x8(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
imul   -0x8(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
imul   %esi,%ebx
mov    %ebx,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @calloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = call i32 @memset(i8* %10, i32 0, i32 %13)
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
define i8* @calloc(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memset(i8* %4, i32 0, i32 %3)
ret i8* %4
}
int abs(int n) { return (n < 0) ? -n : n; }


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <abs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}