xunge/DecIR huggingface dataset:
int min(int x, int y) { return (x > y) ? y : x; }


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

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

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

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int just_check_status(unsigned char *);
int op_raw_write_recv(unsigned char *packet) {
  return just_check_status(packet);
}


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

x86 assembly (clang, -O2):
<op_raw_write_recv>:
jmp    1030 <just_check_status@plt>

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

LLVM IR (-O2):
define i32 @op_raw_write_recv(i8* %0) {
%2 = tail call i32 @just_check_status(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ kmain();
void _start(void) { kmain(); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ INIT_LIST_HEAD(struct list_head *);
int /*<<< orphan*/ list_replace(struct list_head *, struct list_head *);
void list_replace_init(struct list_head *old, struct list_head *newe) {
  list_replace(old, newe);
  INIT_LIST_HEAD(old);
}


x86 assembly (clang, -O0):
<list_replace_init>:
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   1040 <list_replace@plt>
mov    -0x8(%rbp),%rdi
call   1030 <INIT_LIST_HEAD@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_replace_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <list_replace@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <INIT_LIST_HEAD@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = load %struct.list_head*, %struct.list_head** %4
%7 = call i32 @list_replace(%struct.list_head* %5, %struct.list_head* %6)
%8 = load %struct.list_head*, %struct.list_head** %3
%9 = call i32 @INIT_LIST_HEAD(%struct.list_head* %8)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_replace(%struct.list_head* %0, %struct.list_head* %1)
%4 = tail call i32 @INIT_LIST_HEAD(%struct.list_head* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __u32;
typedef int /*<<< orphan*/ __be32;

/* Variables and functions */
int /*<<< orphan*/ __swab32p(int /*<<< orphan*/ *);
__u32 __be32_to_cpup(const __be32 *p) { return __swab32p((__u32 *)p); }


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

x86 assembly (clang, -O2):
<__be32_to_cpup>:
jmp    1030 <__swab32p@plt>

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

LLVM IR (-O2):
define i32 @__be32_to_cpup(i32* %0) {
%2 = tail call i32 @__swab32p(i32* %0)
ret i32 %2
}
void rct_set_aud_ctrl2_reg(void) {}


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

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

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

LLVM IR (-O2):
define void @rct_set_aud_ctrl2_reg() {
ret void
}
int opponent(char player) { return (player == 'x') ? 'o' : 'x'; }


x86 assembly (clang, -O0):
<opponent>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
mov    $0x78,%eax
mov    $0x6f,%ecx
cmp    $0x78,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opponent>:
xor    %eax,%eax
cmp    $0x78,%dil
setne  %al
lea    (%rax,%rax,8),%eax
add    $0x6f,%eax
ret

LLVM IR (-O0):
define i32 @opponent(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 120
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 111, i32 120
ret i32 %7
}

LLVM IR (-O2):
define i32 @opponent(i8 signext %0) {
%2 = icmp eq i8 %0, 120
%3 = select i1 %2, i32 111, i32 120
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void prthlp(void) {
  printf("Option-catching test program. First two arguments are, however, "
         "ignored.\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [74 x i8] c"Option-catching test program. First two arguments are, however, ignored.\0A\00"
define void @prthlp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [73 x i8] c"Option-catching test program. First two arguments are, however, ignored.\00"
define void @prthlp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
ret void
}
int increment(int nr) { return nr + 1; }


x86 assembly (clang, -O0):
<increment>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment>:
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @increment(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ OS_TaskRegister();
void task_18(void) {
  OS_TaskRegister();
  while (1)
    ;
  return;
}


x86 assembly (clang, -O0):
<task_18>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <OS_TaskRegister@plt>
jmp    111b <task_18+0xb>

x86 assembly (clang, -O2):
<task_18>:
push   %rax
xor    %eax,%eax
call   1030 <OS_TaskRegister@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <task_18+0x10>

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

LLVM IR (-O2):
define void @task_18() {
%1 = tail call i32 (...) @OS_TaskRegister()
br label %2
2: ; preds = %0, %2
br label %2
}
int Bematech_FI_NumeroSerie(Var, Retorno) {
  return Formata("\x1b|35|00|\x1b", Var, Retorno);
}


x86 assembly (clang, -O0):
<Bematech_FI_NumeroSerie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <Formata@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bematech_FI_NumeroSerie>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <Formata@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\1B|35|00|\1B\00"
define i32 @Bematech_FI_NumeroSerie(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"\1B|35|00|\1B\00"
define i32 @Bematech_FI_NumeroSerie(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ushort;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, long);
void copy_usvector(ushort *src, long nl1, long nh1, ushort *dst, long nl2,
                   long nh2) {
  long len = nh1 - nl1 + 1;
  static long size = sizeof(ushort);
  memcpy(dst + nl2, src + nl1, len * size);
}


x86 assembly (clang, -O0):
<copy_usvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x38(%rbp),%rdx
imul   0x2ebe(%rip),%rdx
call   1030 <memcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_usvector>:
sub    %rsi,%rdx
lea    (%rcx,%r8,4),%rax
lea    (%rdi,%rsi,4),%rsi
lea    0x4(,%rdx,4),%rdx
mov    %rax,%rdi
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
@copy_usvector.size = internal global i64 4
define void @copy_usvector(i32* %0, i64 %1, i64 %2, i32* %3, i64 %4, i64 %5) {
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
store i32* %0, i32** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i32* %3, i32** %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%14 = load i64, i64* %9
%15 = load i64, i64* %8
%16 = sub nsw i64 %14, %15
%17 = add nsw i64 %16, 1
store i64 %17, i64* %13
%18 = load i32*, i32** %10
%19 = load i64, i64* %11
%20 = getelementptr inbounds i32, i32* %18, i64 %19
%21 = load i32*, i32** %7
%22 = load i64, i64* %8
%23 = getelementptr inbounds i32, i32* %21, i64 %22
%24 = load i64, i64* %13
%25 = load i64, i64* @copy_usvector.size
%26 = mul nsw i64 %24, %25
%27 = call i32 @memcpy(i32* %20, i32* %23, i64 %26)
ret void
}

LLVM IR (-O2):
define void @copy_usvector(i32* %0, i64 %1, i64 %2, i32* %3, i64 %4, i64 %5) {
%7 = sub nsw i64 %2, %1
%8 = getelementptr inbounds i32, i32* %3, i64 %4
%9 = getelementptr inbounds i32, i32* %0, i64 %1
%10 = shl i64 %7, 2
%11 = add i64 %10, 4
%12 = tail call i32 @memcpy(i32* %8, i32* %9, i64 %11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PrintErrorCode();
int dxl_read_byte(int, int);
int getCurrentTemperature(int Id) {
  int CurrentTemp;
  CurrentTemp = dxl_read_byte(Id, 43);
  PrintErrorCode();
  return CurrentTemp;
}


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

x86 assembly (clang, -O2):
<getCurrentTemperature>:
push   %rbx
mov    $0x2b,%esi
call   1040 <dxl_read_byte@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <PrintErrorCode@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getCurrentTemperature(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dxl_read_byte(i32 %4, i32 43)
store i32 %5, i32* %3
%6 = call i32 (...) @PrintErrorCode()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @getCurrentTemperature(i32 %0) {
%2 = tail call i32 @dxl_read_byte(i32 %0, i32 43)
%3 = tail call i32 (...) @PrintErrorCode()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_arr(int ar_size, int *ar) {
  for (int loop = 0; loop < ar_size; loop++) {
    printf("%d ", ar[loop]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1159 <print_arr+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <print_arr+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1157 <print_arr+0x37>
mov    %rsi,%r15
mov    %edi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_arr+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_arr(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %1, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
const char test1_strings_ok(int x) {
  const char *mystr = "mary had a little lamb";
  return mystr[5];
}


x86 assembly (clang, -O0):
<test1_strings_ok>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1_strings_ok>:
mov    $0x68,%al
ret

LLVM IR (-O0):
@.str = [23 x i8] c"mary had a little lamb\00"
define signext i8 @test1_strings_ok(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 5
%6 = load i8, i8* %5
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @test1_strings_ok(i32 %0) {
ret i8 104
}
/* Type definitions */
typedef int /*<<< orphan*/ val;
typedef int /*<<< orphan*/ uint8_t;
struct pkt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *pkt_put(struct pkt *, int);
void pkt_put_u8(struct pkt *p, uint8_t val) {
  uint8_t *data = pkt_put(p, sizeof(val));
  memcpy(data, &val, sizeof(uint8_t));
}


x86 assembly (clang, -O0):
<pkt_put_u8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1040 <pkt_put@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkt_put_u8>:
push   %rax
mov    %esi,0x4(%rsp)
mov    $0x4,%esi
call   1040 <pkt_put@plt>
lea    0x4(%rsp),%rsi
mov    %rax,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.pkt = type { i32 }
define void @pkt_put_u8(%struct.pkt* %0, i32 %1) {
%3 = alloca %struct.pkt*
%4 = alloca i32
%5 = alloca i32*
store %struct.pkt* %0, %struct.pkt** %3
store i32 %1, i32* %4
%6 = load %struct.pkt*, %struct.pkt** %3
%7 = call i32* @pkt_put(%struct.pkt* %6, i32 4)
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = call i32 @memcpy(i32* %8, i32* %4, i32 4)
ret void
}

LLVM IR (-O2):
%struct.pkt = type { i32 }
define void @pkt_put_u8(%struct.pkt* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = tail call i32* @pkt_put(%struct.pkt* %0, i32 4)
%5 = call i32 @memcpy(i32* %4, i32* %3, i32 4)
ret void
}
mc_struct(ll) {
  struct ll_s *prev;
  struct ll_s *next;
  void *data;
}


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

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

LLVM IR (-O0):
%struct.ll_s = type opaque
define i32 @mc_struct(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.ll_s*
%5 = alloca %struct.ll_s*
%6 = alloca i8*
store i32 %0, i32* %3
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
%struct.ll_s = type opaque
define i32 @mc_struct(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("Este programa utiliza o algorítimo de Huffman para compactar e \n "
         "descompactar arquivos.\n");
  printf("Modo de uso:\n");
  printf("\t -c\t [arquivo]\t compacta \n");
  printf("\t -d\t [arquivo]\t descompacta \n");
}


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

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf35(%rip),%rdi
call   1030 <puts@plt>
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
lea    0xf45(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [90 x i8] c"Este programa utiliza o algor\C3\ADtimo de Huffman para compactar e \0A descompactar arquivos.\0A\00"
@.str.1 = [14 x i8] c"Modo de uso:\0A\00"
@.str.2 = [28 x i8] c"\09 -c\09 [arquivo]\09 compacta \0A\00"
@.str.3 = [31 x i8] c"\09 -d\09 [arquivo]\09 descompacta \0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [89 x i8] c"Este programa utiliza o algor\C3\ADtimo de Huffman para compactar e \0A descompactar arquivos.\00"
@str.4 = [13 x i8] c"Modo de uso:\00"
@str.5 = [27 x i8] c"\09 -c\09 [arquivo]\09 compacta \00"
@str.6 = [30 x i8] c"\09 -d\09 [arquivo]\09 descompacta \00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ i2c_SCL_set(int);
int i2c_SDA_get();
int /*<<< orphan*/ i2c_SDA_set(int);
char i2c_check_ack(void) {
  int d;
  i2c_SCL_set(0);
  i2c_SDA_set(1);
  i2c_SCL_set(1);
  d = i2c_SDA_get();
  i2c_SCL_set(0);
  return d;
}


x86 assembly (clang, -O0):
<i2c_check_ack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <i2c_SCL_set@plt>
mov    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1050 <i2c_SCL_set@plt>
mov    $0x0,%al
call   1040 <i2c_SDA_get@plt>
mov    %eax,-0x4(%rbp)
xor    %edi,%edi
call   1050 <i2c_SCL_set@plt>
mov    -0x4(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_check_ack>:
push   %rbx
xor    %edi,%edi
call   1050 <i2c_SCL_set@plt>
mov    $0x1,%edi
call   1030 <i2c_SDA_set@plt>
mov    $0x1,%edi
call   1050 <i2c_SCL_set@plt>
xor    %eax,%eax
call   1040 <i2c_SDA_get@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1050 <i2c_SCL_set@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @i2c_check_ack() {
%1 = alloca i32
%2 = call i32 @i2c_SCL_set(i32 0)
%3 = call i32 @i2c_SDA_set(i32 1)
%4 = call i32 @i2c_SCL_set(i32 1)
%5 = call i32 (...) @i2c_SDA_get()
store i32 %5, i32* %1
%6 = call i32 @i2c_SCL_set(i32 0)
%7 = load i32, i32* %1
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @i2c_check_ack() {
%1 = tail call i32 @i2c_SCL_set(i32 0)
%2 = tail call i32 @i2c_SDA_set(i32 1)
%3 = tail call i32 @i2c_SCL_set(i32 1)
%4 = tail call i32 (...) @i2c_SDA_get()
%5 = tail call i32 @i2c_SCL_set(i32 0)
%6 = trunc i32 %4 to i8
ret i8 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void InitDefglobalsCode(void *theEnv, FILE *initFP, int imageID,
                        int maxIndices) {
  fprintf(initFP, "   ResetDefglobals(theEnv);\n");
}


x86 assembly (clang, -O0):
<InitDefglobalsCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitDefglobalsCode>:
mov    %rsi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [29 x i8] c" ResetDefglobals(theEnv);\0A\00"
define void @InitDefglobalsCode(i8* %0, i32* %1, i32 %2, i32 %3) {
%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 %3, i32* %8
%9 = load i32*, i32** %6
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c" ResetDefglobals(theEnv);\0A\00"
define void @InitDefglobalsCode(i8* nocapture readnone %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 28, i64 1, i32* %1)
ret void
}
int test_imm_6Aint64_lowword_reg(long long val) {
  return ((val) & (0x6A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Aint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x6a,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_6Aint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 106
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void show_ver(void) {
  fprintf(stdout, "Version.2.1.0\n");
  fprintf(stdout, "Copyright(C)2010-2011. Matayoshi.\n");
  exit(0);
}


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

x86 assembly (clang, -O2):
<show_ver>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [15 x i8] c"Version.2.1.0\0A\00"
@.str.1 = [35 x i8] c"Copyright(C)2010-2011. Matayoshi.\0A\00"
define void @show_ver() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [15 x i8] c"Version.2.1.0\0A\00"
@.str.1 = [35 x i8] c"Copyright(C)2010-2011. Matayoshi.\0A\00"
define void @show_ver() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) {
  printf("Exiting... signal received: (%d)\n", sig);
  exit(0);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Exiting... signal received: (%d)\0A\00"
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"Exiting... signal received: (%d)\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double __ocml_rhypot_f64(double, double);
double rhypot(double x, double y) { return __ocml_rhypot_f64(x, y); }


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

x86 assembly (clang, -O2):
<rhypot>:
jmp    1030 <__ocml_rhypot_f64@plt>

LLVM IR (-O0):
define double @rhypot(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @__ocml_rhypot_f64(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @rhypot(double %0, double %1) {
%3 = tail call double @__ocml_rhypot_f64(double %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ io_out8(int, char);
int /*<<< orphan*/ wait_8042();
void cmd_8042(char command) {
  wait_8042();
  io_out8(0x64, command);
}


x86 assembly (clang, -O0):
<cmd_8042>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <wait_8042@plt>
mov    $0x64,%edi
movsbl -0x1(%rbp),%esi
call   1040 <io_out8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_8042>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <wait_8042@plt>
mov    $0x64,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <io_out8@plt>

LLVM IR (-O0):
define void @cmd_8042(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @wait_8042()
%4 = load i8, i8* %2
%5 = call i32 @io_out8(i32 100, i8 signext %4)
ret void
}

LLVM IR (-O2):
define void @cmd_8042(i8 signext %0) {
%2 = tail call i32 (...) @wait_8042()
%3 = tail call i32 @io_out8(i32 100, i8 signext %0)
ret void
}
/* Variables and functions */
int readdelimstring(int, int, char *, int, char);
int readnlstring(int sec, int sockid, char *buf, int maxlen) {
  return readdelimstring(sec, sockid, buf, maxlen, '\n');
}


x86 assembly (clang, -O0):
<readnlstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0xa,%r8d
call   1030 <readdelimstring@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readnlstring>:
mov    $0xa,%r8d
jmp    1030 <readdelimstring@plt>

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

LLVM IR (-O2):
define i32 @readnlstring(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @readdelimstring(i32 %0, i32 %1, i8* %2, i32 %3, i8 signext 10)
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void bitclr(uint32_t *bs, int v) { bs[v >> 5] &= ~(1 << (v & 31)); }


x86 assembly (clang, -O0):
<bitclr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    $0x5,%ecx
movslq %ecx,%rcx
and    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitclr>:
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
sar    $0x5,%ecx
movslq %ecx,%rcx
and    %eax,(%rdi,%rcx,4)
ret

LLVM IR (-O0):
define void @bitclr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 31
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = ashr i32 %10, 5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %9, i64 %12
%14 = load i32, i32* %13
%15 = and i32 %14, %8
store i32 %15, i32* %13
ret void
}

LLVM IR (-O2):
define void @bitclr(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 31
%4 = shl nuw i32 1, %3
%5 = xor i32 %4, -1
%6 = ashr i32 %1, 5
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = and i32 %9, %5
store i32 %10, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hdsStop(int *);
void hds_stop_(int *status) { hdsStop(status); }


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

x86 assembly (clang, -O2):
<hds_stop_>:
jmp    1030 <hdsStop@plt>

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

LLVM IR (-O2):
define void @hds_stop_(i32* %0) {
%2 = tail call i32 @hdsStop(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int system(char *);
void spawnme() {
  setuid(0);
  int stat = system("/bin/sh");
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define void @spawnme() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ hostname;

/* Variables and functions */
int MAXHOSTNAMELEN;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char hostname[MAXHOSTNAMELEN];
  if (!gethostname(hostname, sizeof(hostname)))
    printf("%s\n", hostname);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    %eax,%esi
call   1040 <gethostname@plt>
cmp    $0x0,%eax
jne    1192 <main+0x62>
mov    -0x28(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1040 <gethostname@plt>
test   %eax,%eax
jne    116e <main+0x3e>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@MAXHOSTNAMELEN = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @MAXHOSTNAMELEN
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %6
%11 = alloca i8, i64 %9
store i64 %9, i64* %7
%12 = trunc i64 %9 to i32
%13 = call i32 @gethostname(i8* %11, i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %17
17: ; preds = %15, %2
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@MAXHOSTNAMELEN = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @MAXHOSTNAMELEN
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @gethostname(i8* %5, i32 %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %10
10: ; preds = %8, %2
%11 = call i32 @exit(i32 0)
unreachable
}
void _start(void) { ((void (*)(void))0xffff0020)(); }


x86 assembly (clang, -O0):
<_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffff0020,%eax
call   *%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start>:
mov    $0xffff0020,%eax
jmp    *%rax

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

LLVM IR (-O2):
define void @_start() {
tail call void inttoptr (i64 4294901792 to void ()*)()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
void putshortel(FILE *outf, unsigned short val) {
  unsigned char buf[2];
  buf[0] = (val >> 0);
  buf[1] = (val >> 8);
  fwrite(buf, 2, 1, outf);
}


x86 assembly (clang, -O0):
<putshortel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
sar    $0x0,%eax
mov    %al,-0xc(%rbp)
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0xb(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putshortel>:
push   %rax
mov    %rdi,%rcx
mov    %si,0x6(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @putshortel(i32* %0, i16 zeroext %1) {
%3 = alloca i32*
%4 = alloca i16
%5 = alloca [2 x i8]
store i32* %0, i32** %3
store i16 %1, i16* %4
%6 = load i16, i16* %4
%7 = zext i16 %6 to i32
%8 = ashr i32 %7, 0
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
store i8 %14, i8* %15
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%17 = load i32*, i32** %3
%18 = call i32 @fwrite(i8* %16, i32 2, i32 1, i32* %17)
ret void
}

LLVM IR (-O2):
define void @putshortel(i32* nocapture %0, i16 zeroext %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = trunc i16 %1 to i8
store i8 %5, i8* %4
%6 = lshr i16 %1, 8
%7 = trunc i16 %6 to i8
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %7, i8* %8
%9 = call i32 @fwrite(i8* %4, i32 2, i32 1, i32* %0)
ret void
}
double minf(double x, double y) {
  if (x <= y) {
    return x;
  } else {
    return y;
  }
}


x86 assembly (clang, -O0):
<minf>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1131 <minf+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    113b <minf+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<minf>:
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @minf(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ole double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @minf(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
void set_kernel_text_rw(void) {}


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

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

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

LLVM IR (-O2):
define void @set_kernel_text_rw() {
ret void
}
/* Variables and functions */
float sqrtf(float const);
float mlVectorNorm(const float *a) {
  return sqrtf(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
}


x86 assembly (clang, -O0):
<mlVectorNorm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrtf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlVectorNorm>:
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     113f <mlVectorNorm+0x2f>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @mlVectorNorm(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = fmul float %11, %14
%16 = call float @llvm.fmuladd.f32(float %5, float %8, float %15)
%17 = load float*, float** %2
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
%20 = load float*, float** %2
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
%23 = call float @llvm.fmuladd.f32(float %19, float %22, float %16)
%24 = call float @sqrtf(float %23)
ret float %24
}

LLVM IR (-O2):
define float @mlVectorNorm(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %6)
%10 = tail call float @sqrtf(float %9)
ret float %10
}
/* Type definitions */
struct HashTable {
  int dummy;
};

/* Variables and functions */
struct HashTable *hash_table_init_size(int /*<<< orphan*/);
struct HashTable *hash_table_init() {
  return hash_table_init_size(0);
}


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

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

LLVM IR (-O0):
%struct.HashTable = type { i32 }
define %struct.HashTable* @hash_table_init() {
%1 = call %struct.HashTable* @hash_table_init_size(i32 0)
ret %struct.HashTable* %1
}

LLVM IR (-O2):
%struct.HashTable = type { i32 }
define %struct.HashTable* @hash_table_init() {
%1 = tail call %struct.HashTable* @hash_table_init_size(i32 0)
ret %struct.HashTable* %1
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *dupstr(const char *str) {
  char *copy = NULL;
  if (str) {
    copy = malloc(strlen(str) + 1);
    if (copy) {
      strcpy(copy, str);
    }
  }
  return copy;
}


x86 assembly (clang, -O0):
<dupstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1185 <dupstr+0x55>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1180 <dupstr+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1185 <dupstr+0x55>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dupstr>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115f <dupstr+0x2f>
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115f <dupstr+0x2f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    1161 <dupstr+0x31>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @dupstr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = add nsw i64 %4, 1
%6 = tail call i8* @malloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %10
10: ; preds = %3, %8, %1
%11 = phi i8* [ %6, %8 ], [ null, %3 ], [ null, %1 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n * (n + 1) / 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    0x1(%rax),%ecx
imul   %eax,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = mul nsw i32 %4, %6
%8 = sdiv i32 %7, 2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %6, 2
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}