xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ CE_High();
int /*<<< orphan*/ CE_Low();
int /*<<< orphan*/ Send_Byte(int);
void DBSY() {
  CE_Low();
  Send_Byte(0x80);
  CE_High();
}


x86 assembly (clang, -O0):
<DBSY>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <CE_Low@plt>
mov    $0x80,%edi
call   1030 <Send_Byte@plt>
mov    $0x0,%al
call   1040 <CE_High@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DBSY>:
push   %rax
xor    %eax,%eax
call   1050 <CE_Low@plt>
mov    $0x80,%edi
call   1030 <Send_Byte@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <CE_High@plt>

LLVM IR (-O0):
define void @DBSY() {
%1 = call i32 (...) @CE_Low()
%2 = call i32 @Send_Byte(i32 128)
%3 = call i32 (...) @CE_High()
ret void
}

LLVM IR (-O2):
define void @DBSY() {
%1 = tail call i32 (...) @CE_Low()
%2 = tail call i32 @Send_Byte(i32 128)
%3 = tail call i32 (...) @CE_High()
ret void
}
int puts(const char *str) {
  while (*str)
    *((unsigned int *)0x09000000) = *str++;
  return 0;
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <puts+0x33>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
mov    $0x9000000,%eax
mov    %ecx,(%rax)
jmp    1108 <puts+0x8>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
mov    (%rdi),%al
test   %al,%al
je     1125 <puts+0x25>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
movsbl %al,%eax
mov    %eax,0x9000000
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <puts+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
store i32 %11, i32* inttoptr (i64 150994944 to i32*)
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
store i32 %8, i32* inttoptr (i64 150994944 to i32*)
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i32 0
}
int func(int x, char y) { return x + y; }


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
movsbl -0x5(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @func(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = add nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @func(i32 %0, i8 signext %1) {
%3 = sext i8 %1 to i32
%4 = add nsw i32 %3, %0
ret i32 %4
}
void mystart(void) {
  asm volatile("andq  $0xfffffffffffffff0, %rsp\n");
  _Exit(42);
}


x86 assembly (clang, -O0):
<mystart>:
push   %rbp
mov    %rsp,%rbp
and    $0xfffffffffffffff0,%rsp
mov    $0x2a,%edi
call   1030 <_Exit@plt>

x86 assembly (clang, -O2):
<mystart>:
push   %rax
and    $0xfffffffffffffff0,%rsp
mov    $0x2a,%edi
call   1030 <_Exit@plt>

LLVM IR (-O0):
define void @mystart() {
unreachable
}

LLVM IR (-O2):
define void @mystart() {
tail call void asm sideeffect "andq $$0xfffffffffffffff0, %rsp\0A", "~{dirflag},~{fpsr},~{flags}"()
tail call void @_Exit(i32 42)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ mask;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ sched_getaffinity(int /*<<< orphan*/, int,
                                     int /*<<< orphan*/ *);
int /*<<< orphan*/ sched_setaffinity(int, int, int /*<<< orphan*/ *);
int main() {
  cpu_set_t mask;
  sched_getaffinity(0, sizeof(mask), &mask);
  sched_setaffinity(0, sizeof(mask), &mask);
  sched_setaffinity(-1, sizeof(mask), &mask);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x4,%esi
lea    -0x8(%rbp),%rdx
call   1040 <sched_getaffinity@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0x8(%rbp),%rdx
call   1030 <sched_setaffinity@plt>
mov    $0xffffffff,%edi
mov    $0x4,%esi
lea    -0x8(%rbp),%rdx
call   1030 <sched_setaffinity@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1040 <sched_getaffinity@plt>
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1030 <sched_setaffinity@plt>
mov    $0xffffffff,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1030 <sched_setaffinity@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sched_getaffinity(i32 0, i32 4, i32* %1)
%4 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %1)
%5 = call i32 @sched_setaffinity(i32 -1, i32 4, i32* %1)
ret i32 0
}
/* Variables and functions */
scalar_t__ tanh(float);
float tanhf(float x) { return (float)tanh(x); }


x86 assembly (clang, -O0):
<tanhf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <tanh@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanhf>:
push   %rax
call   1030 <tanh@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @tanhf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @tanh(float %3)
%5 = sitofp i64 %4 to float
ret float %5
}

LLVM IR (-O2):
define float @tanhf(float %0) {
%2 = tail call i64 @tanh(float %0)
%3 = sitofp i64 %2 to float
ret float %3
}
int proc() {
  int i;
  for (i = 0; i < 1000000000; i++)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<proc>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x3b9aca00,-0x4(%rbp)
jge    112b <proc+0x2b>
jmp    111d <proc+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <proc+0xb>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @proc() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 1000000000
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @proc() {
ret i32 0
}
void switch_float(struct cpu_thread *cur_thread,
                  struct cpu_thread *next_thread) {
  return;
}


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

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

LLVM IR (-O0):
%struct.cpu_thread = type opaque
define void @switch_float(%struct.cpu_thread* %0, %struct.cpu_thread* %1) {
%3 = alloca %struct.cpu_thread*
%4 = alloca %struct.cpu_thread*
store %struct.cpu_thread* %0, %struct.cpu_thread** %3
store %struct.cpu_thread* %1, %struct.cpu_thread** %4
ret void
}

LLVM IR (-O2):
%struct.cpu_thread = type opaque
define void @switch_float(%struct.cpu_thread* nocapture %0, %struct.cpu_thread* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void deallocateValue(void *value) { free(value); }


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

x86 assembly (clang, -O2):
<deallocateValue>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @deallocateValue(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
unsigned int strlen(char *);
unsigned long hash_str(char *cs) {
  unsigned long h = 0;
  for (unsigned i = 0; i < strlen(cs); i++)
    h += 31 * h + cs[i];
  return h;
}


x86 assembly (clang, -O0):
<hash_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jae    1171 <hash_str+0x61>
imul   $0x1f,-0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x14(%rbp),%edx
movsbq (%rcx,%rdx,1),%rcx
add    %rcx,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <hash_str+0x1b>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_str>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
je     1151 <hash_str+0x41>
xor    %r15d,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbq (%r14,%r15,1),%rax
shl    $0x5,%rbx
add    %rax,%rbx
add    $0x1,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%r15
jb     1130 <hash_str+0x20>
jmp    1153 <hash_str+0x43>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @hash_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
store i64 0, i64* %3
store i32 0, i32* %4
br label %5
5: ; preds = %22, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = icmp ult i32 %6, %8
br i1 %9, label %10, label %25
10: ; preds = %5
%11 = load i64, i64* %3
%12 = mul i64 31, %11
%13 = load i8*, i8** %2
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i64
%19 = add i64 %12, %18
%20 = load i64, i64* %3
%21 = add i64 %20, %19
store i64 %21, i64* %3
br label %22
22: ; preds = %10
%23 = load i32, i32* %4
%24 = add i32 %23, 1
store i32 %24, i32* %4
br label %5
25: ; preds = %5
%26 = load i64, i64* %3
ret i64 %26
}

LLVM IR (-O2):
define i64 @hash_str(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i64 [ 0, %1 ], [ %13, %6 ]
ret i64 %5
6: ; preds = %1, %6
%7 = phi i64 [ %14, %6 ], [ 0, %1 ]
%8 = phi i64 [ %13, %6 ], [ 0, %1 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = sext i8 %10 to i64
%12 = shl i64 %8, 5
%13 = add i64 %12, %11
%14 = add nuw nsw i64 %7, 1
%15 = tail call i32 @strlen(i8* %0)
%16 = zext i32 %15 to i64
%17 = icmp ult i64 %14, %16
br i1 %17, label %6, label %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int main() {
  int age = 23;
  char name[] = "Hamad Albuthie";
  printf("My name is %s I am %d years old \n", name, age);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x17,-0x8(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x17(%rbp)
mov    0xed1(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xecb(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0x17(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x6569687475626c,%rax
mov    %rax,0xf(%rsp)
movabs $0x6c412064616d6148,%rax
20 41 6c
mov    %rax,0x8(%rsp)
lea    0xed6(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    $0x17,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.name = [15 x i8] c"Hamad Albuthie\00"
@.str = [34 x i8] c"My name is %s I am %d years old \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [15 x i8]
store i32 0, i32* %1
store i32 23, i32* %2
%4 = bitcast [15 x i8]* %3 to i8*
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.name = [15 x i8] c"Hamad Albuthie\00"
@.str = [34 x i8] c"My name is %s I am %d years old \0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %2, i32 23)
ret i32 0
}
int remove_eldest(const struct l_hashtbl *h, unsigned long nentries) {
  (void)(h);
  (void)(nentries);
  return 0;
}


x86 assembly (clang, -O0):
<remove_eldest>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.l_hashtbl = type opaque
define i32 @remove_eldest(%struct.l_hashtbl* %0, i64 %1) {
%3 = alloca %struct.l_hashtbl*
%4 = alloca i64
store %struct.l_hashtbl* %0, %struct.l_hashtbl** %3
store i64 %1, i64* %4
%5 = load %struct.l_hashtbl*, %struct.l_hashtbl** %3
%6 = load i64, i64* %4
ret i32 0
}

LLVM IR (-O2):
%struct.l_hashtbl = type opaque
define i32 @remove_eldest(%struct.l_hashtbl* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Type definitions */
struct winsize {
  int ws_col;
};

/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ TIOCGWINSZ;
int /*<<< orphan*/ ioctl(int /*<<< orphan*/, int /*<<< orphan*/,
                         struct winsize *);
int mm_screen_width() {
  struct winsize size;
  ioctl(STDOUT_FILENO, TIOCGWINSZ, &size);
  return size.ws_col;
}


x86 assembly (clang, -O0):
<mm_screen_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdx
call   1030 <ioctl@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_screen_width>:
push   %rax
mov    0x2ed8(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.winsize = type { i32 }
@STDOUT_FILENO = global i32 0
@TIOCGWINSZ = global i32 0
define i32 @mm_screen_width() {
%1 = alloca %struct.winsize
%2 = load i32, i32* @STDOUT_FILENO
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i32 @ioctl(i32 %2, i32 %3, %struct.winsize* %1)
%5 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i32 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.winsize = type { i32 }
@STDOUT_FILENO = global i32 0
@TIOCGWINSZ = global i32 0
define i32 @mm_screen_width() {
%1 = alloca %struct.winsize
%2 = bitcast %struct.winsize* %1 to i8*
%3 = load i32, i32* @STDOUT_FILENO
%4 = load i32, i32* @TIOCGWINSZ
%5 = call i32 @ioctl(i32 %3, i32 %4, %struct.winsize* %1)
%6 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ x;

/* Variables and functions */
scalar_t__ is_little_endian();
int convert_to_little_endian(int x) {
  if (is_little_endian()) {
    return x;
  } else {
    return ((
        unsigned int)((((unsigned int)(x) & (unsigned int)0x000000ffU) << 24) |
                      (((unsigned int)(x) & (unsigned int)0x0000ff00U) << 8) |
                      (((unsigned int)(x) & (unsigned int)0x00ff0000U) >> 8) |
                      (((unsigned int)(x) & (unsigned int)0xff000000U) >> 24)));
  }
}


x86 assembly (clang, -O0):
<convert_to_little_endian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <is_little_endian@plt>
cmp    $0x0,%rax
je     1137 <convert_to_little_endian+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116f <convert_to_little_endian+0x5f>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff0000,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_to_little_endian>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <is_little_endian@plt>
test   %rax,%rax
mov    %ebx,%eax
bswap  %eax
cmovne %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @convert_to_little_endian(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i64 (...) @is_little_endian()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %24
8: ; preds = %1
%9 = load i32, i32* %3
%10 = and i32 %9, 255
%11 = shl i32 %10, 24
%12 = load i32, i32* %3
%13 = and i32 %12, 65280
%14 = shl i32 %13, 8
%15 = or i32 %11, %14
%16 = load i32, i32* %3
%17 = and i32 %16, 16711680
%18 = lshr i32 %17, 8
%19 = or i32 %15, %18
%20 = load i32, i32* %3
%21 = and i32 %20, -16777216
%22 = lshr i32 %21, 24
%23 = or i32 %19, %22
store i32 %23, i32* %2
br label %24
24: ; preds = %8, %6
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @convert_to_little_endian(i32 %0) {
%2 = tail call i64 (...) @is_little_endian()
%3 = icmp eq i64 %2, 0
%4 = tail call i32 @llvm.bswap.i32(i32 %0)
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ prog1();
int /*<<< orphan*/ prog2();
int main(int argc, char *argv[]) {
  printf("Hello from program.c\n");
  prog1();
  prog2();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <prog1@plt>
xor    %eax,%eax
call   1050 <prog2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Hello from program.c\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @prog1()
%8 = call i32 (...) @prog2()
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"Hello from program.c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @prog1()
%5 = tail call i32 (...) @prog2()
ret i32 0
}
/* Variables and functions */
int write(int, char *, int);
void moveCursorLeft(void) {
  int rc;
  (void)rc;
  rc = write(1, "\b", 1);
}


x86 assembly (clang, -O0):
<moveCursorLeft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edx
lea    0xedc(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moveCursorLeft>:
lea    0xee9(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
jmp    1030 <write@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\08\00"
define void @moveCursorLeft() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int waitpid(int, int /*<<< orphan*/, int /*<<< orphan*/);
int g_waitpid(int pid) { return waitpid(pid, 0, 0); }


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

x86 assembly (clang, -O2):
<g_waitpid>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <waitpid@plt>

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

LLVM IR (-O2):
define i32 @g_waitpid(i32 %0) {
%2 = tail call i32 @waitpid(i32 %0, i32 0, i32 0)
ret i32 %2
}
void a_or(volatile void *p, int v) {
  (void)__sync_fetch_and_or((volatile int *)p, v);
}


x86 assembly (clang, -O0):
<a_or>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
lock or %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_or>:
lock or %esi,(%rdi)
ret

LLVM IR (-O0):
define void @a_or(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %4
%8 = atomicrmw or i32* %6, i32 %7 seq_cst
ret void
}

LLVM IR (-O2):
define void @a_or(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = atomicrmw or i32* %3, i32 %1 seq_cst
ret void
}
/* Variables and functions */
double drand48();
__attribute__((__weak__, __always___)) double softboundcets_drand48() {
  return drand48();
}


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

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

LLVM IR (-O0):
define weak double @softboundcets_drand48() {
%1 = call double (...) @drand48()
ret double %1
}

LLVM IR (-O2):
define weak double @softboundcets_drand48() {
%1 = tail call double (...) @drand48()
ret double %1
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int matches(const char *str0, const char *str1) {
  if (str0 == NULL || str1 == NULL)
    return (str0 == str1);
  return (strcmp(str0, str1) == 0);
}


x86 assembly (clang, -O0):
<matches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <matches+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    114e <matches+0x3e>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    116a <matches+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matches>:
test   %rdi,%rdi
je     112e <matches+0x1e>
test   %rsi,%rsi
je     112e <matches+0x1e>
push   %rax
call   1030 <strcmp@plt>
test   %rax,%rax
sete   %al
add    $0x8,%rsp
movzbl %al,%eax
ret
cmp    %rsi,%rdi
sete   %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @matches(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = icmp eq i8* %0, %1
br label %11
8: ; preds = %2
%9 = tail call i64 @strcmp(i8* %0, i8* %1)
%10 = icmp eq i64 %9, 0
br label %11
11: ; preds = %8, %6
%12 = phi i1 [ %7, %6 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
size_t noop(void *param, const char *s, size_t nBytes) {
  (void)param;
  (void)s;
  return nBytes;
}


x86 assembly (clang, -O0):
<noop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<noop>:
mov    %rdx,%rax
ret

LLVM IR (-O0):
define i64 @noop(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
ret i64 %9
}

LLVM IR (-O2):
define i64 @noop(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 returned %2) {
ret i64 %2
}
/* Variables and functions */
int cos(float);
float cos_interp(float v0, float v1, float t) {
  float t2;
  t2 = (1 - cos(t * 3.14159)) / 2;
  return (v0 * (1 - t2) + v1 * t2);
}


x86 assembly (clang, -O0):
<cos_interp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <cos@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe94(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos_interp>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xed5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <cos@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  0xeb5(%rip),%xmm0
subss  %xmm1,%xmm0
movss  (%rsp),%xmm2
mulss  %xmm1,%xmm2
mulss  0x4(%rsp),%xmm0
addss  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @cos_interp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %6
%9 = fpext float %8 to double
%10 = fmul double %9, 3.141590e+00
%11 = fptrunc double %10 to float
%12 = call i32 @cos(float %11)
%13 = sub nsw i32 1, %12
%14 = sdiv i32 %13, 2
%15 = sitofp i32 %14 to float
store float %15, float* %7
%16 = load float, float* %4
%17 = load float, float* %7
%18 = fsub float 1.000000e+00, %17
%19 = load float, float* %5
%20 = load float, float* %7
%21 = fmul float %19, %20
%22 = call float @llvm.fmuladd.f32(float %16, float %18, float %21)
ret float %22
}

LLVM IR (-O2):
define float @cos_interp(float %0, float %1, float %2) {
%4 = fpext float %2 to double
%5 = fmul double %4, 3.141590e+00
%6 = fptrunc double %5 to float
%7 = tail call i32 @cos(float %6)
%8 = sub nsw i32 1, %7
%9 = sdiv i32 %8, 2
%10 = sitofp i32 %9 to float
%11 = fsub float 1.000000e+00, %10
%12 = fmul float %10, %1
%13 = tail call float @llvm.fmuladd.f32(float %0, float %11, float %12)
ret float %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int __detect_PLATFORM_ENV_OS_FEATURE_DETAIL() {
  printf("(0");
  if (sizeof(void *) == 4) {
  } else if (sizeof(void *) == 8) {
    printf(" | TT_ENV_OS_FEATURE_64BIT");
  }
  printf(")");
  return 0;
}


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

x86 assembly (clang, -O2):
<__detect_PLATFORM_ENV_OS_FEATURE_DETAIL>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x29,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"(0\00"
@.str.1 = [27 x i8] c" | TT_ENV_OS_FEATURE_64BIT\00"
@.str.2 = [2 x i8] c")\00"
define i32 @__detect_PLATFORM_ENV_OS_FEATURE_DETAIL() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"(0\00"
@.str.1 = [27 x i8] c" | TT_ENV_OS_FEATURE_64BIT\00"
define i32 @__detect_PLATFORM_ENV_OS_FEATURE_DETAIL() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 41)
ret i32 0
}
unsigned long asm_btc(unsigned long *f, unsigned long i) {
  unsigned long ret;
  asm("btcq  %2, %1 \n"
      "sbbq %0, %0"
      : "=r"(ret)
      : "m"(*f), "r"(i));
  return ret;
}


x86 assembly (clang, -O0):
<asm_btc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
btc    %rcx,(%rax)
sbb    %rax,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_btc>:
btc    %rsi,(%rdi)
sbb    %rax,%rax
ret

LLVM IR (-O0):
define i64 @asm_btc(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %4
%8 = call i64 asm "btcq $2, $1 \0Asbbq $0, $0", "=r,*m,r,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %6, i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @asm_btc(i64* %0, i64 %1) {
%3 = tail call i64 asm "btcq $2, $1 \0Asbbq $0, $0", "=r,*m,r,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_s5();
int /*<<< orphan*/ take_struct_s5(int /*<<< orphan*/);
void test_struct_s5() { take_struct_s5(return_struct_s5()); }


x86 assembly (clang, -O0):
<test_struct_s5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <return_struct_s5@plt>
mov    %eax,%edi
call   1040 <take_struct_s5@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_s5>:
push   %rax
xor    %eax,%eax
call   1030 <return_struct_s5@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <take_struct_s5@plt>

LLVM IR (-O0):
define void @test_struct_s5() {
%1 = call i32 (...) @return_struct_s5()
%2 = call i32 @take_struct_s5(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_s5() {
%1 = tail call i32 (...) @return_struct_s5()
%2 = tail call i32 @take_struct_s5(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void grpcsharp_auth_property_iterator_next() {
  fprintf(stderr, "Should never reach here");
  abort();
}


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

x86 assembly (clang, -O2):
<grpcsharp_auth_property_iterator_next>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_auth_property_iterator_next() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_auth_property_iterator_next() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
int owProgramPulse(int portnum) {
  portnum = 0;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @owProgramPulse(i32 %0) {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void CONV_OUT_16(uint8_t *buf, uint16_t i) {
  buf[0] = (i >> 8) & 0xFF;
  buf[1] = i & 0xFF;
}


x86 assembly (clang, -O0):
<CONV_OUT_16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CONV_OUT_16>:
mov    %esi,%eax
movzbl %ah,%ecx
mov    %ecx,(%rdi)
movzbl %al,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @CONV_OUT_16(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 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %4
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
define void @CONV_OUT_16(i32* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = and i32 %3, 255
store i32 %4, i32* %0
%5 = and i32 %1, 255
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
void reverse(const char *const sPtr) {
  if ('\0' == sPtr[0]) {
    return;
  } else {
    reverse(&sPtr[1]);
    putchar(sPtr[0]);
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1142 <reverse+0x22>
jmp    115b <reverse+0x3b>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <reverse@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbx
cmpb   $0x0,(%rdi)
je     113b <reverse+0x1b>
mov    %rdi,%rbx
add    $0x1,%rdi
call   1030 <reverse@plt>
movsbl (%rbx),%edi
pop    %rbx
jmp    1040 <putchar@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @reverse(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1, %5
ret void
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
tail call void @reverse(i8* %6)
%7 = load i8, i8* %0
%8 = tail call i32 @putchar(i8 signext %7)
br label %4
}
/* Variables and functions */
int tolower(int);
__attribute__((__weak__, __always___)) int softboundcets_tolower(int c) {
  return tolower(c);
}


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

x86 assembly (clang, -O2):
<softboundcets_tolower>:
jmp    1030 <tolower@plt>

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

LLVM IR (-O2):
define weak i32 @softboundcets_tolower(i32 %0) {
%2 = tail call i32 @tolower(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
int /*<<< orphan*/ return_42();
return_zero() {
  return_42();
  echo("cau");
}


x86 assembly (clang, -O0):
<return_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <return_42@plt>
lea    0xeca(%rip),%rdi
call   1030 <echo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_zero>:
push   %rax
xor    %eax,%eax
call   1040 <return_42@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <echo@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"cau\00"
define i32 @return_zero() {
%1 = tail call i32 (...) @return_42()
%2 = tail call i32 @echo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ use(int);
void func2(int cond) {
  int x;
  int flag = 0;
  if (cond) {
    x = 1;
    flag = 1;
  }
  foo();
  if (flag)
    use(x);
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114a <func2+0x2a>
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
cmpl   $0x0,-0xc(%rbp)
je     1163 <func2+0x43>
mov    -0x8(%rbp),%edi
call   1030 <use@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <foo@plt>
test   %ebx,%ebx
je     1139 <func2+0x19>
mov    $0x1,%edi
pop    %rbx
jmp    1030 <use@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @func2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
store i32 1, i32* %4
br label %8
8: ; preds = %7, %1
%9 = call i32 (...) @foo()
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @use(i32 %13)
br label %15
15: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
define void @func2(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = tail call i32 (...) @foo()
br i1 %2, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @use(i32 1)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int main_arena_offset();
int /*<<< orphan*/ printf(char *, int, char *);
scalar_t__ tcache_enable();
int main(int argc, char **argv) {
  printf("{"
         "\"main_arena_offset\": %u,"
         "\"tcache_enable\": %s"
         "}\n",
         main_arena_offset(), tcache_enable() ? "true" : "false");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <main_arena_offset@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <tcache_enable@plt>
mov    -0x14(%rbp),%esi
mov    %rax,%rcx
lea    0xed0(%rip),%rdx
lea    0xec4(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <main_arena_offset@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <tcache_enable@plt>
test   %rax,%rax
lea    0xee9(%rip),%rax
lea    0xedd(%rip),%rdx
cmove  %rax,%rdx
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"{\22main_arena_offset\22: %u,\22tcache_enable\22: %s}\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @main_arena_offset()
%7 = call i64 (...) @tcache_enable()
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"{\22main_arena_offset\22: %u,\22tcache_enable\22: %s}\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @main_arena_offset()
%4 = tail call i64 (...) @tcache_enable()
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ direct_walk_test();
int /*<<< orphan*/ general_test();
int /*<<< orphan*/ inverted_walk_test();
int /*<<< orphan*/ left_right_walk_test();
int /*<<< orphan*/ right_left_walk_test();
void run_tests() {
  general_test();
  left_right_walk_test();
  right_left_walk_test();
  direct_walk_test();
  inverted_walk_test();
}


x86 assembly (clang, -O0):
<run_tests>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <general_test@plt>
mov    $0x0,%al
call   1040 <left_right_walk_test@plt>
mov    $0x0,%al
call   1050 <right_left_walk_test@plt>
mov    $0x0,%al
call   1030 <direct_walk_test@plt>
mov    $0x0,%al
call   1070 <inverted_walk_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_tests>:
push   %rax
xor    %eax,%eax
call   1060 <general_test@plt>
xor    %eax,%eax
call   1040 <left_right_walk_test@plt>
xor    %eax,%eax
call   1050 <right_left_walk_test@plt>
xor    %eax,%eax
call   1030 <direct_walk_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <inverted_walk_test@plt>

LLVM IR (-O0):
define void @run_tests() {
%1 = call i32 (...) @general_test()
%2 = call i32 (...) @left_right_walk_test()
%3 = call i32 (...) @right_left_walk_test()
%4 = call i32 (...) @direct_walk_test()
%5 = call i32 (...) @inverted_walk_test()
ret void
}

LLVM IR (-O2):
define void @run_tests() {
%1 = tail call i32 (...) @general_test()
%2 = tail call i32 (...) @left_right_walk_test()
%3 = tail call i32 (...) @right_left_walk_test()
%4 = tail call i32 (...) @direct_walk_test()
%5 = tail call i32 (...) @inverted_walk_test()
ret void
}
/* Type definitions */
struct proctal {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ proctal_implementation_watch_start(struct proctal *);
void proctal_watch_start(struct proctal *p) {
  proctal_implementation_watch_start(p);
}


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

x86 assembly (clang, -O2):
<proctal_watch_start>:
jmp    1030 <proctal_implementation_watch_start@plt>

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

LLVM IR (-O2):
%struct.proctal = type { i32 }
define void @proctal_watch_start(%struct.proctal* %0) {
%2 = tail call i32 @proctal_implementation_watch_start(%struct.proctal* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
void baselineLT(unsigned a) {
  char *b = ((void *)0);
  if (a < -1U)
    b = malloc(1);
  if (a == -1U)
    return;
  free(b);
}


x86 assembly (clang, -O0):
<baselineLT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jae    114b <baselineLT+0x2b>
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    115a <baselineLT+0x3a>
jmp    1163 <baselineLT+0x43>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baselineLT>:
cmp    $0xffffffff,%edi
je     1139 <baselineLT+0x19>
push   %rax
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @baselineLT(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %3
%4 = load i32, i32* %2
%5 = icmp ult i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i8* @malloc(i32 1)
store i8* %7, i8** %3
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %8
br label %15
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = call i32 @free(i8* %13)
br label %15
15: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @baselineLT(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%5 = tail call i32 @free(i8* %4)
br label %6
6: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arg_char2(char, char);
void arg_char1(char i) { arg_char2(i, i + 1); }


x86 assembly (clang, -O0):
<arg_char1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%cl
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <arg_char2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_char1>:
lea    0x1(%rdi),%eax
movsbl %al,%esi
jmp    1030 <arg_char2@plt>

LLVM IR (-O0):
define void @arg_char1(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, 1
%7 = trunc i32 %6 to i8
%8 = call i32 @arg_char2(i8 signext %3, i8 signext %7)
ret void
}

LLVM IR (-O2):
define void @arg_char1(i8 signext %0) {
%2 = add i8 %0, 1
%3 = tail call i32 @arg_char2(i8 signext %0, i8 signext %2)
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t rotl_64c(short dummy, uint64_t x) { return (x << 40) | (x >> 24); }


x86 assembly (clang, -O0):
<rotl_64c>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x28,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%ecx
sar    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rotl_64c(i16 signext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 %5, 40
%7 = load i32, i32* %4
%8 = ashr i32 %7, 24
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @rotl_64c(i16 signext %0, i32 %1) {
ret i32 poison
}