xunge/DecIR huggingface dataset:
unsigned int GET_UAA32BE(void *p, unsigned int i) {
  unsigned char *_p = (unsigned char *)&((unsigned int *)p)[i];
  return (unsigned int)_p[0] << 24 | (unsigned int)_p[1] << 16 |
         (unsigned int)_p[2] << 8 | (unsigned int)_p[3];
}


x86 assembly (clang, -O0):
<GET_UAA32BE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x18(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GET_UAA32BE>:
mov    %esi,%eax
mov    (%rdi,%rax,4),%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @GET_UAA32BE(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 i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = bitcast i32* %10 to i8*
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 24
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = shl i32 %20, 16
%22 = or i32 %16, %21
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 2
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = shl i32 %26, 8
%28 = or i32 %22, %27
%29 = load i8*, i8** %5
%30 = getelementptr inbounds i8, i8* %29, i64 3
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = or i32 %28, %32
ret i32 %33
}

LLVM IR (-O2):
define i32 @GET_UAA32BE(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %3, i64 %4
%6 = bitcast i32* %5 to i8*
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl nuw i32 %8, 24
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 16
%14 = or i32 %13, %9
%15 = getelementptr inbounds i8, i8* %6, i64 2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl nuw nsw i32 %17, 8
%19 = or i32 %14, %18
%20 = getelementptr inbounds i8, i8* %6, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = or i32 %19, %22
ret i32 %23
}
void test(int x) {
#pragma omp target enter data map(to : x)
}


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

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

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

LLVM IR (-O2):
define void @test(i32 %0) {
ret void
}
/* Variables and functions */
float get_base_speed();
float get_base_speed_with_voltage(float voltage) {
  return (((24.0) < (voltage * get_base_speed()))
              ? (24.0)
              : (voltage * get_base_speed()));
}


x86 assembly (clang, -O0):
<get_base_speed_with_voltage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_base_speed@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeba(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1162 <get_base_speed_with_voltage+0x52>
movsd  0xea8(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1188 <get_base_speed_with_voltage+0x78>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <get_base_speed@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_base_speed_with_voltage>:
push   %rax
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1030 <get_base_speed@plt>
movaps %xmm0,%xmm1
mulss  0x4(%rsp),%xmm1
movss  0xed1(%rip),%xmm0
ucomiss %xmm0,%xmm1
ja     1141 <get_base_speed_with_voltage+0x31>
xor    %eax,%eax
call   1030 <get_base_speed@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @get_base_speed_with_voltage(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float (...) @get_base_speed()
%5 = fmul float %3, %4
%6 = fpext float %5 to double
%7 = fcmp olt double 2.400000e+01, %6
br i1 %7, label %8, label %9
8: ; preds = %1
br label %14
9: ; preds = %1
%10 = load float, float* %2
%11 = call float (...) @get_base_speed()
%12 = fmul float %10, %11
%13 = fpext float %12 to double
br label %14
14: ; preds = %9, %8
%15 = phi double [ 2.400000e+01, %8 ], [ %13, %9 ]
%16 = fptrunc double %15 to float
ret float %16
}

LLVM IR (-O2):
define float @get_base_speed_with_voltage(float %0) {
%2 = tail call float (...) @get_base_speed()
%3 = fmul float %2, %0
%4 = fcmp ogt float %3, 2.400000e+01
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call float (...) @get_base_speed()
%7 = fmul float %6, %0
br label %8
8: ; preds = %1, %5
%9 = phi float [ %7, %5 ], [ 2.400000e+01, %1 ]
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void badarg(void) {
  fprintf(stderr, "axis: error in arguments\n");
  exit(-1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"axis: error in arguments\0A\00"
define void @badarg() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"axis: error in arguments\0A\00"
define void @badarg() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ getenv(char *);
int /*<<< orphan*/ tzsetlcl(int /*<<< orphan*/);
void tzset_unlocked(void) { tzsetlcl(getenv("TZ")); }


x86 assembly (clang, -O0):
<tzset_unlocked>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
call   1040 <tzsetlcl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tzset_unlocked>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <tzsetlcl@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"TZ\00"
define void @tzset_unlocked() {
%1 = call i32 @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @tzsetlcl(i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"TZ\00"
define void @tzset_unlocked() {
%1 = tail call i32 @getenv(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @tzsetlcl(i32 %1)
ret void
}
void f2(void) {
  unsigned v1, v2, v3, v4;
  __asm__("" : "=a"(v1), "=d"(v2), "=c"(v3), "=r"(v4));
  f0(f1(), f1(), f1(), f1(), (v4 >> 8) & 0xff);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %esi,-0x20(%rbp)
mov    %eax,%esi
mov    -0x20(%rbp),%eax
mov    %esi,-0x4(%rbp)
mov    %edx,-0x8(%rbp)
mov    %ecx,-0xc(%rbp)
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <f1@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <f1@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <f1@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <f1@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
mov    -0x10(%rbp),%r8d
shr    $0x8,%r8d
and    $0xff,%r8d
mov    $0x0,%al
call   1030 <f0@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <f1@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <f1@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1040 <f1@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <f1@plt>
mov    %ebp,%ecx
movzbl %ch,%ebp
mov    %r14d,%edi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %eax,%ecx
mov    %ebp,%r8d
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <f0@plt>

LLVM IR (-O0):
define void @f2() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call { i32, i32, i32, i32 } asm "", "={ax},={dx},={cx},=r,~{dirflag},~{fpsr},~{flags}"()
%6 = extractvalue { i32, i32, i32, i32 } %5, 0
%7 = extractvalue { i32, i32, i32, i32 } %5, 1
%8 = extractvalue { i32, i32, i32, i32 } %5, 2
%9 = extractvalue { i32, i32, i32, i32 } %5, 3
store i32 %6, i32* %1
store i32 %7, i32* %2
store i32 %8, i32* %3
store i32 %9, i32* %4
%10 = call i32 (...) @f1()
%11 = call i32 (...) @f1()
%12 = call i32 (...) @f1()
%13 = call i32 (...) @f1()
%14 = load i32, i32* %4
%15 = lshr i32 %14, 8
%16 = and i32 %15, 255
%17 = call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @f0 to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %10, i32 %11, i32 %12, i32 %13, i32 %16)
ret void
}

LLVM IR (-O2):
define void @f2() {
%1 = tail call { i32, i32, i32, i32 } asm "", "={ax},={dx},={cx},=r,~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32, i32, i32 } %1, 3
%3 = tail call i32 (...) @f1()
%4 = tail call i32 (...) @f1()
%5 = tail call i32 (...) @f1()
%6 = tail call i32 (...) @f1()
%7 = lshr i32 %2, 8
%8 = and i32 %7, 255
%9 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @f0 to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %3, i32 %4, i32 %5, i32 %6, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((hotpatch(0, 0))) void hp1(void) { printf("hello, world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
void gtk_tree_selection_get_selected_rows() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_selection_get_selected_rows() {
ret void
}
/* Type definitions */
struct sStreamCodec {
  int dummy;
};

/* Variables and functions */
scalar_t__ StreamDecoder_GetU16(struct sStreamCodec *);
signed short StreamDecoder_GetS16(struct sStreamCodec *p) {
  return (signed short)StreamDecoder_GetU16(p);
}


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

x86 assembly (clang, -O2):
<StreamDecoder_GetS16>:
push   %rax
call   1030 <StreamDecoder_GetU16@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.sStreamCodec = type { i32 }
define signext i16 @StreamDecoder_GetS16(%struct.sStreamCodec* %0) {
%2 = alloca %struct.sStreamCodec*
store %struct.sStreamCodec* %0, %struct.sStreamCodec** %2
%3 = load %struct.sStreamCodec*, %struct.sStreamCodec** %2
%4 = call i64 @StreamDecoder_GetU16(%struct.sStreamCodec* %3)
%5 = trunc i64 %4 to i16
ret i16 %5
}

LLVM IR (-O2):
%struct.sStreamCodec = type { i32 }
define signext i16 @StreamDecoder_GetS16(%struct.sStreamCodec* %0) {
%2 = tail call i64 @StreamDecoder_GetU16(%struct.sStreamCodec* %0)
%3 = trunc i64 %2 to i16
ret i16 %3
}
int ext2_acl_chmod(struct inode *inode) { return 0; }


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

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

LLVM IR (-O0):
%struct.inode = type opaque
define i32 @ext2_acl_chmod(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
define i32 @ext2_acl_chmod(%struct.inode* nocapture readnone %0) {
ret i32 0
}
void dl_G_FILLRECT() {}


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

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

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

LLVM IR (-O2):
define void @dl_G_FILLRECT() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Error(char *);
void ChkPtr(void *p) {
  if (!p)
    Error("NULL pointer\n");
}


x86 assembly (clang, -O0):
<ChkPtr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1133 <ChkPtr+0x23>
lea    0xed2(%rip),%rdi
call   1030 <Error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ChkPtr>:
test   %rdi,%rdi
je     1116 <ChkPtr+0x6>
ret
lea    0xee3(%rip),%rdi
jmp    1030 <Error@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"NULL pointer\0A\00"
define void @ChkPtr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @Error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"NULL pointer\0A\00"
define void @ChkPtr(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @Error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
struct expression {
  int dummy;
};

/* Variables and functions */
long long __get_expression_value(struct expression *, int /*<<< orphan*/);
long long get_expression_value(struct expression *expr) {
  return __get_expression_value(expr, 0);
}


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

x86 assembly (clang, -O2):
<get_expression_value>:
xor    %esi,%esi
jmp    1030 <__get_expression_value@plt>

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

LLVM IR (-O2):
%struct.expression = type { i32 }
define i64 @get_expression_value(%struct.expression* %0) {
%2 = tail call i64 @__get_expression_value(%struct.expression* %0, i32 0)
ret i64 %2
}
char digit_to_hex(int n) {
  const char *trans_table = "0123456789ABCDEF";
  return trans_table[n & 0xf];
}


x86 assembly (clang, -O0):
<digit_to_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit_to_hex>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define signext i8 @digit_to_hex(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = load i32, i32* %2
%6 = and i32 %5, 15
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
%9 = load i8, i8* %8
ret i8 %9
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define signext i8 @digit_to_hex(i32 %0) {
%2 = and i32 %0, 15
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
long int BNCWaveFormatDigital() {
  long int stat = 99;
  BNCIO(27);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCWaveFormatDigital>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x63,-0x8(%rbp)
mov    $0x1b,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCWaveFormatDigital>:
push   %rax
mov    $0x1b,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @BNCWaveFormatDigital() {
%1 = alloca i64
store i64 99, i64* %1
%2 = call i32 @BNCIO(i32 27)
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @BNCWaveFormatDigital() {
%1 = tail call i32 @BNCIO(i32 27)
ret i64 99
}
/* Type definitions */
struct song_node {
  int dummy;
};

/* Variables and functions */
struct song_node *first_element_artist(char *);
struct song_node *find_artist(char *song_artist) {
  return first_element_artist(song_artist);
}


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

x86 assembly (clang, -O2):
<find_artist>:
jmp    1030 <first_element_artist@plt>

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

LLVM IR (-O2):
%struct.song_node = type { i32 }
define %struct.song_node* @find_artist(i8* %0) {
%2 = tail call %struct.song_node* @first_element_artist(i8* %0)
ret %struct.song_node* %2
}
void dist_sync_barrier(void) {
  asm volatile("" : : : "memory");
  syscall(317);
  asm volatile("" : : : "memory");
}


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

x86 assembly (clang, -O2):
<dist_sync_barrier>:
push   %rax
mov    $0x13d,%edi
xor    %eax,%eax
call   1030 <syscall@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @dist_sync_barrier() {
%1 = call i32 (i32, ...) bitcast (i32 (...)* @syscall to i32 (i32, ...)*)(i32 317)
ret void
}

LLVM IR (-O2):
define void @dist_sync_barrier() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @syscall to i32 (i32, ...)*)(i32 317)
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int foo(int x, int flag) {
  if (flag > 0)
    return x + flag;
  else
    return x + 2;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1122 <foo+0x22>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112b <foo+0x2b>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %esi,%esi
mov    $0x2,%eax
cmovg  %esi,%eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = select i1 %3, i32 %1, i32 2
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Variables and functions */
void *malloc(unsigned int);
int /*<<< orphan*/ printf(char *, char *, int);
void *SafeMalloc(unsigned int size, char *file, int line) {
  void *rptr = malloc(size);
  if (!rptr)
    printf("Warning Malloc() returning NULL (%s:%3d)\n", file, line);
  return (rptr);
}


x86 assembly (clang, -O0):
<SafeMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115c <SafeMalloc+0x3c>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SafeMalloc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1149 <SafeMalloc+0x29>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <printf@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Warning Malloc() returning NULL (%s:%3d)\0A\00"
define i8* @SafeMalloc(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %16, label %12
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14)
br label %16
16: ; preds = %12, %3
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
@.str = [42 x i8] c"Warning Malloc() returning NULL (%s:%3d)\0A\00"
define noalias i8* @SafeMalloc(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @malloc(i32 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
br label %8
8: ; preds = %6, %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ print_client_stats(int);
int /*<<< orphan*/ print_server_stats(int);
void print_all_stats(int opt_srv, int opt_clt, int opt_prt) {
  if (opt_srv)
    print_server_stats(opt_prt);
  if (opt_clt)
    print_client_stats(opt_prt);
}


x86 assembly (clang, -O0):
<print_all_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1143 <print_all_stats+0x23>
mov    -0xc(%rbp),%edi
call   1030 <print_server_stats@plt>
cmpl   $0x0,-0x8(%rbp)
je     1155 <print_all_stats+0x35>
mov    -0xc(%rbp),%edi
call   1040 <print_client_stats@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_all_stats>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
test   %edi,%edi
je     1132 <print_all_stats+0x12>
mov    %ebx,%edi
call   1030 <print_server_stats@plt>
test   %ebp,%ebp
je     1143 <print_all_stats+0x23>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <print_client_stats@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @print_all_stats(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @print_server_stats(i32 %2)
br label %7
7: ; preds = %5, %3
%8 = icmp eq i32 %1, 0
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @print_client_stats(i32 %2)
br label %11
11: ; preds = %9, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setLineSpacing(int);
void CmdLineSpacing(int code) { setLineSpacing(code); }


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

x86 assembly (clang, -O2):
<CmdLineSpacing>:
jmp    1030 <setLineSpacing@plt>

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

LLVM IR (-O2):
define void @CmdLineSpacing(i32 %0) {
%2 = tail call i32 @setLineSpacing(i32 %0)
ret void
}
unsigned char get_Modem_Version(void) { return 0; }


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

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

LLVM IR (-O0):
define zeroext i8 @get_Modem_Version() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @get_Modem_Version() {
ret i8 0
}
/* Type definitions */
typedef long uint32_t;

/* Variables and functions */
long htonl(long);
void swap_n_4byte(unsigned char *p, unsigned long n) {
  register unsigned long i;
  for (i = 0; i < n; i++) {
    if (sizeof(long) != sizeof(uint32_t)) {
      uint32_t *cursor = (uint32_t *)p;
      *cursor = htonl(*cursor);
    } else {
      long *cursor = (long *)p;
      *cursor = htonl(*cursor);
    }
    p += 4;
  }
}


x86 assembly (clang, -O0):
<swap_n_4byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1171 <swap_n_4byte+0x61>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1030 <htonl@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <swap_n_4byte+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_n_4byte>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1146 <swap_n_4byte+0x36>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%rdi
call   1030 <htonl@plt>
mov    %rax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <swap_n_4byte+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @swap_n_4byte(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = phi i64 [ %11, %4 ], [ 0, %2 ]
%7 = bitcast i8* %5 to i64*
%8 = load i64, i64* %7
%9 = tail call i64 @htonl(i64 %8)
store i64 %9, i64* %7
%10 = getelementptr inbounds i8, i8* %5, i64 4
%11 = add nuw i64 %6, 1
%12 = icmp eq i64 %11, %1
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
double dB_to_val(int value) {
  double x = value / 10.0;
  if (value < -1000)
    x = -120.0;
  return x;
}


x86 assembly (clang, -O0):
<dB_to_val>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0xfffffc18,-0x4(%rbp)
jge    1137 <dB_to_val+0x37>
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dB_to_val>:
cmp    $0xfffffc18,%edi
jge    1111 <dB_to_val+0x11>
movsd  0xef0(%rip),%xmm0
ret
cvtsi2sd %edi,%xmm0
divsd  0xeeb(%rip),%xmm0
ret

LLVM IR (-O0):
define double @dB_to_val(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, 1.000000e+01
store double %6, double* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, -1000
br i1 %8, label %9, label %10
9: ; preds = %1
store double -1.200000e+02, double* %3
br label %10
10: ; preds = %9, %1
%11 = load double, double* %3
ret double %11
}

LLVM IR (-O2):
define double @dB_to_val(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fdiv double %2, 1.000000e+01
%4 = icmp slt i32 %0, -1000
%5 = select i1 %4, double -1.200000e+02, double %3
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void pbm_WriteFontEnd(FILE *fp) { fprintf(fp, "ENDFONT\n"); }


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

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"ENDFONT\0A\00"
define void @pbm_WriteFontEnd(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 8, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doupdate();
int /*<<< orphan*/ update_panels();
void pflush() {
  update_panels();
  doupdate();
}


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

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

LLVM IR (-O0):
define void @pflush() {
%1 = call i32 (...) @update_panels()
%2 = call i32 (...) @doupdate()
ret void
}

LLVM IR (-O2):
define void @pflush() {
%1 = tail call i32 (...) @update_panels()
%2 = tail call i32 (...) @doupdate()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushreal32array_(char *x, unsigned int *n) { pushNarray(x, (*n * 32)); }


x86 assembly (clang, -O0):
<pushreal32array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x5,%esi
call   1030 <pushNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushreal32array_>:
mov    (%rsi),%esi
shl    $0x5,%esi
jmp    1030 <pushNarray@plt>

LLVM IR (-O0):
define void @pushreal32array_(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = mul i32 %7, 32
%9 = call i32 @pushNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @pushreal32array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 5
%5 = tail call i32 @pushNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int dec(int a) {
  if (a == 0) {
    fprintf(stderr, "cannot dec on zero\n");
    exit(-1);
  }
  return a - 1;
}


x86 assembly (clang, -O0):
<dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1154 <dec+0x34>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec>:
test   %edi,%edi
je     112a <dec+0xa>
add    $0xffffffff,%edi
mov    %edi,%eax
ret
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"cannot dec on zero\0A\00"
define i32 @dec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
ret i32 %11
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"cannot dec on zero\0A\00"
define i32 @dec(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %1
%8 = add nsw i32 %0, -1
ret i32 %8
}
int mylog(int num) {
  int j = 0, k = 1;
  while (k < num) {
    k *= 2;
    j++;
  }
  return j;
}


x86 assembly (clang, -O0):
<mylog>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <mylog+0x38>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <mylog+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mylog>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     1119 <mylog+0x19>
xor    %eax,%eax
mov    $0x1,%ecx
xchg   %ax,%ax
add    %ecx,%ecx
add    $0x1,%eax
cmp    %edi,%ecx
jl     1110 <mylog+0x10>
ret

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

LLVM IR (-O2):
define i32 @mylog(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = shl nsw i32 %4, 1
%7 = add nuw nsw i32 %5, 1
%8 = icmp slt i32 %6, %0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
long otoi(s)
char *s;
{
  long v;
  int base;
  v = 0;
  base = 10;
  if (*s == '0')
    base = 8;
  while (isdigit(*s))
    v = v * base + *s++ - '0';
  return (v);
}


x86 assembly (clang, -O0):
<otoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1142 <otoi+0x32>
movl   $0x8,-0x14(%rbp)
jmp    1147 <otoi+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     118b <otoi+0x7b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbq (%rcx),%rcx
add    %rcx,%rax
sub    $0x30,%rax
mov    %rax,-0x10(%rbp)
jmp    1147 <otoi+0x37>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<otoi>:
movsbl (%rdi),%ecx
lea    -0x30(%rcx),%eax
cmp    $0x9,%eax
ja     1151 <otoi+0x51>
xor    %eax,%eax
cmp    $0x30,%cl
setne  %al
lea    (%rax,%rax,1),%rdx
add    $0x8,%rdx
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rdx,%rax
movsbq %cl,%rcx
add    %rcx,%rax
add    $0xffffffffffffffd0,%rax
movsbl (%rdi),%ecx
mov    %ecx,%esi
add    $0xffffffd0,%esi
add    $0x1,%rdi
cmp    $0xa,%esi
jb     1130 <otoi+0x30>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @otoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = add nsw i32 %3, -48
%5 = icmp ult i32 %4, 10
br i1 %5, label %6, label %22
6: ; preds = %1
%7 = icmp eq i8 %2, 48
%8 = select i1 %7, i64 8, i64 10
br label %9
9: ; preds = %6, %9
%10 = phi i8 [ %2, %6 ], [ %18, %9 ]
%11 = phi i64 [ 0, %6 ], [ %17, %9 ]
%12 = phi i8* [ %0, %6 ], [ %14, %9 ]
%13 = mul nsw i64 %11, %8
%14 = getelementptr inbounds i8, i8* %12, i64 1
%15 = sext i8 %10 to i64
%16 = add i64 %13, -48
%17 = add i64 %16, %15
%18 = load i8, i8* %14
%19 = sext i8 %18 to i32
%20 = add nsw i32 %19, -48
%21 = icmp ult i32 %20, 10
br i1 %21, label %9, label %22
22: ; preds = %9, %1
%23 = phi i64 [ 0, %1 ], [ %17, %9 ]
ret i64 %23
}
/* Variables and functions */
char *checking_malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *strdupdelim(const char *beg, const char *end) {
  char *res = checking_malloc(end - beg + 1);
  memcpy(res, beg, end - beg);
  res[end - beg] = '\0';
  return res;
}


x86 assembly (clang, -O0):
<strdupdelim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1040 <checking_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdupdelim>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
sub    %rdi,%rbx
lea    0x1(%rbx),%edi
call   1040 <checking_malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
movb   $0x0,(%r15,%rbx,1)
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdupdelim(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %6 to i64
%9 = ptrtoint i8* %7 to i64
%10 = sub i64 %8, %9
%11 = add nsw i64 %10, 1
%12 = trunc i64 %11 to i32
%13 = call i8* @checking_malloc(i32 %12)
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = load i8*, i8** %3
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = trunc i64 %20 to i32
%22 = call i32 @memcpy(i8* %14, i8* %15, i32 %21)
%23 = load i8*, i8** %5
%24 = load i8*, i8** %4
%25 = load i8*, i8** %3
%26 = ptrtoint i8* %24 to i64
%27 = ptrtoint i8* %25 to i64
%28 = sub i64 %26, %27
%29 = getelementptr inbounds i8, i8* %23, i64 %28
store i8 0, i8* %29
%30 = load i8*, i8** %5
ret i8* %30
}

LLVM IR (-O2):
define i8* @strdupdelim(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
%7 = add i32 %6, 1
%8 = tail call i8* @checking_malloc(i32 %7)
%9 = tail call i32 @memcpy(i8* %8, i8* %0, i32 %6)
%10 = getelementptr inbounds i8, i8* %8, i64 %5
store i8 0, i8* %10
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
void SetUpChildIO(int to_prog[2], int from_prog[2]) {
  signal(SIGPIPE, SIG_IGN);
  pipe(to_prog);
  pipe(from_prog);
}


x86 assembly (clang, -O0):
<SetUpChildIO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <pipe@plt>
mov    -0x10(%rbp),%rdi
call   1030 <pipe@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetUpChildIO>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    %rbx,%rdi
call   1030 <pipe@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <pipe@plt>

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
define void @SetUpChildIO(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @SIGPIPE
%6 = load i32, i32* @SIG_IGN
%7 = call i32 @signal(i32 %5, i32 %6)
%8 = load i32*, i32** %3
%9 = call i32 @pipe(i32* %8)
%10 = load i32*, i32** %4
%11 = call i32 @pipe(i32* %10)
ret void
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
define void @SetUpChildIO(i32* %0, i32* %1) {
%3 = load i32, i32* @SIGPIPE
%4 = load i32, i32* @SIG_IGN
%5 = tail call i32 @signal(i32 %3, i32 %4)
%6 = tail call i32 @pipe(i32* %0)
%7 = tail call i32 @pipe(i32* %1)
ret void
}
int mls_context_cmp(struct context *c1, struct context *c2) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.context = type opaque
define i32 @mls_context_cmp(%struct.context* nocapture readnone %0, %struct.context* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(void const *, void const *, size_t);
bool cutils_cdar_DynamicArray_short_compare(const void *p1, const void *p2,
                                            size_t s) {
  return !memcmp(p1, p2, s);
}


x86 assembly (clang, -O0):
<cutils_cdar_DynamicArray_short_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutils_cdar_DynamicArray_short_compare>:
push   %rax
call   1030 <bcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cutils_cdar_DynamicArray_short_compare(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcmp(i8* %7, i8* %8, i64 %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @cutils_cdar_DynamicArray_short_compare(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @bcmp(i8* %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
struct timespec {
  long tv_sec;
  long tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, struct timespec *);
void Sleep437(long usec) {
  struct timespec tim, tim2;
  tim.tv_sec = usec / 1000000L;
  tim.tv_nsec = (usec - tim.tv_sec * 1000000L) * 1000;
  nanosleep(&tim, &tim2);
}


x86 assembly (clang, -O0):
<Sleep437>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xf4240,-0x18(%rbp),%rcx
sub    %rcx,%rax
imul   $0x3e8,%rax,%rax
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <nanosleep@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sleep437>:
sub    $0x28,%rsp
movabs $0x431bde82d7b634db,%rcx
de 1b 43
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rax,%rdx
mov    %rdx,0x8(%rsp)
imul   $0xfffffffffff0bdc0,%rdx,%rax
add    %rdi,%rax
imul   $0x3e8,%rax,%rax
mov    %rax,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <nanosleep@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @Sleep437(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = sdiv i64 %5, 1000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i64 %6, i64* %7
%8 = load i64, i64* %2
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%10 = load i64, i64* %9
%11 = mul nsw i64 %10, 1000000
%12 = sub nsw i64 %8, %11
%13 = mul nsw i64 %12, 1000
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 %13, i64* %14
%15 = call i32 @nanosleep(%struct.timespec* %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @Sleep437(i64 %0) {
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %2 to i8*
%5 = bitcast %struct.timespec* %3 to i8*
%6 = sdiv i64 %0, 1000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i64 %6, i64* %7
%8 = mul nsw i64 %6, -1000000
%9 = add i64 %8, %0
%10 = mul nsw i64 %9, 1000
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 %10, i64* %11
%12 = call i32 @nanosleep(%struct.timespec* %2, %struct.timespec* %3)
ret void
}
void Done() {}


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

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

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

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