xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *prog) {
  fprintf(stderr, "Usage: %s INPUT PPM_OUTPUT\n", prog);
  fprintf(stderr, "Converts the custom image format to PPM\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s INPUT PPM_OUTPUT\0A\00"
@.str.1 = [41 x i8] c"Converts the custom image format to PPM\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s INPUT PPM_OUTPUT\0A\00"
@.str.1 = [41 x i8] c"Converts the custom image format to PPM\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
}
void func2(a) int a;
{}


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

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

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

LLVM IR (-O2):
define void @func2(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ miuiInstall_show_progress(float, int);
void ui_show_progress(float portion, int seconds) {
  miuiInstall_show_progress(portion, seconds);
}


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

x86 assembly (clang, -O2):
<ui_show_progress>:
jmp    1030 <miuiInstall_show_progress@plt>

LLVM IR (-O0):
define void @ui_show_progress(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%5 = load float, float* %3
%6 = load i32, i32* %4
%7 = call i32 @miuiInstall_show_progress(float %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @ui_show_progress(float %0, i32 %1) {
%3 = tail call i32 @miuiInstall_show_progress(float %0, i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ GLeeInit();
int /*<<< orphan*/ pglFlushVertexArrayRangeNV();
void _Lazy_glFlushVertexArrayRangeNV(void) {
  if (GLeeInit())
    pglFlushVertexArrayRangeNV();
}


x86 assembly (clang, -O0):
<_Lazy_glFlushVertexArrayRangeNV>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GLeeInit@plt>
cmp    $0x0,%rax
je     113c <_Lazy_glFlushVertexArrayRangeNV+0x1c>
mov    $0x0,%al
call   1040 <pglFlushVertexArrayRangeNV@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Lazy_glFlushVertexArrayRangeNV>:
push   %rax
xor    %eax,%eax
call   1030 <GLeeInit@plt>
test   %rax,%rax
je     1135 <_Lazy_glFlushVertexArrayRangeNV+0x15>
xor    %eax,%eax
pop    %rcx
jmp    1040 <pglFlushVertexArrayRangeNV@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @_Lazy_glFlushVertexArrayRangeNV() {
%1 = call i64 (...) @GLeeInit()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 (...) @pglFlushVertexArrayRangeNV()
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
define void @_Lazy_glFlushVertexArrayRangeNV() {
%1 = tail call i64 (...) @GLeeInit()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @pglFlushVertexArrayRangeNV()
br label %5
5: ; preds = %3, %0
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void branch(uint8_t *branch, uint8_t *dest) {
  int offset = dest - branch - 8;
  branch[0] = (offset >> 2) & 0xff;
  branch[1] = (offset >> 10) & 0xff;
  branch[2] = (offset >> 18) & 0xff;
  branch[3] = 0xea;
}


x86 assembly (clang, -O0):
<branch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
sub    $0x8,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
sar    $0xa,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x14(%rbp),%ecx
sar    $0x12,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0xea,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<branch>:
sub    %rdi,%rsi
shr    $0x2,%rsi
add    $0xfffffff8,%esi
mov    %esi,%eax
shr    $0x2,%eax
movzbl %al,%eax
mov    %eax,(%rdi)
mov    %esi,%eax
shr    $0xa,%eax
movzbl %al,%eax
mov    %eax,0x4(%rdi)
shr    $0x12,%esi
movzbl %sil,%eax
mov    %eax,0x8(%rdi)
movl   $0xea,0xc(%rdi)
ret

LLVM IR (-O0):
define void @branch(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32*, i32** %3
%8 = ptrtoint i32* %6 to i64
%9 = ptrtoint i32* %7 to i64
%10 = sub i64 %8, %9
%11 = sdiv exact i64 %10, 4
%12 = sub nsw i64 %11, 8
%13 = trunc i64 %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = ashr i32 %14, 2
%16 = and i32 %15, 255
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 0
store i32 %16, i32* %18
%19 = load i32, i32* %5
%20 = ashr i32 %19, 10
%21 = and i32 %20, 255
%22 = load i32*, i32** %3
%23 = getelementptr inbounds i32, i32* %22, i64 1
store i32 %21, i32* %23
%24 = load i32, i32* %5
%25 = ashr i32 %24, 18
%26 = and i32 %25, 255
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i64 2
store i32 %26, i32* %28
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i64 3
store i32 234, i32* %30
ret void
}

LLVM IR (-O2):
define void @branch(i32* %0, i32* %1) {
%3 = ptrtoint i32* %1 to i64
%4 = ptrtoint i32* %0 to i64
%5 = sub i64 %3, %4
%6 = lshr exact i64 %5, 2
%7 = trunc i64 %6 to i32
%8 = add i32 %7, -8
%9 = lshr i32 %8, 2
%10 = and i32 %9, 255
store i32 %10, i32* %0
%11 = lshr i32 %8, 10
%12 = and i32 %11, 255
%13 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %12, i32* %13
%14 = lshr i32 %8, 18
%15 = and i32 %14, 255
%16 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %15, i32* %16
%17 = getelementptr inbounds i32, i32* %0, i64 3
store i32 234, i32* %17
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "Usage: %s [-i] [name=value ...] [command]\n",
                getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s [-i] [name=value ...] [command]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s [-i] [name=value ...] [command]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
scalar_t__ asuint(float);
int isok_nofenv_f(float ygot, float ywant) {
  return asuint(ygot) == asuint(ywant);
}


x86 assembly (clang, -O0):
<isok_nofenv_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <asuint@plt>
mov    %rax,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <asuint@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isok_nofenv_f>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
call   1030 <asuint@plt>
mov    %rax,%rbx
movss  0xc(%rsp),%xmm0
call   1030 <asuint@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isok_nofenv_f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = call i64 @asuint(float %5)
%7 = load float, float* %4
%8 = call i64 @asuint(float %7)
%9 = icmp eq i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isok_nofenv_f(float %0, float %1) {
%3 = tail call i64 @asuint(float %0)
%4 = tail call i64 @asuint(float %1)
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
float ProcToValue(float procent, float baseValue) {
  float a = (baseValue / 100) * procent;
  return a;
}


x86 assembly (clang, -O0):
<ProcToValue>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xee5(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProcToValue>:
divss  0xef8(%rip),%xmm1
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @ProcToValue(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %4
%7 = fdiv float %6, 1.000000e+02
%8 = load float, float* %3
%9 = fmul float %7, %8
store float %9, float* %5
%10 = load float, float* %5
ret float %10
}

LLVM IR (-O2):
define float @ProcToValue(float %0, float %1) {
%3 = fdiv float %1, 1.000000e+02
%4 = fmul float %3, %0
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_fl(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  set_fl(0, O_WRONLY);
  printf("set flags success!\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)
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1030 <set_fl@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1030 <set_fl@plt>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_WRONLY = global i32 0
@.str = [20 x i8] c"set flags success!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @O_WRONLY
%7 = call i32 @set_fl(i32 0, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@str = [19 x i8] c"set flags success!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_WRONLY
%4 = tail call i32 @set_fl(i32 0, i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct darr {
  int dummy;
};

/* Variables and functions */
void const *darr_data(struct darr *);
const void *darr_data_const(const struct darr *d) {
  return darr_data((struct darr *)d);
}


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

x86 assembly (clang, -O2):
<darr_data_const>:
jmp    1030 <darr_data@plt>

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

LLVM IR (-O2):
%struct.darr = type { i32 }
define i8* @darr_data_const(%struct.darr* %0) {
%2 = tail call i8* @darr_data(%struct.darr* %0)
ret i8* %2
}
int is_sqr(int number) {
  for (int i = 1; i <= number; i++) {
    if (i * i > number) {
      break;
    }
    if (i * i == number) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_sqr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     115e <is_sqr+0x5e>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    112f <is_sqr+0x2f>
jmp    115e <is_sqr+0x5e>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    114b <is_sqr+0x4b>
movl   $0x1,-0x4(%rbp)
jmp    1165 <is_sqr+0x65>
jmp    1150 <is_sqr+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_sqr+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sqr>:
xor    %eax,%eax
test   %edi,%edi
jle    1129 <is_sqr+0x29>
mov    %edi,%ecx
neg    %ecx
mov    $0x1,%edx
nop
mov    %edx,%esi
imul   %edx,%esi
cmp    %edi,%esi
jg     1129 <is_sqr+0x29>
je     112a <is_sqr+0x2a>
lea    (%rcx,%rdx,1),%esi
add    $0x1,%esi
add    $0x1,%edx
cmp    $0x1,%esi
jne    1110 <is_sqr+0x10>
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @is_sqr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %24, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %27
9: ; preds = %5
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %9
br label %27
16: ; preds = %9
%17 = load i32, i32* %4
%18 = load i32, i32* %4
%19 = mul nsw i32 %17, %18
%20 = load i32, i32* %3
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %2
br label %28
23: ; preds = %16
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %15, %5
store i32 0, i32* %2
br label %28
28: ; preds = %27, %22
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @is_sqr(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %12, label %6
3: ; preds = %10
%4 = add nuw i32 %7, 1
%5 = icmp eq i32 %7, %0
br i1 %5, label %12, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 1, %1 ]
%8 = mul nsw i32 %7, %7
%9 = icmp sgt i32 %8, %0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = icmp eq i32 %8, %0
br i1 %11, label %12, label %3
12: ; preds = %3, %6, %10, %1
%13 = phi i32 [ 0, %1 ], [ 1, %10 ], [ 0, %6 ], [ 0, %3 ]
ret i32 %13
}
/* Variables and functions */
int mergeSort(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argv, char **args) {
  int arr[] = {1, 20, 6, 4, 5};
  printf(" Number of inversions are %d \n", mergeSort(arr, 5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebe(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1040 <mergeSort@plt>
mov    %eax,%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <mergeSort@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [5 x i32] [i32 1, i32 20, i32 6, i32 4, i32 5]
@.str = [31 x i8] c" Number of inversions are %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [5 x i32]* %6 to i8*
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%9 = call i32 @mergeSort(i32* %8, i32 5)
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [5 x i32] [i32 1, i32 20, i32 6, i32 4, i32 5]
@.str = [31 x i8] c" Number of inversions are %d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%6 = call i32 @mergeSort(i32* %5, i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void say_goodbye() { printf("Goodbye!\n"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"Goodbye!\0A\00"
define void @say_goodbye() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c"Goodbye!\00"
define void @say_goodbye() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret void
}
hmsg(s) char *s;
{
  int x;
  if ((x = cmcfm()) < 0)
    return (x);
  puts(s);
  return (0);
}


x86 assembly (clang, -O0):
<hmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <cmcfm@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    114a <hmsg+0x2a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115c <hmsg+0x3c>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hmsg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <cmcfm@plt>
test   %eax,%eax
js     1140 <hmsg+0x20>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
jmp    1142 <hmsg+0x22>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @hmsg(i8* %0) {
%2 = tail call i32 (...) @cmcfm()
%3 = icmp slt i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ %2, %1 ]
ret i32 %7
}
void disable_text(void) {}


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

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

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

LLVM IR (-O2):
define void @disable_text() {
ret void
}
void copy_string(char from[], char to[]) {
  int i = 0;
  while (*from)
    *to++ = *from++;
  *to = '\0';
}


x86 assembly (clang, -O0):
<copy_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <copy_string+0x47>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    1113 <copy_string+0x13>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_string>:
mov    (%rdi),%al
test   %al,%al
je     1121 <copy_string+0x21>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rsi)
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <copy_string+0x10>
movb   $0x0,(%rsi)
ret

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

LLVM IR (-O2):
define void @copy_string(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i8* [ %10, %5 ], [ %1, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %1, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret void
}
/* Variables and functions */
void *realloc(void *, unsigned long);
void *my_realloc(void *p, unsigned long bytes) { return realloc(p, bytes); }


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

x86 assembly (clang, -O2):
<my_realloc>:
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @my_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @my_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
double floor(double);
double time_convert_hund2six(double hundredth) {
  double hour;
  double min;
  hour = floor(hundredth);
  min = hundredth - hour;
  hour += min * 0.6;
  return hour;
}


x86 assembly (clang, -O0):
<time_convert_hund2six>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xeb3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_convert_hund2six>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <floor@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xed4(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @time_convert_hund2six(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call double @llvm.floor.f64(double %5)
store double %6, double* %3
%7 = load double, double* %2
%8 = load double, double* %3
%9 = fsub double %7, %8
store double %9, double* %4
%10 = load double, double* %4
%11 = load double, double* %3
%12 = call double @llvm.fmuladd.f64(double %10, double 6.000000e-01, double %11)
store double %12, double* %3
%13 = load double, double* %3
ret double %13
}

LLVM IR (-O2):
define double @time_convert_hund2six(double %0) {
%2 = tail call double @llvm.floor.f64(double %0)
%3 = fsub double %0, %2
%4 = tail call double @llvm.fmuladd.f64(double %3, double 6.000000e-01, double %2)
ret double %4
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strnlen(char const *, size_t);
char *strndup(const char *s, size_t n) {
  size_t l = strnlen(s, n);
  char *d = malloc(l + 1);
  if (!d)
    return NULL;
  memcpy(d, s, l);
  d[l] = 0;
  return d;
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    117a <strndup+0x4a>
movq   $0x0,-0x8(%rbp)
jmp    119f <strndup+0x6f>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strnlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1164 <strndup+0x34>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @strndup(i8* %0, i64 %1) {
%3 = tail call i64 @strnlen(i8* %0, i64 %1)
%4 = add i64 %3, 1
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %3)
%9 = getelementptr inbounds i8, i8* %5, i64 %3
store i8 0, i8* %9
br label %10
10: ; preds = %2, %7
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ _cc3_delay_sccb();
void _cc3_set_cam_ddr(volatile unsigned long val) {
  (*(volatile unsigned long *)((0xE0028008))) = val;
  _cc3_delay_sccb();
}


x86 assembly (clang, -O0):
<_cc3_set_cam_ddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0xe0028008,%eax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <_cc3_delay_sccb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cc3_set_cam_ddr>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    $0xe0028008,%ecx
mov    %rax,(%rcx)
xor    %eax,%eax
jmp    1030 <_cc3_delay_sccb@plt>

LLVM IR (-O0):
define void @_cc3_set_cam_ddr(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
store volatile i64 %3, i64* inttoptr (i64 3758260232 to i64*)
%4 = call i32 (...) @_cc3_delay_sccb()
ret void
}

LLVM IR (-O2):
define void @_cc3_set_cam_ddr(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
store volatile i64 %3, i64* inttoptr (i64 3758260232 to i64*)
%4 = tail call i32 (...) @_cc3_delay_sccb()
ret void
}
int isatty(int i) { return i < 3; }


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
xor    %eax,%eax
cmp    $0x3,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @isatty(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 3
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
%2 = icmp slt i32 %0, 3
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ execve(char *, char *const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
void *exec(void *id) {
  char *const argv[] = {"true", NULL};
  if ((long)id == 5 - 1)
    execve("/usr/bin/true", argv, NULL);
  else
    sleep(50);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ccd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    $0x4,%rax
jne    1179 <exec+0x49>
lea    -0x20(%rbp),%rsi
lea    0xe95(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <execve@plt>
jmp    1183 <exec+0x53>
mov    $0x32,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec>:
sub    $0x18,%rsp
movaps 0x2cd5(%rip),%xmm0
movaps %xmm0,(%rsp)
cmp    $0x4,%rdi
je     1151 <exec+0x21>
mov    $0x32,%edi
call   1050 <sleep@plt>
jmp    1162 <exec+0x32>
lea    0xea8(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <execve@plt>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@__const.exec.argv = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* null]
@.str.1 = [14 x i8] c"/usr/bin/true\00"
define i8* @exec(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [2 x i8*]
store i8* %0, i8** %3
%5 = bitcast [2 x i8*]* %4 to i8*
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = icmp eq i64 %7, 4
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%11 = call i32 @execve(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %10, i32* null)
br label %14
12: ; preds = %1
%13 = call i32 @sleep(i32 50)
br label %14
14: ; preds = %12, %9
%15 = call i32 @pthread_exit(i32* null)
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@__const.exec.argv = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* null]
@.str.1 = [14 x i8] c"/usr/bin/true\00"
define noalias i8* @exec(i8* readnone %0) {
%2 = alloca [2 x i8*]
%3 = bitcast [2 x i8*]* %2 to i8*
%4 = icmp eq i8* %0, inttoptr (i64 4 to i8*)
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%7 = call i32 @execve(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %6, i32* null)
br label %10
8: ; preds = %1
%9 = tail call i32 @sleep(i32 50)
br label %10
10: ; preds = %8, %5
%11 = call i32 @pthread_exit(i32* null)
ret i8* undef
}
int *test1(int x) {
  static int thestatic;
  thestatic = x;
  return &thestatic + x;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,0x2f14(%rip)
movslq -0x4(%rbp),%rcx
lea    0x2f09(%rip),%rax
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
mov    %edi,0x2f1e(%rip)
lea    0x2f17(%rip),%rax
movslq %edi,%rcx
lea    (%rax,%rcx,4),%rax
ret

LLVM IR (-O0):
@test1.thestatic = internal global i32 0
define i32* @test1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store i32 %3, i32* @test1.thestatic
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* @test1.thestatic, i64 %5
ret i32* %6
}

LLVM IR (-O2):
@test1.thestatic = internal global i32 0
define i32* @test1(i32 %0) {
store i32 %0, i32* @test1.thestatic
%2 = sext i32 %0 to i64
%3 = getelementptr inbounds i32, i32* @test1.thestatic, i64 %2
ret i32* %3
}
float f4(void) { return 1.0; }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @f4() {
ret float 1.000000e+00
}

LLVM IR (-O2):
define float @f4() {
ret float 1.000000e+00
}
/* Type definitions */
struct catmc_atomic_signed_long {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct catmc_atomic_signed_long *);
void catmc_atomic_signed_long_destroy(
    struct catmc_atomic_signed_long *wrapper) {
  free(wrapper);
}


x86 assembly (clang, -O0):
<catmc_atomic_signed_long_destroy>:
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):
<catmc_atomic_signed_long_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.catmc_atomic_signed_long = type { i32 }
define void @catmc_atomic_signed_long_destroy(%struct.catmc_atomic_signed_long* nocapture %0) {
%2 = tail call i32 @free(%struct.catmc_atomic_signed_long* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void uart_close(int uartId) { close(uartId); }


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

x86 assembly (clang, -O2):
<uart_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @uart_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int isspace(int c) {
  switch (c) {
  case '\f':
  case '\n':
  case '\r':
  case '\t':
  case '\v':
  case ' ':
    return 1;
    break;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x5,%eax
jb     112f <isspace+0x2f>
jmp    111e <isspace+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    113b <isspace+0x3b>
jmp    112f <isspace+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1142 <isspace+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
mov    $0x1,%eax
lea    -0x9(%rdi),%ecx
cmp    $0x5,%ecx
jae    110e <isspace+0xe>
ret
cmp    $0x20,%edi
je     110d <isspace+0xd>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
switch i32 %0, label %2 [
i32 12, label %3
i32 10, label %3
i32 13, label %3
i32 9, label %3
i32 11, label %3
i32 32, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ send_errmsg(char *, char const *const);
void cd_error(const char *const cause) {
  send_errmsg("cannot change directory. ", cause);
}


x86 assembly (clang, -O0):
<cd_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <send_errmsg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cd_error>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <send_errmsg@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"cannot change directory. \00"
define void @cd_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @send_errmsg(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"cannot change directory. \00"
define void @cd_error(i8* %0) {
%2 = tail call i32 @send_errmsg(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void form_init(void) {}


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

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

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

LLVM IR (-O2):
define void @form_init() {
ret void
}
void AVCDecodeSignedExpGolomb() {}


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

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

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

LLVM IR (-O2):
define void @AVCDecodeSignedExpGolomb() {
ret void
}
unsigned char *bf_create(int num_bools) {
  unsigned char *data;
  int size = ((int)((num_bools) / 8) + ((num_bools) % 8 == 0 ? 0 : 1));
  data = ((unsigned char *)smb___new((size) * sizeof(unsigned char)));
  bf_init(data, num_bools);
  return data;
}


x86 assembly (clang, -O0):
<bf_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
mov    %edx,%esi
mov    $0x1,%ecx
xor    %edx,%edx
cmp    $0x0,%esi
cmove  %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x0,%rdi
mov    $0x0,%al
call   1030 <smb___new@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1040 <bf_init@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_create>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x7(%rbx),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x3,%eax
mov    %edi,%ecx
and    $0x7,%ecx
cmp    $0x1,%ecx
sbb    $0xffffffff,%eax
movslq %eax,%rdi
xor    %eax,%eax
call   1030 <smb___new@plt>
movslq %eax,%r14
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <bf_init@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @bf_create(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 8
%7 = load i32, i32* %2
%8 = srem i32 %7, 8
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 1
%12 = add nsw i32 %6, %11
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 1
%16 = call i32 (i64, ...) bitcast (i32 (...)* @smb___new to i32 (i64, ...)*)(i64 %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %3
%19 = load i8*, i8** %3
%20 = load i32, i32* %2
%21 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @bf_init to i32 (i8*, i32, ...)*)(i8* %19, i32 %20)
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
define i8* @bf_create(i32 %0) {
%2 = sdiv i32 %0, 8
%3 = and i32 %0, 7
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = add nsw i32 %2, %5
%7 = sext i32 %6 to i64
%8 = tail call i32 (i64, ...) bitcast (i32 (...)* @smb___new to i32 (i64, ...)*)(i64 %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @bf_init to i32 (i8*, i32, ...)*)(i8* %10, i32 %0)
ret i8* %10
}
/* Type definitions */
typedef int /*<<< orphan*/ str;
typedef int /*<<< orphan*/ p;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  char str[10];
  char *p = str;
  printf("sizeof(str) == %d\n", sizeof(str));
  printf("sizeof(p) == %d\n", sizeof(p));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xed2(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"sizeof(str) == %d\0A\00"
@.str.1 = [17 x i8] c"sizeof(p) == %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(int argc, const char **argv) {
  puts("Hello, World.");
  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 <puts@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 = [14 x i8] c"Hello, World.\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 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, World.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int lseek(int, int, int /*<<< orphan*/);
int write(int, int /*<<< orphan*/ const *, int);
int patch_gzip(int fd) {
  const int32_t ts = 0;
  if (lseek(fd, 4, SEEK_SET) == -1)
    return -1;
  if (write(fd, &ts, 4) == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<patch_gzip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1040 <lseek@plt>
cmp    $0xffffffff,%eax
jne    115d <patch_gzip+0x3d>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <patch_gzip+0x6a>
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    1183 <patch_gzip+0x63>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <patch_gzip+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patch_gzip>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
mov    $0x4,%esi
call   1040 <lseek@plt>
cmp    $0xffffffff,%eax
je     1166 <patch_gzip+0x46>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
sete   %al
neg    %eax
jmp    116b <patch_gzip+0x4b>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i32 @patch_gzip(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* @SEEK_SET
%7 = call i32 @lseek(i32 %5, i32 4, i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %16
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @write(i32 %11, i32* %4, i32 4)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 -1, i32* %2
br label %16
15: ; preds = %10
store i32 0, i32* %2
br label %16
16: ; preds = %15, %14, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @patch_gzip(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @lseek(i32 %0, i32 4, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = call i32 @write(i32 %0, i32* %2, i32 4)
%9 = icmp eq i32 %8, -1
%10 = sext i1 %9 to i32
br label %11
11: ; preds = %7, %1
%12 = phi i32 [ -1, %1 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_hubroutedb(char *s) { return (char *)mock(s); }


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

x86 assembly (clang, -O2):
<cf_s_hubroutedb>:
jmp    1030 <mock@plt>

LLVM IR (-O0):
define i8* @cf_s_hubroutedb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mock(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @cf_s_hubroutedb(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
void i2d_ASN1_OCTET_STRING(void) {}


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

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

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

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