xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void commit_move(int direction) {
  printf("%i\n", direction);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<commit_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<commit_move>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
@stdout = global i32 0
define void @commit_move(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
@stdout = global i32 0
define void @commit_move(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ f(int *);
int main(int argc, char *argv[]) {
  int m = 41;
  f(&m);
#pragma omp taskwait
  if (m != 42)
    abort();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x29,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <f@plt>
cmpl   $0x2a,-0x14(%rbp)
je     1150 <main+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x29,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <f@plt>
cmpl   $0x2a,0x4(%rsp)
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 41, i32* %5
%6 = call i32 @f(i32* %5)
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 42
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 41, i32* %3
%5 = call i32 @f(i32* %3)
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 42
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %2
ret i32 0
}
void update_coef(design) struct Design *design;
{ int i, j; }


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

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

LLVM IR (-O0):
%struct.Design = type opaque
define void @update_coef(%struct.Design* %0) {
%2 = alloca %struct.Design*
%3 = alloca i32
%4 = alloca i32
store %struct.Design* %0, %struct.Design** %2
ret void
}

LLVM IR (-O2):
%struct.Design = type opaque
define void @update_coef(%struct.Design* nocapture %0) {
ret void
}
/* Type definitions */
struct user_desc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SYS_get_thread_area;
int syscall(int /*<<< orphan*/, struct user_desc *);
int get_thread_area(struct user_desc *u_info) {
  return syscall(SYS_get_thread_area, u_info);
}


x86 assembly (clang, -O0):
<get_thread_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_thread_area>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.user_desc = type { i32 }
@SYS_get_thread_area = global i32 0
define i32 @get_thread_area(%struct.user_desc* %0) {
%2 = alloca %struct.user_desc*
store %struct.user_desc* %0, %struct.user_desc** %2
%3 = load i32, i32* @SYS_get_thread_area
%4 = load %struct.user_desc*, %struct.user_desc** %2
%5 = call i32 @syscall(i32 %3, %struct.user_desc* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.user_desc = type { i32 }
@SYS_get_thread_area = global i32 0
define i32 @get_thread_area(%struct.user_desc* %0) {
%2 = load i32, i32* @SYS_get_thread_area
%3 = tail call i32 @syscall(i32 %2, %struct.user_desc* %0)
ret i32 %3
}
/* Variables and functions */
size_t get_binary_resource_tmp_txt_res_size();
size_t res_tmp_txt_size(void) { return get_binary_resource_tmp_txt_res_size(); }


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

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

LLVM IR (-O0):
define i64 @res_tmp_txt_size() {
%1 = call i64 (...) @get_binary_resource_tmp_txt_res_size()
ret i64 %1
}

LLVM IR (-O2):
define i64 @res_tmp_txt_size() {
%1 = tail call i64 (...) @get_binary_resource_tmp_txt_res_size()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help() {
  printf("Displays a calendar for years between 1900 and 2099.\n\n");
  printf("./calendar [yyyy [mm]] | [mm [yyyy]]\n\n");
  printf("yyyy\tyear of calendar\n");
  printf("mm\tmonth of calendar\n");
  printf("\nAuthor: Francis Asante <kofrasa@gmail.com> (2009)\n");
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf10(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2b(%rip),%rdi
call   1030 <printf@plt>
lea    0xf36(%rip),%rdi
call   1030 <printf@plt>
lea    0xf40(%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    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Displays a calendar for years between 1900 and 2099.\0A\0A\00"
@.str.1 = [39 x i8] c"./calendar [yyyy [mm]] | [mm [yyyy]]\0A\0A\00"
@.str.2 = [23 x i8] c"yyyy\09year of calendar\0A\00"
@.str.3 = [22 x i8] c"mm\09month of calendar\0A\00"
@.str.4 = [52 x i8] c"\0AAuthor: Francis Asante <kofrasa@gmail.com> (2009)\0A\00"
define void @help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [54 x i8] c"Displays a calendar for years between 1900 and 2099.\0A\00"
@str.5 = [38 x i8] c"./calendar [yyyy [mm]] | [mm [yyyy]]\0A\00"
@str.6 = [22 x i8] c"yyyy\09year of calendar\00"
@str.7 = [21 x i8] c"mm\09month of calendar\00"
@str.8 = [51 x i8] c"\0AAuthor: Francis Asante <kofrasa@gmail.com> (2009)\00"
define void @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.8, i64 0, i64 0))
ret void
}
char *u_timestring(time)
long time;
{ return (ctime(&time)); }


x86 assembly (clang, -O0):
<u_timestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <ctime@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_timestring>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <ctime@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @u_timestring(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 (i64*, ...) bitcast (i32 (...)* @ctime to i32 (i64*, ...)*)(i64* %2)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @u_timestring(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 (i64*, ...) bitcast (i32 (...)* @ctime to i32 (i64*, ...)*)(i64* %2)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ g(int);
int /*<<< orphan*/ h(int);
int /*<<< orphan*/ w(int);
int /*<<< orphan*/ z(int);
void ioctl(int i) {
  g(1);
  h(2);
  w(3);
  z(4);
}


x86 assembly (clang, -O0):
<ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1050 <g@plt>
mov    $0x2,%edi
call   1030 <h@plt>
mov    $0x3,%edi
call   1060 <w@plt>
mov    $0x4,%edi
call   1040 <z@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioctl>:
push   %rax
mov    $0x1,%edi
call   1050 <g@plt>
mov    $0x2,%edi
call   1030 <h@plt>
mov    $0x3,%edi
call   1060 <w@plt>
mov    $0x4,%edi
pop    %rax
jmp    1040 <z@plt>

LLVM IR (-O0):
define void @ioctl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @g(i32 1)
%4 = call i32 @h(i32 2)
%5 = call i32 @w(i32 3)
%6 = call i32 @z(i32 4)
ret void
}

LLVM IR (-O2):
define void @ioctl(i32 %0) {
%2 = tail call i32 @g(i32 1)
%3 = tail call i32 @h(i32 2)
%4 = tail call i32 @w(i32 3)
%5 = tail call i32 @z(i32 4)
ret void
}
int litCmp2(int *a, int *b) {
  if (((*a) >> 1) > ((*b) >> 1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<litCmp2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sar    $0x1,%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
sar    $0x1,%ecx
cmp    %ecx,%eax
jle    1132 <litCmp2+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1139 <litCmp2+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<litCmp2>:
mov    (%rdi),%ecx
sar    %ecx
mov    (%rsi),%edx
sar    %edx
xor    %eax,%eax
cmp    %edx,%ecx
setg   %al
ret

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

LLVM IR (-O2):
define i32 @litCmp2(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = ashr i32 %3, 1
%5 = load i32, i32* %1
%6 = ashr i32 %5, 1
%7 = icmp sgt i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int test4(int);
int main() {
  printf("%d\n", test4(3));
  printf("%d\n", test4(-1));
  printf("%d\n", test4(20));
  printf("%d\n", test4(21));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1040 <test4@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <test4@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <test4@plt>
mov    %eax,%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x15,%edi
call   1040 <test4@plt>
mov    %eax,%esi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3,%edi
call   1040 <test4@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <test4@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <test4@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x15,%edi
call   1040 <test4@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @test4(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @test4(i32 -1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @test4(i32 20)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @test4(i32 21)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Type definitions */
struct gc_object_table_item {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct gc_object_table_item *);
int gc_object_table_item_destroy(
    struct gc_object_table_item *object_table_item) {
  free(object_table_item);
  return 0;
}


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

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

LLVM IR (-O0):
%struct.gc_object_table_item = type { i32 }
define i32 @gc_object_table_item_destroy(%struct.gc_object_table_item* %0) {
%2 = alloca %struct.gc_object_table_item*
store %struct.gc_object_table_item* %0, %struct.gc_object_table_item** %2
%3 = load %struct.gc_object_table_item*, %struct.gc_object_table_item** %2
%4 = call i32 @free(%struct.gc_object_table_item* %3)
ret i32 0
}

LLVM IR (-O2):
%struct.gc_object_table_item = type { i32 }
define i32 @gc_object_table_item_destroy(%struct.gc_object_table_item* nocapture %0) {
%2 = tail call i32 @free(%struct.gc_object_table_item* %0)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SysCtlPeripheralDeepSleepDisable(uint32_t ui32Peripheral) {
  ;
  (*((volatile unsigned long
          *)(((unsigned long)(0x400fe800 + ((ui32Peripheral & 0xff00) >> 8)) &
              0xF0000000) |
             0x02000000 |
             (((unsigned long)(0x400fe800 + ((ui32Peripheral & 0xff00) >> 8)) &
               0x000FFFFF)
              << 5) |
             ((ui32Peripheral & 0xff) << 2)))) = 0;
}


x86 assembly (clang, -O0):
<SysCtlPeripheralDeepSleepDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
add    $0x400fe800,%eax
cltq
movabs $0xf0000000,%rcx
and    %rcx,%rax
or     $0x2000000,%rax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
add    $0x400fe800,%ecx
movslq %ecx,%rcx
and    $0xfffff,%rcx
shl    $0x5,%rcx
or     %rcx,%rax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlPeripheralDeepSleepDisable>:
movzbl %dil,%eax
shr    $0x3,%edi
and    $0x1fe0,%edi
shl    $0x2,%eax
or     %edi,%eax
movq   $0x0,0x43fd0000(%rax)
ret

LLVM IR (-O0):
define void @SysCtlPeripheralDeepSleepDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = ashr i32 %4, 8
%6 = add nsw i32 1074784256, %5
%7 = sext i32 %6 to i64
%8 = and i64 %7, 4026531840
%9 = or i64 %8, 33554432
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = ashr i32 %11, 8
%13 = add nsw i32 1074784256, %12
%14 = sext i32 %13 to i64
%15 = and i64 %14, 1048575
%16 = shl i64 %15, 5
%17 = or i64 %9, %16
%18 = load i32, i32* %2
%19 = and i32 %18, 255
%20 = shl i32 %19, 2
%21 = sext i32 %20 to i64
%22 = or i64 %17, %21
%23 = inttoptr i64 %22 to i64*
store volatile i64 0, i64* %23
ret void
}

LLVM IR (-O2):
define void @SysCtlPeripheralDeepSleepDisable(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 8160
%4 = shl i32 %0, 2
%5 = and i32 %4, 1020
%6 = or i32 %5, %3
%7 = or i32 %6, 1140654080
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i64*
store volatile i64 0, i64* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void badusage(void) {
  fprintf(stderr, "Usage: fsaprune [-ip d/s] [-op d/s] [-silent] [-v] [-a] "
                  "[-i] [filename]\n");
  exit(1);
}


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

x86 assembly (clang, -O2):
<badusage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [73 x i8] c"Usage: fsaprune [-ip d/s] [-op d/s] [-silent] [-v] [-a] [-i] [filename]\0A\00"
define void @badusage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [73 x i8] c"Usage: fsaprune [-ip d/s] [-op d/s] [-silent] [-v] [-a] [-i] [filename]\0A\00"
define void @badusage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
float __floatunsisf(unsigned long v) { return v; }


x86 assembly (clang, -O0):
<__floatunsisf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x10(%rbp)
test   %rax,%rax
movss  %xmm0,-0xc(%rbp)
js     1145 <__floatunsisf+0x45>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__floatunsisf>:
test   %rdi,%rdi
js     110b <__floatunsisf+0xb>
cvtsi2ss %rdi,%xmm0
ret
mov    %rdi,%rax
shr    %rax
and    $0x1,%edi
or     %rax,%rdi
cvtsi2ss %rdi,%xmm0
addss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @__floatunsisf(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = uitofp i64 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @__floatunsisf(i64 %0) {
%2 = uitofp i64 %0 to float
ret float %2
}
int *leak_pointer() {
  volatile int x;
  volatile int *y = &x;
  *y = 1;
  return (int *)y;
}


x86 assembly (clang, -O0):
<leak_pointer>:
push   %rbp
mov    %rsp,%rbp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leak_pointer>:
movl   $0x1,-0x4(%rsp)
lea    -0x4(%rsp),%rax
ret

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

LLVM IR (-O2):
define i32* @leak_pointer() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 1, i32* %1
ret i32* %1
}
int table_rule_combine(int a, int b) { return a > b ? a : b; }


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

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

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

LLVM IR (-O2):
define i32 @table_rule_combine(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int idade;
  scanf("%d", &idade);
  if (idade >= 18) {
    printf("maior de idade\n");
  } else {
    printf("menor de idade\n");
  }
  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>
cmpl   $0x12,-0x8(%rbp)
jl     115a <main+0x3a>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <main+0x46>
lea    0xeb2(%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>
cmpl   $0x12,0x4(%rsp)
lea    0xed4(%rip),%rax
lea    0xebe(%rip),%rdi
cmovge %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"maior de idade\0A\00"
@.str.2 = [16 x i8] c"menor de idade\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 = icmp sge i32 %4, 18
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [15 x i8] c"menor de idade\00"
@str.3 = [15 x i8] c"maior de idade\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 = icmp sgt i32 %4, 17
%6 = select i1 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0)
%7 = call i32 @puts(i8* dereferenceable(1) %6)
ret i32 0
}
/* Variables and functions */
const char *_version(const char **version) {
  *version = (""[0] == '\0') ? NULL : "";
  return "unknown";
}


x86 assembly (clang, -O0):
<_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
lea    0xee6(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_version>:
movq   $0x0,(%rdi)
lea    0xef2(%rip),%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"unknown\00"
define i8* @_version(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
store i8* null, i8** %3
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [8 x i8] c"unknown\00"
define i8* @_version(i8** nocapture writeonly %0) {
store i8* null, i8** %0
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ Direct(int);
int /*<<< orphan*/ INC8(int /*<<< orphan*/);
void OpE6M1(void) { INC8(Direct(3)); }


x86 assembly (clang, -O0):
<OpE6M1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <Direct@plt>
mov    %eax,%edi
call   1040 <INC8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OpE6M1>:
push   %rax
mov    $0x3,%edi
call   1030 <Direct@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <INC8@plt>

LLVM IR (-O0):
define void @OpE6M1() {
%1 = call i32 @Direct(i32 3)
%2 = call i32 @INC8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @OpE6M1() {
%1 = tail call i32 @Direct(i32 3)
%2 = tail call i32 @INC8(i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
char *malloc_wcstombs(int /*<<< orphan*/ *);
char *realloc_wcstombs(wchar_t *s) {
  char *result = malloc_wcstombs(s);
  free(s);
  return result;
}


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

x86 assembly (clang, -O2):
<realloc_wcstombs>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <malloc_wcstombs@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @realloc_wcstombs(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i8* @malloc_wcstombs(i32* %4)
store i8* %5, i8** %3
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @realloc_wcstombs(i32* %0) {
%2 = tail call i8* @malloc_wcstombs(i32* %0)
%3 = tail call i32 @free(i32* %0)
ret i8* %2
}
long os(long a, long b) {
  long i = 1;
  while (i != b) {
    a = a * a;
    i++;
  }
  return a;
}


x86 assembly (clang, -O0):
<os>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1140 <os+0x40>
mov    -0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <os+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<os>:
mov    %rdi,%rax
cmp    $0x1,%rsi
je     115a <os+0x5a>
lea    -0x1(%rsi),%rdx
add    $0xfffffffffffffffe,%rsi
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x7,%rsi
jb     1146 <os+0x46>
and    $0xfffffffffffffff8,%rdx
imul   %rax,%rax
imul   %rax,%rax
imul   %rax,%rax
imul   %rax,%rax
imul   %rax,%rax
imul   %rax,%rax
imul   %rax,%rax
imul   %rax,%rax
add    $0xfffffffffffffff8,%rdx
jne    1120 <os+0x20>
test   %rcx,%rcx
je     115a <os+0x5a>
nopl   0x0(%rax,%rax,1)
imul   %rax,%rax
add    $0xffffffffffffffff,%rcx
jne    1150 <os+0x50>
ret

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

LLVM IR (-O2):
define i64 @os(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 1
br i1 %3, label %34, label %4
4: ; preds = %2
%5 = add i64 %1, -1
%6 = add i64 %1, -2
%7 = and i64 %5, 7
%8 = icmp ult i64 %6, 7
br i1 %8, label %24, label %9
9: ; preds = %4
%10 = and i64 %5, -8
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ %0, %9 ], [ %21, %11 ]
%13 = phi i64 [ 0, %9 ], [ %22, %11 ]
%14 = mul nsw i64 %12, %12
%15 = mul nsw i64 %14, %14
%16 = mul nsw i64 %15, %15
%17 = mul nsw i64 %16, %16
%18 = mul nsw i64 %17, %17
%19 = mul nsw i64 %18, %18
%20 = mul nsw i64 %19, %19
%21 = mul nsw i64 %20, %20
%22 = add i64 %13, 8
%23 = icmp eq i64 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %4
%25 = phi i64 [ undef, %4 ], [ %21, %11 ]
%26 = phi i64 [ %0, %4 ], [ %21, %11 ]
%27 = icmp eq i64 %7, 0
br i1 %27, label %34, label %28
28: ; preds = %24, %28
%29 = phi i64 [ %31, %28 ], [ %26, %24 ]
%30 = phi i64 [ %32, %28 ], [ 0, %24 ]
%31 = mul nsw i64 %29, %29
%32 = add i64 %30, 1
%33 = icmp eq i64 %32, %7
br i1 %33, label %34, label %28
34: ; preds = %24, %28, %2
%35 = phi i64 [ %0, %2 ], [ %25, %24 ], [ %31, %28 ]
ret i64 %35
}
/* Variables and functions */
double ceil(double);
double myCeil(double d) { return ceil(d); }


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

x86 assembly (clang, -O2):
<myCeil>:
jmp    1030 <ceil@plt>

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

LLVM IR (-O2):
define double @myCeil(double %0) {
%2 = tail call double @llvm.ceil.f64(double %0)
ret double %2
}
int base32_blksize_enc() { return 8; }


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

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

LLVM IR (-O0):
define i32 @base32_blksize_enc() {
ret i32 8
}

LLVM IR (-O2):
define i32 @base32_blksize_enc() {
ret i32 8
}
int test_imm_0Auint8_mem(unsigned char *val) {
  return ((*val) & (-0x0A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Auint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xfffffff6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_0Auint8_mem>:
testb  $0xf6,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Auint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -10
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ rdtsc(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ u32_to_64(int /*<<< orphan*/, int /*<<< orphan*/);
__attribute__((__unused__, __always___)) __attribute__((__artificial__))
uint64_t
rdtscl() {
  uint32_t high, low;
  rdtsc(&low, &high);
  return u32_to_64(low, high);
}


x86 assembly (clang, -O0):
<rdtscl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <rdtsc@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <u32_to_64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdtscl>:
push   %rax
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1040 <rdtsc@plt>
mov    (%rsp),%edi
mov    0x4(%rsp),%esi
call   1030 <u32_to_64@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rdtscl() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @rdtsc(i32* %2, i32* %1)
%4 = load i32, i32* %2
%5 = load i32, i32* %1
%6 = call i32 @u32_to_64(i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @rdtscl() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @rdtsc(i32* %2, i32* %1)
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = call i32 @u32_to_64(i32 %6, i32 %7)
ret i32 %8
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t ntohll(uint64_t n) {
  n = ((n << 8) & 0xFF00FF00FF00FF00ULL) | ((n >> 8) & 0x00FF00FF00FF00FFULL);
  n = ((n << 16) & 0xFFFF0000FFFF0000ULL) | ((n >> 16) & 0x0000FFFF0000FFFFULL);
  n = (n << 32) | (n >> 32);
  return n;
}


x86 assembly (clang, -O0):
<ntohll>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
cltq
movabs $0xff00ff00ff00ff00,%rcx
and    %rcx,%rax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
movslq %ecx,%rcx
movabs $0xff00ff00ff00ff,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
cltq
movabs $0xffff0000ffff0000,%rcx
and    %rcx,%rax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
movslq %ecx,%rcx
movabs $0xffff0000ffff,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ntohll(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = sext i32 %4 to i64
%6 = and i64 %5, -71777214294589696
%7 = load i32, i32* %2
%8 = ashr i32 %7, 8
%9 = sext i32 %8 to i64
%10 = and i64 %9, 71777214294589695
%11 = or i64 %6, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = shl i32 %13, 16
%15 = sext i32 %14 to i64
%16 = and i64 %15, -281470681808896
%17 = load i32, i32* %2
%18 = ashr i32 %17, 16
%19 = sext i32 %18 to i64
%20 = and i64 %19, 281470681808895
%21 = or i64 %16, %20
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = shl i32 %23, 32
%25 = load i32, i32* %2
%26 = ashr i32 %25, 32
%27 = or i32 %24, %26
store i32 %27, i32* %2
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @ntohll(i32 %0) {
ret i32 poison
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t cblByteOrderSwap32(uint32_t swap) {
  return ((swap & 0xFF) << 24) | ((swap & 0xFF00) << 8) |
         ((swap >> 8) & 0xFF00) | ((swap >> 24) & 0xFF);
}


x86 assembly (clang, -O0):
<cblByteOrderSwap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cblByteOrderSwap32>:
mov    %edi,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @cblByteOrderSwap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = ashr i32 %10, 8
%12 = and i32 %11, 65280
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = ashr i32 %14, 24
%16 = and i32 %15, 255
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @cblByteOrderSwap32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
int my_strncmp(char *s1, char *s2) {
  int i;
  i = 0;
  while (s1[i] != '\0') {
    if (s1[i] != s2[i])
      return (1);
    i++;
  }
  return (0);
}


x86 assembly (clang, -O0):
<my_strncmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1162 <my_strncmp+0x62>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1154 <my_strncmp+0x54>
movl   $0x1,-0x4(%rbp)
jmp    1169 <my_strncmp+0x69>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <my_strncmp+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strncmp>:
mov    (%rdi),%al
test   %al,%al
je     1122 <my_strncmp+0x22>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    (%rsi,%rcx,1),%al
jne    1125 <my_strncmp+0x25>
movzbl 0x1(%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <my_strncmp+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @my_strncmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %0, i64 %15
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %15, %5 ], [ 0, %2 ]
%11 = phi i8 [ %7, %5 ], [ %3, %2 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %10
%13 = load i8, i8* %12
%14 = icmp eq i8 %11, %13
%15 = add nuw i64 %10, 1
br i1 %14, label %5, label %16
16: ; preds = %9, %5, %2
%17 = phi i32 [ 0, %2 ], [ 0, %5 ], [ 1, %9 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ printf(char *);
void task5() {
  alarm(4);
  printf("\nTASK 5: Alarm\n");
  printf("Waiting for alarm...\n");
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<task5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1040 <alarm@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <task5+0x26>

x86 assembly (clang, -O2):
<task5>:
push   %rax
mov    $0x4,%edi
call   1040 <alarm@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1150 <task5+0x30>

LLVM IR (-O0):
@.str = [16 x i8] c"\0ATASK 5: Alarm\0A\00"
@.str.1 = [22 x i8] c"Waiting for alarm...\0A\00"
define void @task5() {
%1 = call i32 @alarm(i32 4)
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}

LLVM IR (-O2):
@str = [15 x i8] c"\0ATASK 5: Alarm\00"
@str.2 = [21 x i8] c"Waiting for alarm...\00"
define void @task5() {
%1 = tail call i32 @alarm(i32 4)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.2, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
br label %4
}
/* Variables and functions */
int EINVAL;
int errno;
int /*<<< orphan*/ error(int, int, char *, int);
int /*<<< orphan*/ usage();
void check_arg_error(void) {
  errno = EINVAL;
  usage();
  error(1, 1, "%d", errno);
}


x86 assembly (clang, -O0):
<check_arg_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
mov    0x2eac(%rip),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <usage@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
lea    0xeae(%rip),%rdx
mov    %esi,%edi
call   1040 <error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_arg_error>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
mov    0x2eaf(%rip),%rbx
mov    %eax,(%rbx)
xor    %eax,%eax
call   1030 <usage@plt>
mov    (%rbx),%ecx
lea    0xebd(%rip),%rdx
mov    $0x1,%edi
mov    $0x1,%esi
pop    %rbx
jmp    1040 <error@plt>

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [3 x i8] c"%d\00"
define void @check_arg_error() {
%1 = load i32, i32* @EINVAL
store i32 %1, i32* @errno
%2 = call i32 (...) @usage()
%3 = load i32, i32* @errno
%4 = call i32 @error(i32 1, i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [3 x i8] c"%d\00"
define void @check_arg_error() {
%1 = load i32, i32* @EINVAL
store i32 %1, i32* @errno
%2 = tail call i32 (...) @usage()
%3 = load i32, i32* @errno
%4 = tail call i32 @error(i32 1, i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int gp2y0e03_write_reg(int, int, int);
int reset_gp2y0e03(int fd) {
  int res;
  res = gp2y0e03_write_reg(fd, 0xee, 0x06);
  if (res < 0)
    return res;
  return 1;
}


x86 assembly (clang, -O0):
<reset_gp2y0e03>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0xee,%esi
mov    $0x6,%edx
call   1030 <gp2y0e03_write_reg@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1145 <reset_gp2y0e03+0x35>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114c <reset_gp2y0e03+0x3c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_gp2y0e03>:
push   %rax
mov    $0xee,%esi
mov    $0x6,%edx
call   1030 <gp2y0e03_write_reg@plt>
test   %eax,%eax
mov    $0x1,%ecx
cmovns %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @reset_gp2y0e03(i32 %0) {
%2 = tail call i32 @gp2y0e03_write_reg(i32 %0, i32 238, i32 6)
%3 = icmp slt i32 %2, 0
%4 = select i1 %3, i32 %2, i32 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Output2File(char const *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void OutputMsg(const char *pcMsg) {
  Output2File(pcMsg);
  fprintf(stderr, "%s", pcMsg);
  fflush(stderr);
}


x86 assembly (clang, -O0):
<OutputMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Output2File@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea7(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OutputMsg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <Output2File@plt>
mov    0x2e9d(%rip),%r14
mov    (%r14),%edi
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @OutputMsg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @Output2File(i8* %3)
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %2
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @OutputMsg(i8* %0) {
%2 = tail call i32 @Output2File(i8* %0)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fflush(i32 %5)
ret void
}
int direct_part_size(struct virtual_item *vi, int first, int count) {
  return count;
}


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

x86 assembly (clang, -O2):
<direct_part_size>:
mov    %edx,%eax
ret

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

LLVM IR (-O2):
%struct.virtual_item = type opaque
define i32 @direct_part_size(%struct.virtual_item* nocapture readnone %0, i32 %1, i32 returned %2) {
ret i32 %2
}
/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(char *);
int read(int /*<<< orphan*/, char *, int);
char *createString() {
  char *commandString = (char *)calloc(128, sizeof(char));
  int check;
  char *buffer = (char *)calloc(1, sizeof(char));
  while ((check = read(0, commandString, 128)) > 0) {
    commandString[check] = '\0';
    break;
  }
  free(buffer);
  return commandString;
}


x86 assembly (clang, -O0):
<createString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x80,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
mov    $0x80,%edx
call   1040 <read@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jle    1183 <createString+0x53>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createString>:
push   %r14
push   %rbx
push   %rax
mov    $0x80,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x80,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    1171 <createString+0x41>
mov    %eax,%eax
movb   $0x0,(%rbx,%rax,1)
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @createString() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i8*
%4 = call i64 @calloc(i32 128, i32 1)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %1
%6 = call i64 @calloc(i32 1, i32 1)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
br label %8
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @read(i32 0, i8* %9, i32 128)
store i32 %10, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i8*, i8** %1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
br label %17
17: ; preds = %12, %8
%18 = load i8*, i8** %3
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %1
ret i8* %20
}

LLVM IR (-O2):
define i8* @createString() {
%1 = tail call i64 @calloc(i32 128, i32 1)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @calloc(i32 1, i32 1)
%4 = tail call i32 @read(i32 0, i8* %2, i32 128)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = zext i32 %4 to i64
%8 = getelementptr inbounds i8, i8* %2, i64 %7
store i8 0, i8* %8
br label %9
9: ; preds = %6, %0
%10 = inttoptr i64 %3 to i8*
%11 = tail call i32 @free(i8* %10)
ret i8* %2
}