xunge/DecIR huggingface dataset:
/* Type definitions */
struct task {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct task *);
int bad(struct task *t) {
  assert(t);
  return -1;
}


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

x86 assembly (clang, -O2):
<bad>:
push   %rax
call   1030 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.task = type { i32 }
define i32 @bad(%struct.task* %0) {
%2 = tail call i32 @assert(%struct.task* %0)
ret i32 -1
}
int IS_RANGE(struct command *c) { return ((unsigned long)c) & 1; }


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

x86 assembly (clang, -O2):
<IS_RANGE>:
mov    %rdi,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
%struct.command = type opaque
define i32 @IS_RANGE(%struct.command* %0) {
%2 = alloca %struct.command*
store %struct.command* %0, %struct.command** %2
%3 = load %struct.command*, %struct.command** %2
%4 = ptrtoint %struct.command* %3 to i64
%5 = and i64 %4, 1
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
%struct.command = type opaque
define i32 @IS_RANGE(%struct.command* %0) {
%2 = ptrtoint %struct.command* %0 to i64
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void FREE(void *ptr, int id) { free(ptr); }


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

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

LLVM IR (-O0):
define void @FREE(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 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @FREE(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
int f_bun_rm2(float a1, float *a2) { return !(__builtin_isunordered(a1, *a2)); }


x86 assembly (clang, -O0):
<f_bun_rm2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
setp   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_bun_rm2>:
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setnp  %al
ret

LLVM IR (-O0):
define i32 @f_bun_rm2(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 = load float*, float** %4
%7 = load float, float* %6
%8 = fcmp uno float %5, %7
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @f_bun_rm2(float %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = fcmp ord float %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
void ff_hevc_put_hevc_uni_epel_hv64_12_sse4() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ free(struct vec_t *);
int /*<<< orphan*/ vec_destroy(struct vec_t *);
void vec_free(struct vec_t *v) {
  ;
  vec_destroy(v);
  free(v);
  { return; };
}


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

x86 assembly (clang, -O2):
<vec_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <vec_destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.vec_t = type { i32 }
define void @vec_free(%struct.vec_t* %0) {
%2 = tail call i32 @vec_destroy(%struct.vec_t* %0)
%3 = tail call i32 @free(%struct.vec_t* %0)
ret void
}
/* Variables and functions */
int PlayBishop(unsigned char, unsigned long, unsigned long);
int PlayRook(unsigned char, unsigned long, unsigned long);
int PlayQueen(unsigned char pieceColor, unsigned long boardRow,
              unsigned long boardCol) {
  int winner = PlayBishop(pieceColor, boardRow, boardCol);
  if (winner == 0) {
    winner = PlayRook(pieceColor, boardRow, boardCol);
  }
  return winner;
}


x86 assembly (clang, -O0):
<PlayQueen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movzbl %al,%edi
call   1030 <PlayBishop@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    116c <PlayQueen+0x4c>
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movzbl %al,%edi
call   1040 <PlayRook@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PlayQueen>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <PlayBishop@plt>
test   %eax,%eax
je     113a <PlayQueen+0x1a>
pop    %rbx
pop    %r14
pop    %rbp
ret
movzbl %bpl,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <PlayRook@plt>

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

LLVM IR (-O2):
define i32 @PlayQueen(i8 zeroext %0, i64 %1, i64 %2) {
%4 = tail call i32 @PlayBishop(i8 zeroext %0, i64 %1, i64 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @PlayRook(i8 zeroext %0, i64 %1, i64 %2)
br label %8
8: ; preds = %6, %3
%9 = phi i32 [ %7, %6 ], [ %4, %3 ]
ret i32 %9
}
/* Type definitions */
struct mq_object {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct mq_object *);
int /*<<< orphan*/ in_del_list(struct mq_object *);
int mq_fini(struct mq_object *mq) {
  if (NULL != mq) {
    in_del_list(mq);
    free(mq);
  }
  return 0;
}


x86 assembly (clang, -O0):
<mq_fini>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     114a <mq_fini+0x2a>
mov    -0x8(%rbp),%rdi
call   1040 <in_del_list@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mq_fini>:
test   %rdi,%rdi
je     1137 <mq_fini+0x17>
push   %rbx
mov    %rdi,%rbx
call   1040 <in_del_list@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
pop    %rbx
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.mq_object = type { i32 }
define i32 @mq_fini(%struct.mq_object* %0) {
%2 = alloca %struct.mq_object*
store %struct.mq_object* %0, %struct.mq_object** %2
%3 = load %struct.mq_object*, %struct.mq_object** %2
%4 = icmp ne %struct.mq_object* null, %3
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load %struct.mq_object*, %struct.mq_object** %2
%7 = call i32 @in_del_list(%struct.mq_object* %6)
%8 = load %struct.mq_object*, %struct.mq_object** %2
%9 = call i32 @free(%struct.mq_object* %8)
br label %10
10: ; preds = %5, %1
ret i32 0
}

LLVM IR (-O2):
%struct.mq_object = type { i32 }
define i32 @mq_fini(%struct.mq_object* %0) {
%2 = icmp eq %struct.mq_object* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @in_del_list(%struct.mq_object* %0)
%5 = tail call i32 @free(%struct.mq_object* %0)
br label %6
6: ; preds = %3, %1
ret i32 0
}
int comp(int a, int b) {
  if (a >= b)
    return a;
  else
    return b;
}


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

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

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

LLVM IR (-O2):
define i32 @comp(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Type definitions */
struct bitstream_elmt_t {
  int dummy;
};

/* Variables and functions */
unsigned int bitstream_ue(struct bitstream_elmt_t *);
int bitstream_se(struct bitstream_elmt_t *bs) {
  unsigned int code_num;
  int signed_code_num;
  int sign;
  code_num = bitstream_ue(bs);
  sign = ~code_num & 0x1;
  signed_code_num = ((code_num + 1) >> 1) * -sign;
  return signed_code_num;
}


x86 assembly (clang, -O0):
<bitstream_se>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <bitstream_ue@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
and    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
shr    $0x1,%eax
xor    %ecx,%ecx
sub    -0x14(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitstream_se>:
push   %rax
call   1030 <bitstream_ue@plt>
mov    %eax,%ecx
or     $0xfffffffe,%ecx
add    $0x1,%ecx
add    $0x1,%eax
shr    %eax
imul   %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.bitstream_elmt_t = type { i32 }
define i32 @bitstream_se(%struct.bitstream_elmt_t* %0) {
%2 = alloca %struct.bitstream_elmt_t*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store %struct.bitstream_elmt_t* %0, %struct.bitstream_elmt_t** %2
%6 = load %struct.bitstream_elmt_t*, %struct.bitstream_elmt_t** %2
%7 = call i32 @bitstream_ue(%struct.bitstream_elmt_t* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = xor i32 %8, -1
%10 = and i32 %9, 1
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = add i32 %11, 1
%13 = lshr i32 %12, 1
%14 = load i32, i32* %5
%15 = sub nsw i32 0, %14
%16 = mul i32 %13, %15
store i32 %16, i32* %4
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
%struct.bitstream_elmt_t = type { i32 }
define i32 @bitstream_se(%struct.bitstream_elmt_t* %0) {
%2 = tail call i32 @bitstream_ue(%struct.bitstream_elmt_t* %0)
%3 = or i32 %2, -2
%4 = add nsw i32 %3, 1
%5 = add i32 %2, 1
%6 = lshr i32 %5, 1
%7 = mul nsw i32 %6, %4
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ _get_fake_time(int /*<<< orphan*/);
int /*<<< orphan*/ real_time(int /*<<< orphan*/ *);
time_t time(time_t *tloc) {
  time_t t, f;
  t = real_time(NULL);
  f = _get_fake_time(t);
  ;
  if (tloc)
    *tloc = f;
  return f;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <real_time@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <_get_fake_time@plt>
mov    %eax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1157 <time+0x37>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <real_time@plt>
mov    %eax,%edi
call   1030 <_get_fake_time@plt>
test   %rbx,%rbx
je     1139 <time+0x19>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @time(i32* writeonly %0) {
%2 = tail call i32 @real_time(i32* null)
%3 = tail call i32 @_get_fake_time(i32 %2)
%4 = icmp eq i32* %0, null
br i1 %4, label %6, label %5
5: ; preds = %1
store i32 %3, i32* %0
br label %6
6: ; preds = %5, %1
ret i32 %3
}
/* Variables and functions */
int M_PI;
float sin(float);
float clipped_wave(float freq, float amp, float t) {
  float theta = 2 * M_PI * freq * t;
  float res = amp * sin(theta);
  if (res < 1)
    return 0;
  return res - 1;
}


x86 assembly (clang, -O0):
<clipped_wave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe8d(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    118a <clipped_wave+0x7a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a0 <clipped_wave+0x90>
movss  -0x18(%rbp),%xmm0
movss  0xe69(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clipped_wave>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
cvtsi2ss %eax,%xmm3
movss  %xmm1,0x4(%rsp)
mulss  %xmm3,%xmm0
mulss  %xmm2,%xmm0
call   1030 <sin@plt>
mulss  0x4(%rsp),%xmm0
movss  0xebf(%rip),%xmm1
addss  %xmm0,%xmm1
cmpltss 0xeb6(%rip),%xmm0
andnps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global i32 0
define float @clipped_wave(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%10 = load i32, i32* @M_PI
%11 = mul nsw i32 2, %10
%12 = sitofp i32 %11 to float
%13 = load float, float* %5
%14 = fmul float %12, %13
%15 = load float, float* %7
%16 = fmul float %14, %15
store float %16, float* %8
%17 = load float, float* %6
%18 = load float, float* %8
%19 = call float @sin(float %18)
%20 = fmul float %17, %19
store float %20, float* %9
%21 = load float, float* %9
%22 = fcmp olt float %21, 1.000000e+00
br i1 %22, label %23, label %24
23: ; preds = %3
store float 0.000000e+00, float* %4
br label %27
24: ; preds = %3
%25 = load float, float* %9
%26 = fsub float %25, 1.000000e+00
store float %26, float* %4
br label %27
27: ; preds = %24, %23
%28 = load float, float* %4
ret float %28
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @clipped_wave(float %0, float %1, float %2) {
%4 = load i32, i32* @M_PI
%5 = shl nsw i32 %4, 1
%6 = sitofp i32 %5 to float
%7 = fmul float %6, %0
%8 = fmul float %7, %2
%9 = tail call float @sin(float %8)
%10 = fmul float %9, %1
%11 = fcmp olt float %10, 1.000000e+00
%12 = fadd float %10, -1.000000e+00
%13 = select i1 %11, float 0.000000e+00, float %12
ret float %13
}
void *unit_loop(void *data) {}


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

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

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

LLVM IR (-O2):
define noalias i8* @unit_loop(i8* nocapture readnone %0) {
ret i8* undef
}
/* Variables and functions */
unsigned char inb(int);
unsigned char inb_p(int port) { return (inb(port)); }


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

x86 assembly (clang, -O2):
<inb_p>:
jmp    1030 <inb@plt>

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

LLVM IR (-O2):
define zeroext i8 @inb_p(i32 %0) {
%2 = tail call zeroext i8 @inb(i32 %0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ asmfunc();
int /*<<< orphan*/ cfunc();
int main(int argc, char **argv) {
  cfunc();
  asmfunc();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @cfunc()
%7 = call i32 (...) @asmfunc()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @cfunc()
%4 = tail call i32 (...) @asmfunc()
ret i32 0
}
/* Type definitions */
struct ir_remote {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clear_rec_buffer();
char *decode_all(struct ir_remote *);
char *dsp_rec(struct ir_remote *remotes) {
  if (!clear_rec_buffer())
    return (NULL);
  return (decode_all(remotes));
}


x86 assembly (clang, -O0):
<dsp_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clear_rec_buffer@plt>
cmp    $0x0,%eax
jne    1149 <dsp_rec+0x29>
movq   $0x0,-0x8(%rbp)
jmp    1156 <dsp_rec+0x36>
mov    -0x10(%rbp),%rdi
call   1040 <decode_all@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsp_rec>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clear_rec_buffer@plt>
test   %eax,%eax
je     1138 <dsp_rec+0x18>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <decode_all@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ir_remote = type { i32 }
define i8* @dsp_rec(%struct.ir_remote* %0) {
%2 = alloca i8*
%3 = alloca %struct.ir_remote*
store %struct.ir_remote* %0, %struct.ir_remote** %3
%4 = call i32 (...) @clear_rec_buffer()
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
store i8* null, i8** %2
br label %10
7: ; preds = %1
%8 = load %struct.ir_remote*, %struct.ir_remote** %3
%9 = call i8* @decode_all(%struct.ir_remote* %8)
store i8* %9, i8** %2
br label %10
10: ; preds = %7, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
%struct.ir_remote = type { i32 }
define i8* @dsp_rec(%struct.ir_remote* %0) {
%2 = tail call i32 (...) @clear_rec_buffer()
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @decode_all(%struct.ir_remote* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void delete_args_control_name(char *name) { free(name); }


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

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

LLVM IR (-O2):
define void @delete_args_control_name(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main(void) { printf("Hello, world!"); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
FILE *open_out_file(void) {
  FILE *outfile;
  outfile = fopen("lab7.out", "w");
  if (outfile == NULL) {
    printf("Error on fopen of %s \n", "lab7.out");
    exit(EXIT_FAILURE);
  }
  return outfile;
}


x86 assembly (clang, -O0):
<open_out_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    117b <open_out_file+0x4b>
lea    0xeaa(%rip),%rdi
lea    0xe98(%rip),%rsi
call   1030 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_out_file>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     114b <open_out_file+0x1b>
pop    %rcx
ret
lea    0xeb9(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1030 <printf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"lab7.out\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [23 x i8] c"Error on fopen of %s \0A\00"
@EXIT_FAILURE = global i32 0
define i32* @open_out_file() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
%10 = load i32*, i32** %1
ret i32* %10
}

LLVM IR (-O2):
@.str = [9 x i8] c"lab7.out\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [23 x i8] c"Error on fopen of %s \0A\00"
@EXIT_FAILURE = global i32 0
define noalias i32* @open_out_file() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
ret i32* %1
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void _print_usage(void) {
  puts("Usage:");
  puts("\tpm off: call pm_off()");
}


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

x86 assembly (clang, -O2):
<_print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Usage:\00"
@.str.1 = [23 x i8] c"\09pm off: call pm_off()\00"
define void @_print_usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Usage:\00"
@.str.1 = [23 x i8] c"\09pm off: call pm_off()\00"
define void @_print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void io_ddr_config_out(char *pin) {}


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

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

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

LLVM IR (-O2):
define void @io_ddr_config_out(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  for (i = 0; i < 256; i++) {
    printf("\n%d. : %c", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0A%d. : %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"\0A%d. : %c\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t bnep_event_channel_closed_get_destination_uuid(const uint8_t *event) {
  return little_endian_read_16(event, 6);
}


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

x86 assembly (clang, -O2):
<bnep_event_channel_closed_get_destination_uuid>:
mov    $0x6,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @bnep_event_channel_closed_get_destination_uuid(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 6)
ret i32 %2
}
int send_rtp_packet(char *buffer, int length) {}


x86 assembly (clang, -O0):
<send_rtp_packet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @send_rtp_packet(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @send_rtp_packet(i8* nocapture readnone %0, i32 %1) {
ret i32 undef
}
/* Type definitions */
struct thermo_controller {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct thermo_controller *);
void thermometer_cleanup_i2c(struct thermo_controller *th) { free(th); }


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

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

LLVM IR (-O2):
%struct.thermo_controller = type { i32 }
define void @thermometer_cleanup_i2c(%struct.thermo_controller* nocapture %0) {
%2 = tail call i32 @free(%struct.thermo_controller* %0)
ret void
}
/* Type definitions */
struct ptp_clock_time {
  long long sec;
  scalar_t__ nsec;
};
typedef scalar_t__ int64_t;

/* Variables and functions */
int64_t pctns(struct ptp_clock_time *t) {
  return t->sec * 1000000000LL + t->nsec;
}


x86 assembly (clang, -O0):
<pctns>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3b9aca00,(%rax),%rax
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pctns>:
imul   $0x3b9aca00,(%rdi),%rax
add    0x8(%rdi),%rax
ret

LLVM IR (-O0):
%struct.ptp_clock_time = type { i64, i64 }
define i64 @pctns(%struct.ptp_clock_time* %0) {
%2 = alloca %struct.ptp_clock_time*
store %struct.ptp_clock_time* %0, %struct.ptp_clock_time** %2
%3 = load %struct.ptp_clock_time*, %struct.ptp_clock_time** %2
%4 = getelementptr inbounds %struct.ptp_clock_time, %struct.ptp_clock_time* %3, i32 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000000000
%7 = load %struct.ptp_clock_time*, %struct.ptp_clock_time** %2
%8 = getelementptr inbounds %struct.ptp_clock_time, %struct.ptp_clock_time* %7, i32 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %6, %9
ret i64 %10
}

LLVM IR (-O2):
%struct.ptp_clock_time = type { i64, i64 }
define i64 @pctns(%struct.ptp_clock_time* nocapture %0) {
%2 = getelementptr inbounds %struct.ptp_clock_time, %struct.ptp_clock_time* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = mul nsw i64 %3, 1000000000
%5 = getelementptr inbounds %struct.ptp_clock_time, %struct.ptp_clock_time* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = add nsw i64 %4, %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int i = 123, j = 5;
  while (i < 100) {
    if (i == 5) {
      printf("1\n");
      return 1;
    }
    if (i == 6) {
      printf("2\n");
      return 2;
    }
    i++;
  }
  printf("3\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7b,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1189 <main+0x79>
cmpl   $0x5,-0x8(%rbp)
jne    1159 <main+0x49>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    119c <main+0x8c>
cmpl   $0x6,-0x8(%rbp)
jne    117b <main+0x6b>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    119c <main+0x8c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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 = [3 x i8] c"1\0A\00"
@.str.1 = [3 x i8] c"2\0A\00"
@.str.2 = [3 x i8] c"3\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 123, i32* %2
store i32 5, i32* %3
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 5
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %22
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 6
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %1
br label %22
17: ; preds = %12
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %4
20: ; preds = %4
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %22
22: ; preds = %20, %15, %10
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@str = [2 x i8] c"3\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t size) {
  void *allocated = malloc(size);
  if (allocated == NULL) {
    fprintf(stderr,
            "Error:  Insufficient memory "
            "(attempt to malloc %zu bytes)\n",
            (unsigned int)size);
    exit(1);
  }
  return allocated;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1179 <xmalloc+0x49>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    %eax,%edx
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <xmalloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"Error: Insufficient memory (attempt to malloc %zu bytes)\0A\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i64, i64* %2
%11 = trunc i64 %10 to i32
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"Error: Insufficient memory (attempt to malloc %zu bytes)\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = trunc i64 %0 to i32
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int __nvvm_read_ptx_sreg_clock();
long long __nvvm_read_ptx_sreg_clock64();
__attribute__((device)) long long read_clocks() {
  int a = __nvvm_read_ptx_sreg_clock();
  long long b = __nvvm_read_ptx_sreg_clock64();
  return a + b;
}


x86 assembly (clang, -O0):
<read_clocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__nvvm_read_ptx_sreg_clock@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__nvvm_read_ptx_sreg_clock64@plt>
mov    %rax,-0x10(%rbp)
movslq -0x4(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_clocks>:
push   %rbx
xor    %eax,%eax
call   1030 <__nvvm_read_ptx_sreg_clock@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <__nvvm_read_ptx_sreg_clock64@plt>
movslq %ebx,%rcx
add    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @read_clocks() {
%1 = alloca i32
%2 = alloca i64
%3 = call i32 (...) @__nvvm_read_ptx_sreg_clock()
store i32 %3, i32* %1
%4 = call i64 (...) @__nvvm_read_ptx_sreg_clock64()
store i64 %4, i64* %2
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = load i64, i64* %2
%8 = add nsw i64 %6, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @read_clocks() {
%1 = tail call i32 (...) @__nvvm_read_ptx_sreg_clock()
%2 = tail call i64 (...) @__nvvm_read_ptx_sreg_clock64()
%3 = sext i32 %1 to i64
%4 = add nsw i64 %2, %3
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ ReadUint16Be(void const *, int /*<<< orphan*/ *);
int32_t ReadInt16Be(const void *in, int16_t *value) {
  return ReadUint16Be(in, (uint16_t *)value);
}


x86 assembly (clang, -O0):
<ReadInt16Be>:
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 <ReadUint16Be@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadInt16Be>:
jmp    1030 <ReadUint16Be@plt>

LLVM IR (-O0):
define i32 @ReadInt16Be(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 = call i32 @ReadUint16Be(i8* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ReadInt16Be(i8* %0, i32* %1) {
%3 = tail call i32 @ReadUint16Be(i8* %0, i32* %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ __cmpdf2(long, long);
int __ltdf2(long long a1, long long a2) {
  return -(__cmpdf2((long)a1, (long)a2) < 0);
}


x86 assembly (clang, -O0):
<__ltdf2>:
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 <__cmpdf2@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ltdf2>:
push   %rax
call   1030 <__cmpdf2@plt>
sar    $0x3f,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @__ltdf2(i64 %0, i64 %1) {
%3 = tail call i64 @__cmpdf2(i64 %0, i64 %1)
%4 = ashr i64 %3, 63
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_gettid;
int /*<<< orphan*/ syscall(int /*<<< orphan*/);
pid_t _gettid(void) { return syscall(__NR_gettid); }


x86 assembly (clang, -O0):
<_gettid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <syscall@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gettid>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_gettid = global i32 0
define i32 @_gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = call i32 @syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@__NR_gettid = global i32 0
define i32 @_gettid() {
%1 = load i32, i32* @__NR_gettid
%2 = tail call i32 @syscall(i32 %1)
ret i32 %2
}
/* Variables and functions */
const char *string_or_null(const char *s) { return s == NULL ? "<NULL>" : s; }


x86 assembly (clang, -O0):
<string_or_null>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1123 <string_or_null+0x23>
lea    0xee6(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    112b <string_or_null+0x2b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_or_null>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmovne %rdi,%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"<NULL>\00"
define i8* @string_or_null(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = load i8*, i8** %2
br label %8
8: ; preds = %6, %5
%9 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %5 ], [ %7, %6 ]
ret i8* %9
}

LLVM IR (-O2):
@.str = [7 x i8] c"<NULL>\00"
define i8* @string_or_null(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ LPUART5_DriverIRQHandler();
__attribute__((weak)) void LPUART5_IRQHandler(void) {
  LPUART5_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @LPUART5_IRQHandler() {
%1 = call i32 (...) @LPUART5_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @LPUART5_IRQHandler() {
%1 = tail call i32 (...) @LPUART5_DriverIRQHandler()
ret void
}
void store_df(double *p, double d) {
  __asm__("# reg %x0" : "+v"(d));
  *p = d;
}


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

x86 assembly (clang, -O2):
<store_df>:
movsd  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @store_df(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
store double* %0, double** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = call double asm "# reg ${0:x}", "=v,0,~{dirflag},~{fpsr},~{flags}"(double %5)
store double %6, double* %4
%7 = load double, double* %4
%8 = load double*, double** %3
store double %7, double* %8
ret void
}

LLVM IR (-O2):
define void @store_df(double* nocapture writeonly %0, double %1) {
%3 = tail call double asm "# reg ${0:x}", "=v,0,~{dirflag},~{fpsr},~{flags}"(double %1)
store double %3, double* %0
ret void
}
int cmp(const void *x, const void *y) {
  double xx = *(double *)x, yy = *(double *)y;
  if (xx < yy)
    return -1;
  if (xx > yy)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1146 <cmp+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <cmp+0x69>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1162 <cmp+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1169 <cmp+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fcmp olt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp olt double %4, %6
%8 = fcmp ogt double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
scalar_t__ outbyte(int /*<<< orphan*/);
void outstr(char ptr[]) {
  while (outbyte(*ptr++))
    ;
}


x86 assembly (clang, -O0):
<outstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <outbyte@plt>
cmp    $0x0,%rax
je     1142 <outstr+0x32>
jmp    111c <outstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outstr>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
add    $0x1,%rbx
call   1030 <outbyte@plt>
test   %rax,%rax
jne    1120 <outstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @outstr(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = tail call i64 @outbyte(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %2
9: ; preds = %2
ret void
}
int dns_cache_submit(struct dns_packet *query, struct dns_cache *cache) {
  (void)query;
  (void)cache;
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.dns_packet = type opaque
%struct.dns_cache = type opaque
define i32 @dns_cache_submit(%struct.dns_packet* nocapture readnone %0, %struct.dns_cache* nocapture readnone %1) {
ret i32 0
}