xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_triangle(void) { printf("I'm a Triangle\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"I'm a Triangle\0A\00"
define void @print_triangle() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"I'm a Triangle\00"
define void @print_triangle() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
int clock_check_res(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @clock_check_res() {
ret i32 0
}
/* Type definitions */
struct avl_table {
  int dummy;
};

/* Variables and functions */
void **avl_probe(struct avl_table *, void *);
void *avl_insert(struct avl_table *table, void *item) {
  void **p = avl_probe(table, item);
  return p == NULL || *p == item ? NULL : *p;
}


x86 assembly (clang, -O0):
<avl_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <avl_probe@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114d <avl_insert+0x3d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    1158 <avl_insert+0x48>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1163 <avl_insert+0x53>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<avl_insert>:
push   %rbx
mov    %rsi,%rbx
call   1030 <avl_probe@plt>
test   %rax,%rax
je     112c <avl_insert+0x1c>
mov    (%rax),%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
cmovne %rcx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.avl_table = type { i32 }
define i8* @avl_insert(%struct.avl_table* %0, i8* %1) {
%3 = alloca %struct.avl_table*
%4 = alloca i8*
%5 = alloca i8**
store %struct.avl_table* %0, %struct.avl_table** %3
store i8* %1, i8** %4
%6 = load %struct.avl_table*, %struct.avl_table** %3
%7 = load i8*, i8** %4
%8 = call i8** @avl_probe(%struct.avl_table* %6, i8* %7)
store i8** %8, i8*** %5
%9 = load i8**, i8*** %5
%10 = icmp eq i8** %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = load i8*, i8** %4
%15 = icmp eq i8* %13, %14
br i1 %15, label %16, label %17
16: ; preds = %11, %2
br label %20
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
br label %20
20: ; preds = %17, %16
%21 = phi i8* [ null, %16 ], [ %19, %17 ]
ret i8* %21
}

LLVM IR (-O2):
%struct.avl_table = type { i32 }
define i8* @avl_insert(%struct.avl_table* %0, i8* %1) {
%3 = tail call i8** @avl_probe(%struct.avl_table* %0, i8* %1)
%4 = icmp eq i8** %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
%8 = select i1 %7, i8* null, i8* %6
br label %9
9: ; preds = %5, %2
%10 = phi i8* [ null, %2 ], [ %8, %5 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void gen_opf(int op) { printf("OPF op %d\n", op); }


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

x86 assembly (clang, -O2):
<gen_opf>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"OPF op %d\0A\00"
define void @gen_opf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"OPF op %d\0A\00"
define void @gen_opf(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ readmem65816(int /*<<< orphan*/);
int /*<<< orphan*/ sbc8(int /*<<< orphan*/);
int /*<<< orphan*/ zeropage();
void sbcZp8(void) { sbc8(readmem65816(zeropage())); }


x86 assembly (clang, -O0):
<sbcZp8>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <zeropage@plt>
mov    %eax,%edi
call   1050 <readmem65816@plt>
mov    %eax,%edi
call   1040 <sbc8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbcZp8>:
push   %rax
xor    %eax,%eax
call   1030 <zeropage@plt>
mov    %eax,%edi
call   1050 <readmem65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sbc8@plt>

LLVM IR (-O0):
define void @sbcZp8() {
%1 = call i32 (...) @zeropage()
%2 = call i32 @readmem65816(i32 %1)
%3 = call i32 @sbc8(i32 %2)
ret void
}

LLVM IR (-O2):
define void @sbcZp8() {
%1 = tail call i32 (...) @zeropage()
%2 = tail call i32 @readmem65816(i32 %1)
%3 = tail call i32 @sbc8(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exitTimer();
void borTimerExit() { exitTimer(); }


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

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

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

LLVM IR (-O2):
define void @borTimerExit() {
%1 = tail call i32 (...) @exitTimer()
ret void
}
char *print(char *s) { return s; }


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

x86 assembly (clang, -O2):
<print>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @print(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
float sigmoidf(float);
float sigmoiddf(float x) {
  float s = sigmoidf(x);
  return s * (1.f - s);
}


x86 assembly (clang, -O0):
<sigmoiddf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sigmoidf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xec7(%rip),%xmm1
subss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigmoiddf>:
push   %rax
call   1030 <sigmoidf@plt>
movss  0xee2(%rip),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @sigmoiddf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @sigmoidf(float %4)
store float %5, float* %3
%6 = load float, float* %3
%7 = load float, float* %3
%8 = fsub float 1.000000e+00, %7
%9 = fmul float %6, %8
ret float %9
}

LLVM IR (-O2):
define float @sigmoiddf(float %0) {
%2 = tail call float @sigmoidf(float %0)
%3 = fsub float 1.000000e+00, %2
%4 = fmul float %2, %3
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ CL_Disconnect();
int /*<<< orphan*/ Com_Quit();
void CL_Quit_f(void) {
  CL_Disconnect();
  Com_Quit();
}


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

x86 assembly (clang, -O2):
<CL_Quit_f>:
push   %rax
xor    %eax,%eax
call   1040 <CL_Disconnect@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <Com_Quit@plt>

LLVM IR (-O0):
define void @CL_Quit_f() {
%1 = call i32 (...) @CL_Disconnect()
%2 = call i32 (...) @Com_Quit()
ret void
}

LLVM IR (-O2):
define void @CL_Quit_f() {
%1 = tail call i32 (...) @CL_Disconnect()
%2 = tail call i32 (...) @Com_Quit()
ret void
}
/* Variables and functions */
int rand();
int random_in_range(int start, int end) {
  return rand() % (end - start + 1) + start;
}


x86 assembly (clang, -O0):
<random_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_in_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_in_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @random_in_range(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ init();
int main(int argc, const char *argv[]) {
  init();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <init@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 (...) @init()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ error(int, char *);
scalar_t__ freerast(int);
scalar_t__ malloc(unsigned int);
char *rastalloc(unsigned size) {
  char *ptr;
  while ((ptr = (char *)malloc(size)) == NULL)
    if (freerast(1) == 0)
      error(1, "can't allocate memory for raster file");
  return (ptr);
}


x86 assembly (clang, -O0):
<rastalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    117b <rastalloc+0x4b>
mov    $0x1,%edi
call   1040 <freerast@plt>
cmp    $0x0,%rax
jne    1176 <rastalloc+0x46>
mov    $0x1,%edi
lea    0xe8f(%rip),%rsi
call   1050 <error@plt>
jmp    113b <rastalloc+0xb>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rastalloc>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <malloc@plt>
test   %rax,%rax
je     1148 <rastalloc+0x18>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xeb1(%rip),%r14
jmp    116c <rastalloc+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <malloc@plt>
test   %rax,%rax
jne    1140 <rastalloc+0x10>
mov    $0x1,%edi
call   1040 <freerast@plt>
test   %rax,%rax
jne    1160 <rastalloc+0x30>
mov    $0x1,%edi
mov    %r14,%rsi
call   1050 <error@plt>
jmp    1160 <rastalloc+0x30>

LLVM IR (-O0):
@.str = [38 x i8] c"can't allocate memory for raster file\00"
define i8* @rastalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %2
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = call i64 @freerast(i32 1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @error(i32 1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
br label %4
15: ; preds = %4
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [38 x i8] c"can't allocate memory for raster file\00"
define i8* @rastalloc(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1, %9
%5 = tail call i64 @freerast(i32 1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
%10 = tail call i64 @malloc(i32 %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %4, label %12
12: ; preds = %9, %1
%13 = phi i64 [ %2, %1 ], [ %10, %9 ]
%14 = inttoptr i64 %13 to i8*
ret i8* %14
}
/* Variables and functions */
char *alloc_test_malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *alloc_test_strdup(const char *string) {
  char *result;
  result = alloc_test_malloc(strlen(string) + 1);
  if (result == NULL) {
    return NULL;
  }
  strcpy(result, string);
  return result;
}


x86 assembly (clang, -O0):
<alloc_test_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <alloc_test_malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <alloc_test_strdup+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <alloc_test_strdup+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_test_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <alloc_test_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <alloc_test_strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @alloc_test_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @alloc_test_malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %1, %6
ret i8* %4
}
int volume_cilindro(int r, int h) { return 3.141592 * (r * r) * h; }


x86 assembly (clang, -O0):
<volume_cilindro>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm1
movsd  0xee3(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<volume_cilindro>:
imul   %edi,%edi
cvtsi2sd %edi,%xmm0
mulsd  0xef1(%rip),%xmm0
cvtsi2sd %esi,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
ret

LLVM IR (-O0):
define i32 @volume_cilindro(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* %3
%7 = mul nsw i32 %5, %6
%8 = sitofp i32 %7 to double
%9 = fmul double 0x400921FAFC8B007A, %8
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to double
%12 = fmul double %9, %11
%13 = fptosi double %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @volume_cilindro(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, %0
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 0x400921FAFC8B007A
%6 = sitofp i32 %1 to double
%7 = fmul double %5, %6
%8 = fptosi double %7 to i32
ret i32 %8
}
int clickplc_int32_enc(unsigned int number, unsigned char *stream4bytes) {
  int retval = 4;
  stream4bytes[0] = (unsigned char)(number >> 24);
  stream4bytes[1] = (unsigned char)((number >> 16) & 0x000000ff);
  stream4bytes[2] = (unsigned char)((number >> 8) & 0x000000ff);
  stream4bytes[3] = (unsigned char)(number & 0x000000ff);
  return (retval);
}


x86 assembly (clang, -O0):
<clickplc_int32_enc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clickplc_int32_enc>:
bswap  %edi
mov    %edi,(%rsi)
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @clickplc_int32_enc(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 4, i32* %5
%6 = load i32, i32* %3
%7 = lshr i32 %6, 24
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %3
%12 = lshr i32 %11, 16
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = load i32, i32* %3
%18 = lshr i32 %17, 8
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = load i32, i32* %3
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
define i32 @clickplc_int32_enc(i32 %0, i8* nocapture writeonly %1) {
%3 = lshr i32 %0, 24
%4 = trunc i32 %3 to i8
store i8 %4, i8* %1
%5 = lshr i32 %0, 16
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %0, 8
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %9, i8* %10
%11 = trunc i32 %0 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_map_bad_hash();
int /*<<< orphan*/ test_map_clear();
int /*<<< orphan*/ test_map_copy();
int /*<<< orphan*/ test_map_equals();
int /*<<< orphan*/ test_map_iterator();
int /*<<< orphan*/ test_map_large();
int /*<<< orphan*/ test_map_put();
int /*<<< orphan*/ test_map_remove();
void test_map(void) {
  test_map_put();
  test_map_remove();
  test_map_clear();
  test_map_large();
  test_map_bad_hash();
  test_map_iterator();
  test_map_copy();
  test_map_equals();
  printf("All map tests passed!\n");
}


x86 assembly (clang, -O0):
<test_map>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_map_put@plt>
mov    $0x0,%al
call   10a0 <test_map_remove@plt>
mov    $0x0,%al
call   10b0 <test_map_clear@plt>
mov    $0x0,%al
call   1090 <test_map_large@plt>
mov    $0x0,%al
call   1070 <test_map_bad_hash@plt>
mov    $0x0,%al
call   1080 <test_map_iterator@plt>
mov    $0x0,%al
call   1060 <test_map_copy@plt>
mov    $0x0,%al
call   1040 <test_map_equals@plt>
lea    0xe2d(%rip),%rdi
call   1050 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_map>:
push   %rax
xor    %eax,%eax
call   1030 <test_map_put@plt>
xor    %eax,%eax
call   10a0 <test_map_remove@plt>
xor    %eax,%eax
call   10b0 <test_map_clear@plt>
xor    %eax,%eax
call   1090 <test_map_large@plt>
xor    %eax,%eax
call   1070 <test_map_bad_hash@plt>
xor    %eax,%eax
call   1080 <test_map_iterator@plt>
xor    %eax,%eax
call   1060 <test_map_copy@plt>
xor    %eax,%eax
call   1050 <test_map_equals@plt>
lea    0xe30(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"All map tests passed!\0A\00"
define void @test_map() {
%1 = call i32 (...) @test_map_put()
%2 = call i32 (...) @test_map_remove()
%3 = call i32 (...) @test_map_clear()
%4 = call i32 (...) @test_map_large()
%5 = call i32 (...) @test_map_bad_hash()
%6 = call i32 (...) @test_map_iterator()
%7 = call i32 (...) @test_map_copy()
%8 = call i32 (...) @test_map_equals()
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"All map tests passed!\00"
define void @test_map() {
%1 = tail call i32 (...) @test_map_put()
%2 = tail call i32 (...) @test_map_remove()
%3 = tail call i32 (...) @test_map_clear()
%4 = tail call i32 (...) @test_map_large()
%5 = tail call i32 (...) @test_map_bad_hash()
%6 = tail call i32 (...) @test_map_iterator()
%7 = tail call i32 (...) @test_map_copy()
%8 = tail call i32 (...) @test_map_equals()
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char const *);
void argDump(const char **aArgs) {
  int i = 0;
  while (aArgs[i]) {
    printf("   %2d: '%s'\n", i, aArgs[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<argDump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     115f <argDump+0x4f>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <argDump+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argDump>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%rdx
test   %rdx,%rdx
je     1148 <argDump+0x38>
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed7(%rip),%r15
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x8(%r14,%rbx,8),%rdx
add    $0x1,%rbx
test   %rdx,%rdx
jne    1130 <argDump+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c" %2d: '%s'\0A\00"
define void @argDump(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8* [ %11, %4 ], [ %2, %1 ]
%7 = trunc i64 %5 to i32
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %6)
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *nv_strndup(char *s, int n) {
  char *m = malloc(n + 1);
  strncpy(m, s, n);
  m[n] = '\0';
  return (m);
}


x86 assembly (clang, -O0):
<nv_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nv_strndup>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @nv_strndup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @strncpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @nv_strndup(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ fioWrite(int, char const *, int);
int strlen(char const *);
void flush_stream(const char *buffer) {
  const char *begin = buffer;
  const char *end = begin + strlen(begin);
  fioWrite(1, begin, end - begin);
}


x86 assembly (clang, -O0):
<flush_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <fioWrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_stream>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <fioWrite@plt>

LLVM IR (-O0):
define void @flush_stream(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
store i8* %10, i8** %4
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = trunc i64 %16 to i32
%18 = call i32 @fioWrite(i32 1, i8* %11, i32 %17)
ret void
}

LLVM IR (-O2):
define void @flush_stream(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @fioWrite(i32 1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ enableRawMode();
int read(int /*<<< orphan*/, char *, int);
int main() {
  enableRawMode();
  char c;
  while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q')
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <enableRawMode@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x6(%rbp)
jne    116a <main+0x4a>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
setne  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
test   $0x1,%al
jne    117a <main+0x5a>
jmp    117f <main+0x5f>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <enableRawMode@plt>
mov    0x2eae(%rip),%r14
lea    0x7(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
jne    115c <main+0x3c>
cmpb   $0x71,0x7(%rsp)
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @enableRawMode()
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* @STDIN_FILENO
%6 = call i32 @read(i32 %5, i8* %2, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 113
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ false, %4 ], [ %11, %8 ]
br i1 %13, label %14, label %15
14: ; preds = %12
br label %4
15: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (...) @enableRawMode()
br label %3
3: ; preds = %3, %0
%4 = load i32, i32* @STDIN_FILENO
%5 = call i32 @read(i32 %4, i8* %1, i32 1)
%6 = icmp eq i32 %5, 1
%7 = load i8, i8* %1
%8 = icmp ne i8 %7, 113
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %3, label %10
10: ; preds = %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *, ...);
void *valloc(size_t);
__attribute__((visibility("hidden"))) void *xvalloc(size_t size) {
  void *ptr;
  if (size == 0)
    panic("xmalloc: zero size\n");
  ptr = valloc(size);
  if (ptr == NULL)
    panic("xvalloc: out of memory (allocating %zu bytes)\n", size);
  return ptr;
}


x86 assembly (clang, -O0):
<xvalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1145 <xvalloc+0x25>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <panic@plt>
mov    -0x8(%rbp),%rdi
call   1040 <valloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <xvalloc+0x4f>
mov    -0x8(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <panic@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xvalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
jne    113a <xvalloc+0x1a>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <panic@plt>
mov    %r14,%rdi
call   1040 <valloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115b <xvalloc+0x3b>
lea    0xec3(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <panic@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"xmalloc: zero size\0A\00"
@.str.1 = [47 x i8] c"xvalloc: out of memory (allocating %zu bytes)\0A\00"
define hidden i8* @xvalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @panic(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i64, i64* %2
%10 = call i8* @valloc(i64 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i64, i64* %2
%15 = call i32 (i8*, ...) @panic(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %13, %8
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [20 x i8] c"xmalloc: zero size\0A\00"
@.str.1 = [47 x i8] c"xvalloc: out of memory (allocating %zu bytes)\0A\00"
define hidden noalias i8* @xvalloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @panic(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i8* @valloc(i64 %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @panic(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i64 %0)
br label %10
10: ; preds = %8, %5
ret i8* %6
}
long SIO1_configure(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @SIO1_configure() {
ret i64 0
}

LLVM IR (-O2):
define i64 @SIO1_configure() {
ret i64 0
}
/* Variables and functions */
float logf(float);
float __ocl_native_log_float(float src) { return logf(src); }


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

x86 assembly (clang, -O2):
<__ocl_native_log_float>:
jmp    1030 <logf@plt>

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

LLVM IR (-O2):
define float @__ocl_native_log_float(float %0) {
%2 = tail call float @logf(float %0)
ret float %2
}
/* Variables and functions */
int S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXOTH;
int mkdir(char const *, int);
int make_dir(const char *cache_dir) {
  return mkdir(cache_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}


x86 assembly (clang, -O0):
<make_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
or     (%rax),%esi
mov    0x2e8f(%rip),%rax
or     (%rax),%esi
mov    0x2e9e(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_dir>:
mov    0x2ed1(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e9f(%rip),%rax
or     (%rax),%esi
mov    0x2eae(%rip),%rax
or     (%rax),%esi
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @make_dir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @S_IRWXU
%5 = load i32, i32* @S_IRWXG
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IROTH
%8 = or i32 %6, %7
%9 = load i32, i32* @S_IXOTH
%10 = or i32 %8, %9
%11 = call i32 @mkdir(i8* %3, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
define i32 @make_dir(i8* nocapture %0) {
%2 = load i32, i32* @S_IRWXU
%3 = load i32, i32* @S_IRWXG
%4 = or i32 %3, %2
%5 = load i32, i32* @S_IROTH
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IXOTH
%8 = or i32 %6, %7
%9 = tail call i32 @mkdir(i8* %0, i32 %8)
ret i32 %9
}
/* Type definitions */
struct redfish_dirp {
  int dummy;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
void do_closedir(struct redfish_dirp *dp) {
  DIR *rdp = (DIR *)dp;
  closedir(rdp);
}


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

x86 assembly (clang, -O2):
<do_closedir>:
jmp    1030 <closedir@plt>

LLVM IR (-O0):
%struct.redfish_dirp = type { i32 }
define void @do_closedir(%struct.redfish_dirp* %0) {
%2 = alloca %struct.redfish_dirp*
%3 = alloca i32*
store %struct.redfish_dirp* %0, %struct.redfish_dirp** %2
%4 = load %struct.redfish_dirp*, %struct.redfish_dirp** %2
%5 = bitcast %struct.redfish_dirp* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @closedir(i32* %6)
ret void
}

LLVM IR (-O2):
%struct.redfish_dirp = type { i32 }
define void @do_closedir(%struct.redfish_dirp* nocapture %0) {
%2 = getelementptr %struct.redfish_dirp, %struct.redfish_dirp* %0, i64 0, i32 0
%3 = tail call i32 @closedir(i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *realloc_(void *ptr, size_t size) {
  void *result;
  result = realloc(ptr, size);
  if (result == NULL) {
    perror("realloc_");
    exit(-2);
  }
  return result;
}


x86 assembly (clang, -O0):
<realloc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1172 <realloc_+0x42>
lea    0xe9d(%rip),%rdi
call   1040 <perror@plt>
mov    $0xfffffffe,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc_>:
push   %rax
call   1030 <realloc@plt>
test   %rax,%rax
je     113d <realloc_+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0xfffffffe,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"realloc_\00"
define i8* @realloc_(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 -2)
unreachable
14: ; preds = %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@.str = [9 x i8] c"realloc_\00"
define noalias i8* @realloc_(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -2)
unreachable
8: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ load_machine_word_t_unaligned(void const *);
int /*<<< orphan*/ store_machine_word_t_unaligned(int /*<<< orphan*/, void *);
__attribute__((always_)) void copy_word_unaligned(const void *src, void *dst) {
  store_machine_word_t_unaligned(load_machine_word_t_unaligned(src), dst);
}


x86 assembly (clang, -O0):
<copy_word_unaligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <load_machine_word_t_unaligned@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <store_machine_word_t_unaligned@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_word_unaligned>:
push   %rbx
mov    %rsi,%rbx
call   1040 <load_machine_word_t_unaligned@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <store_machine_word_t_unaligned@plt>

LLVM IR (-O0):
define void @copy_word_unaligned(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @load_machine_word_t_unaligned(i8* %5)
%7 = load i8*, i8** %4
%8 = call i32 @store_machine_word_t_unaligned(i32 %6, i8* %7)
ret void
}

LLVM IR (-O2):
define void @copy_word_unaligned(i8* %0, i8* %1) {
%3 = tail call i32 @load_machine_word_t_unaligned(i8* %0)
%4 = tail call i32 @store_machine_word_t_unaligned(i32 %3, i8* %1)
ret void
}
void fa59(void) {
P0A:
  goto P0A;
  ({
    P01A:
      goto P01A;
      ({
        P012A:
          goto P012A;
          0;
      });
    a:
      ({
        p013A:
          goto p013A;
          goto a;
        P013A:
          goto P013A;
          0;
      });
    P01C:
      goto P01C;
      0;
  });
P0B:
  goto P0B;
  ({
    P02A:
      goto P02A;
      ({
        P024A:
          goto P024A;
          0;
      });
    P02B:
      goto P02B;
      ({
        P025A:
          goto P025A;
          0;
      });
    P02C:
      goto P02C;
      0;
  });
P0C:
  goto P0C;
  0;
P0D:
  goto P0D;
}


x86 assembly (clang, -O0):
<fa59>:
push   %rbp
mov    %rsp,%rbp
jmp    1104 <fa59+0x4>

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

LLVM IR (-O0):
define void @fa59() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
br label %7
7: ; preds = %7, %0
br label %7
8: ; No predecessors!
br label %9
9: ; preds = %9, %8
br label %9
10: ; No predecessors!
br label %11
11: ; preds = %11, %10
br label %11
12: ; No predecessors!
br label %13
13: ; preds = %13, %12
br label %13
14: ; preds = %14
br label %14
15: ; preds = %15
br label %15
16: ; preds = %16
br label %16
17: ; No predecessors!
br label %18
18: ; preds = %18, %17
br label %18
19: ; No predecessors!
br label %20
20: ; preds = %20, %19
br label %20
21: ; preds = %21
br label %21
22: ; No predecessors!
br label %23
23: ; preds = %23, %22
br label %23
24: ; preds = %24
br label %24
25: ; preds = %25
br label %25
26: ; preds = %26
br label %26
}

LLVM IR (-O2):
define void @fa59() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("THE NOC DID IT|noc=5;3;1;0;\n");
  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    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [29 x i8] c"THE NOC DID IT|noc=5;3;1;0;\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 ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"THE NOC DID IT|noc=5;3;1;0;\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ vecNd_scalarDiv_new(double *, double const *, double const,
                                       int);
void vec4d_scalarDiv_new(double result[4], const double v[4],
                         const double scalar) {
  vecNd_scalarDiv_new(result, v, scalar, 4);
}


x86 assembly (clang, -O0):
<vec4d_scalarDiv_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
mov    $0x4,%edx
call   1030 <vecNd_scalarDiv_new@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4d_scalarDiv_new>:
mov    $0x4,%edx
jmp    1030 <vecNd_scalarDiv_new@plt>

LLVM IR (-O0):
define void @vec4d_scalarDiv_new(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%7 = load double*, double** %4
%8 = load double*, double** %5
%9 = load double, double* %6
%10 = call i32 @vecNd_scalarDiv_new(double* %7, double* %8, double %9, i32 4)
ret void
}

LLVM IR (-O2):
define void @vec4d_scalarDiv_new(double* %0, double* %1, double %2) {
%4 = tail call i32 @vecNd_scalarDiv_new(double* %0, double* %1, double %2, i32 4)
ret void
}
int test_imm_10uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x10 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_10uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 16
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *calloc(size_t, int);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *iso_util_strcopy(const char *buf, size_t len) {
  char *str;
  str = calloc(len + 1, 1);
  if (str == NULL) {
    return NULL;
  }
  strncpy(str, buf, len);
  str[len] = '\0';
  return str;
}


x86 assembly (clang, -O0):
<iso_util_strcopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115e <iso_util_strcopy+0x3e>
movq   $0x0,-0x8(%rbp)
jmp    1183 <iso_util_strcopy+0x63>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_util_strcopy>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x1(%rsi),%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1154 <iso_util_strcopy+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @iso_util_strcopy(i8* %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @calloc(i64 %3, i32 1)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @strncpy(i8* %4, i8* %0, i64 %1)
%8 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %8
br label %9
9: ; preds = %2, %6
ret i8* %4
}
int add_numbers(int x, int y) { return (x + y); }


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

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

LLVM IR (-O0):
define i32 @add_numbers(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @add_numbers(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}