xunge/DecIR huggingface dataset:
/* Variables and functions */
int octet_matches_(char const *, char const *, int /*<<< orphan*/);
int octet_matches(const char *pat, const char *text) {
  return octet_matches_(pat, text, 0);
}


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

x86 assembly (clang, -O2):
<octet_matches>:
xor    %edx,%edx
jmp    1030 <octet_matches_@plt>

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

LLVM IR (-O2):
define i32 @octet_matches(i8* %0, i8* %1) {
%3 = tail call i32 @octet_matches_(i8* %0, i8* %1, i32 0)
ret i32 %3
}
/* Variables and functions */
size_t simple_parse(char const *, size_t, char);
size_t protocol_parser_statsd(const char *instr, size_t inlen) {
  return simple_parse(instr, inlen, ':');
}


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

x86 assembly (clang, -O2):
<protocol_parser_statsd>:
mov    $0x3a,%edx
jmp    1030 <simple_parse@plt>

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

LLVM IR (-O2):
define i64 @protocol_parser_statsd(i8* %0, i64 %1) {
%3 = tail call i64 @simple_parse(i8* %0, i64 %1, i8 signext 58)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ free_s(void *);
int AttributeDestroyCallback(void *attributeInstance) {
  free_s(attributeInstance);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @AttributeDestroyCallback(i8* %0) {
%2 = tail call i32 @free_s(i8* %0)
ret i32 0
}
/* Variables and functions */
float Q_GainForAttenuation(int, float, float, float, float);
float SNAP_GainForAttenuation(float dist, float attenuation) {
  int model = 3;
  float maxdistance = 8000;
  float refdistance = 175;
  return Q_GainForAttenuation(model, maxdistance, refdistance, dist,
                              attenuation);
}


x86 assembly (clang, -O0):
<SNAP_GainForAttenuation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movss  0xed3(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0xc(%rbp),%edi
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
call   1030 <Q_GainForAttenuation@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SNAP_GainForAttenuation>:
movaps %xmm1,%xmm3
movaps %xmm0,%xmm2
movss  0xee2(%rip),%xmm0
movss  0xede(%rip),%xmm1
mov    $0x3,%edi
jmp    1030 <Q_GainForAttenuation@plt>

LLVM IR (-O0):
define float @SNAP_GainForAttenuation(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
store i32 3, i32* %5
store float 8.000000e+03, float* %6
store float 1.750000e+02, float* %7
%8 = load i32, i32* %5
%9 = load float, float* %6
%10 = load float, float* %7
%11 = load float, float* %3
%12 = load float, float* %4
%13 = call float @Q_GainForAttenuation(i32 %8, float %9, float %10, float %11, float %12)
ret float %13
}

LLVM IR (-O2):
define float @SNAP_GainForAttenuation(float %0, float %1) {
%3 = tail call float @Q_GainForAttenuation(i32 3, float 8.000000e+03, float 1.750000e+02, float %0, float %1)
ret float %3
}
void getcpos_(ix, iy) short *ix, *iy;
{ getcpos(ix, iy); }


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

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

LLVM IR (-O0):
define void @getcpos_(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
store i16* %0, i16** %3
store i16* %1, i16** %4
%5 = load i16*, i16** %3
%6 = load i16*, i16** %4
%7 = call i32 (i16*, i16*, ...) bitcast (i32 (...)* @getcpos to i32 (i16*, i16*, ...)*)(i16* %5, i16* %6)
ret void
}

LLVM IR (-O2):
define void @getcpos_(i16* %0, i16* %1) {
%3 = tail call i32 (i16*, i16*, ...) bitcast (i32 (...)* @getcpos to i32 (i16*, i16*, ...)*)(i16* %0, i16* %1)
ret void
}
int dll_compar_int(const void *item1, const void *item2) {
  int int1 = *((int *)item1);
  int int2 = *((int *)item2);
  if (int1 > int2)
    return 1;
  if (int1 < int2)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<dll_compar_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <dll_compar_int+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <dll_compar_int+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    114e <dll_compar_int+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <dll_compar_int+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dll_compar_int>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

LLVM IR (-O0):
define i32 @dll_compar_int(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
store i32 %10, i32* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = icmp sgt i32 %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 i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp slt i32 %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 @dll_compar_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf2(char *, unsigned int);
void GenZeroData(unsigned Size, int bss) {
  (void)bss;
  printf2("\tfill($%d)\n", Size);
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"\09fill($%d)\0A\00"
define void @GenZeroData(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @printf2(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"\09fill($%d)\0A\00"
define void @GenZeroData(i32 %0, i32 %1) {
%3 = tail call i32 @printf2(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void v_free(void *pA) { free(pA); }


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

LLVM IR (-O0):
define void @v_free(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 @v_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DisplayUsage();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void DisplayInvalidParameter(char *param) {
  fprintf(stderr, "fornav: Parameter %s is invalid.\n", param);
  DisplayUsage();
}


x86 assembly (clang, -O0):
<DisplayInvalidParameter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <DisplayUsage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayInvalidParameter>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <DisplayUsage@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"fornav: Parameter %s is invalid.\0A\00"
define void @DisplayInvalidParameter(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @DisplayUsage()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"fornav: Parameter %s is invalid.\0A\00"
define void @DisplayInvalidParameter(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @DisplayUsage()
ret void
}
/* Variables and functions */
int is_composite(int);
int next_composite(int x) {
  while (is_composite(x) != 1)
    x++;
  return x;
}


x86 assembly (clang, -O0):
<next_composite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <is_composite@plt>
cmp    $0x1,%eax
je     113a <next_composite+0x2a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <next_composite+0xb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_composite>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <is_composite@plt>
add    $0x1,%ebx
cmp    $0x1,%eax
jne    1120 <next_composite+0x10>
add    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @next_composite(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = tail call i32 @is_composite(i32 %3)
%5 = icmp eq i32 %4, 1
%6 = add nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret i32 %3
}
/* Type definitions */
struct SSH_CONN {
  int dummy;
};
struct SSH_CHAN_CONFIG {
  int dummy;
};

/* Variables and functions */
int ssh_chan_run_connection(struct SSH_CONN *, int,
                            struct SSH_CHAN_CONFIG const *);
int ssh_conn_run(struct SSH_CONN *conn, int num_channels,
                 const struct SSH_CHAN_CONFIG *channel_cfgs) {
  return ssh_chan_run_connection(conn, num_channels, channel_cfgs);
}


x86 assembly (clang, -O0):
<ssh_conn_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <ssh_chan_run_connection@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssh_conn_run>:
jmp    1030 <ssh_chan_run_connection@plt>

LLVM IR (-O0):
%struct.SSH_CONN = type { i32 }
%struct.SSH_CHAN_CONFIG = type { i32 }
define i32 @ssh_conn_run(%struct.SSH_CONN* %0, i32 %1, %struct.SSH_CHAN_CONFIG* %2) {
%4 = alloca %struct.SSH_CONN*
%5 = alloca i32
%6 = alloca %struct.SSH_CHAN_CONFIG*
store %struct.SSH_CONN* %0, %struct.SSH_CONN** %4
store i32 %1, i32* %5
store %struct.SSH_CHAN_CONFIG* %2, %struct.SSH_CHAN_CONFIG** %6
%7 = load %struct.SSH_CONN*, %struct.SSH_CONN** %4
%8 = load i32, i32* %5
%9 = load %struct.SSH_CHAN_CONFIG*, %struct.SSH_CHAN_CONFIG** %6
%10 = call i32 @ssh_chan_run_connection(%struct.SSH_CONN* %7, i32 %8, %struct.SSH_CHAN_CONFIG* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.SSH_CONN = type { i32 }
%struct.SSH_CHAN_CONFIG = type { i32 }
define i32 @ssh_conn_run(%struct.SSH_CONN* %0, i32 %1, %struct.SSH_CHAN_CONFIG* %2) {
%4 = tail call i32 @ssh_chan_run_connection(%struct.SSH_CONN* %0, i32 %1, %struct.SSH_CHAN_CONFIG* %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ COND_LE();
int /*<<< orphan*/ EA_AY_PI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sle_8_pi(void) {
  m68ki_write_8(EA_AY_PI_8(), COND_LE() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_sle_8_pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_AY_PI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_LE@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sle_8_pi>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_AY_PI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_LE@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sle_8_pi() {
%1 = call i32 (...) @EA_AY_PI_8()
%2 = call i64 (...) @COND_LE()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sle_8_pi() {
%1 = tail call i32 (...) @EA_AY_PI_8()
%2 = tail call i64 (...) @COND_LE()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int);
int /*<<< orphan*/ output_byte(int);
int /*<<< orphan*/ output_w32(int);
void emit_pushimm(int imm) {
  assem_debug("push $%x\n", imm);
  output_byte(0x68);
  output_w32(imm);
}


x86 assembly (clang, -O0):
<emit_pushimm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0x68,%edi
call   1050 <output_byte@plt>
mov    -0x4(%rbp),%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_pushimm>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
mov    %ebx,%esi
call   1030 <assem_debug@plt>
mov    $0x68,%edi
call   1050 <output_byte@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"push $%x\0A\00"
define void @emit_pushimm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @output_byte(i32 104)
%6 = load i32, i32* %2
%7 = call i32 @output_w32(i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"push $%x\0A\00"
define void @emit_pushimm(i32 %0) {
%2 = tail call i32 @assem_debug(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @output_byte(i32 104)
%4 = tail call i32 @output_w32(i32 %0)
ret void
}
int swap_endian(const unsigned int in, const char size) {
  unsigned int out = 0;
  switch (size) {
  case 2:
    out = ((in >> 8) & 0xFF) + ((in << 8) & 0xFFFF);
    break;
  case 4:
    out =
        (in >> 24) + ((in >> 8) & 0xFF00) + ((in << 8) & 0xFF0000) + (in << 24);
    break;
  }
  return out;
}


x86 assembly (clang, -O0):
<swap_endian>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x2,%eax
je     113a <swap_endian+0x3a>
jmp    1129 <swap_endian+0x29>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     115b <swap_endian+0x5b>
jmp    1188 <swap_endian+0x88>
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xffff,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1188 <swap_endian+0x88>
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff00,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff0000,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_endian>:
cmp    $0x4,%esi
je     1114 <swap_endian+0x14>
xor    %eax,%eax
cmp    $0x2,%esi
jne    1118 <swap_endian+0x18>
rol    $0x8,%di
movzwl %di,%eax
ret
bswap  %edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @swap_endian(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i32
store i32 %0, i32* %3
store i8 %1, i8* %4
store i32 0, i32* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %30 [
i32 2, label %8
i32 4, label %16
]
8: ; preds = %2
%9 = load i32, i32* %3
%10 = lshr i32 %9, 8
%11 = and i32 %10, 255
%12 = load i32, i32* %3
%13 = shl i32 %12, 8
%14 = and i32 %13, 65535
%15 = add i32 %11, %14
store i32 %15, i32* %5
br label %30
16: ; preds = %2
%17 = load i32, i32* %3
%18 = lshr i32 %17, 24
%19 = load i32, i32* %3
%20 = lshr i32 %19, 8
%21 = and i32 %20, 65280
%22 = add i32 %18, %21
%23 = load i32, i32* %3
%24 = shl i32 %23, 8
%25 = and i32 %24, 16711680
%26 = add i32 %22, %25
%27 = load i32, i32* %3
%28 = shl i32 %27, 24
%29 = add i32 %26, %28
store i32 %29, i32* %5
br label %30
30: ; preds = %2, %16, %8
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @swap_endian(i32 %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %10 [
i32 2, label %4
i32 4, label %8
]
4: ; preds = %2
%5 = trunc i32 %0 to i16
%6 = tail call i16 @llvm.bswap.i16(i16 %5)
%7 = zext i16 %6 to i32
br label %10
8: ; preds = %2
%9 = tail call i32 @llvm.bswap.i32(i32 %0)
br label %10
10: ; preds = %2, %8, %4
%11 = phi i32 [ 0, %2 ], [ %9, %8 ], [ %7, %4 ]
ret i32 %11
}
void f2() {
  typedef int __attribute__((__mode__(__HI__))) hi_int_type;
  hi_int_type hi_int;
  __sync_bool_compare_and_swap(&hi_int, (hi_int_type)0, (hi_int_type)1);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    $0x1,%cx
lock cmpxchg %cx,-0x2(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
mov    $0x1,%cx
xor    %eax,%eax
lock cmpxchg %cx,-0x2(%rsp)
ret

LLVM IR (-O0):
define void @f2() {
%1 = alloca i16
%2 = cmpxchg i16* %1, i16 0, i16 1 seq_cst seq_cst
%3 = extractvalue { i16, i1 } %2, 1
ret void
}

LLVM IR (-O2):
define void @f2() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
%3 = cmpxchg i16* %1, i16 0, i16 1 seq_cst seq_cst
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void f(int *array, int size) { printf("%d\n", size); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @f(i32* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int check_zero_block(char *buf, int blocksize) {
  char *cp = buf;
  int left = blocksize;
  while (left > 0) {
    if (*cp++)
      return 0;
    left--;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_zero_block>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1155 <check_zero_block+0x55>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
cmpb   $0x0,(%rax)
je     1147 <check_zero_block+0x47>
movl   $0x0,-0x4(%rbp)
jmp    115c <check_zero_block+0x5c>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1119 <check_zero_block+0x19>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_zero_block>:
mov    $0x1,%eax
test   %esi,%esi
jle    1121 <check_zero_block+0x21>
add    $0x1,%esi
nopl   0x0(%rax)
cmpb   $0x0,(%rdi)
jne    1122 <check_zero_block+0x22>
add    $0x1,%rdi
add    $0xffffffff,%esi
cmp    $0x1,%esi
jg     1110 <check_zero_block+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @check_zero_block(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %9
%5 = phi i32 [ %11, %9 ], [ %1, %2 ]
%6 = phi i8* [ %10, %9 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = add nsw i32 %5, -1
%12 = icmp sgt i32 %5, 1
br i1 %12, label %4, label %13
13: ; preds = %4, %9, %2
%14 = phi i32 [ 1, %2 ], [ 1, %9 ], [ 0, %4 ]
ret i32 %14
}
int bcd2int(int hex) {
  if (hex > 0xff)
    return -1;
  return ((hex & 0xF0) >> 4) * 10 + (hex & 0x0F);
}


x86 assembly (clang, -O0):
<bcd2int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jle    1120 <bcd2int+0x20>
movl   $0xffffffff,-0x4(%rbp)
jmp    1139 <bcd2int+0x39>
mov    -0x8(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
imul   $0xa,%eax,%eax
mov    -0x8(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd2int>:
mov    $0xffffffff,%eax
cmp    $0xff,%edi
jg     111e <bcd2int+0x1e>
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    (%rax,%rax,4),%eax
and    $0xf,%edi
lea    (%rdi,%rax,2),%eax
ret

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

LLVM IR (-O2):
define i32 @bcd2int(i32 %0) {
%2 = icmp sgt i32 %0, 255
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = lshr i32 %0, 4
%5 = and i32 %4, 15
%6 = mul nuw nsw i32 %5, 10
%7 = and i32 %0, 15
%8 = add nuw nsw i32 %6, %7
br label %9
9: ; preds = %1, %3
%10 = phi i32 [ %8, %3 ], [ -1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
report_bye(char *s) {
  fprintf(stderr, "%s\n", s);
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @report_bye(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @report_bye(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Atm128UartP__0__HplUart__txDone();
void HplAtm128UartP__HplUart0__txDone(void) {
  Atm128UartP__0__HplUart__txDone();
}


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

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

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

LLVM IR (-O2):
define void @HplAtm128UartP__HplUart0__txDone() {
%1 = tail call i32 (...) @Atm128UartP__0__HplUart__txDone()
ret void
}
int test_imm_30int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x30 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_30int64_midword_mem>:
testb  $0x30,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_30int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 3145728
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char f(int x) { return x + 1; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @f(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 1
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ search_subspace(int, int, int);
void search_space(void) {
  for (int c = 3; c <= 21; c += 3) {
    search_subspace(c, c, c);
  }
}


x86 assembly (clang, -O0):
<search_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
cmpl   $0x15,-0x4(%rbp)
jg     1145 <search_space+0x35>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1030 <search_subspace@plt>
mov    -0x4(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <search_space+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_space>:
push   %rax
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x3,%edx
call   1030 <search_subspace@plt>
mov    $0x6,%edi
mov    $0x6,%esi
mov    $0x6,%edx
call   1030 <search_subspace@plt>
mov    $0x9,%edi
mov    $0x9,%esi
mov    $0x9,%edx
call   1030 <search_subspace@plt>
mov    $0xc,%edi
mov    $0xc,%esi
mov    $0xc,%edx
call   1030 <search_subspace@plt>
mov    $0xf,%edi
mov    $0xf,%esi
mov    $0xf,%edx
call   1030 <search_subspace@plt>
mov    $0x12,%edi
mov    $0x12,%esi
mov    $0x12,%edx
call   1030 <search_subspace@plt>
mov    $0x15,%edi
mov    $0x15,%esi
mov    $0x15,%edx
pop    %rax
jmp    1030 <search_subspace@plt>

LLVM IR (-O0):
define void @search_space() {
%1 = alloca i32
store i32 3, i32* %1
br label %2
2: ; preds = %10, %0
%3 = load i32, i32* %1
%4 = icmp sle i32 %3, 21
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = load i32, i32* %1
%7 = load i32, i32* %1
%8 = load i32, i32* %1
%9 = call i32 @search_subspace(i32 %6, i32 %7, i32 %8)
br label %10
10: ; preds = %5
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 3
store i32 %12, i32* %1
br label %2
13: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @search_space() {
%1 = tail call i32 @search_subspace(i32 3, i32 3, i32 3)
%2 = tail call i32 @search_subspace(i32 6, i32 6, i32 6)
%3 = tail call i32 @search_subspace(i32 9, i32 9, i32 9)
%4 = tail call i32 @search_subspace(i32 12, i32 12, i32 12)
%5 = tail call i32 @search_subspace(i32 15, i32 15, i32 15)
%6 = tail call i32 @search_subspace(i32 18, i32 18, i32 18)
%7 = tail call i32 @search_subspace(i32 21, i32 21, i32 21)
ret void
}
void RTHandleTableLookup(void) {}


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

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

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

LLVM IR (-O2):
define void @RTHandleTableLookup() {
ret void
}
void _assert(const char *expr) {}


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

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

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

LLVM IR (-O2):
define void @_assert(i8* nocapture %0) {
ret void
}
float helpmod_percentage(int larger, int smaller) {
  if (larger == 0)
    return 0.0;
  return 100.0 * ((float)smaller / (float)larger);
}


x86 assembly (clang, -O0):
<helpmod_percentage>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1121 <helpmod_percentage+0x21>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1148 <helpmod_percentage+0x48>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<helpmod_percentage>:
test   %edi,%edi
je     1119 <helpmod_percentage+0x19>
cvtsi2ss %esi,%xmm0
cvtsi2ss %edi,%xmm1
divss  %xmm1,%xmm0
mulss  0xee8(%rip),%xmm0
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @helpmod_percentage(i32 %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store float 0.000000e+00, float* %3
br label %18
9: ; preds = %2
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to float
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to float
%14 = fdiv float %11, %13
%15 = fpext float %14 to double
%16 = fmul double 1.000000e+02, %15
%17 = fptrunc double %16 to float
store float %17, float* %3
br label %18
18: ; preds = %9, %8
%19 = load float, float* %3
ret float %19
}

LLVM IR (-O2):
define float @helpmod_percentage(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = sitofp i32 %1 to float
%6 = sitofp i32 %0 to float
%7 = fdiv float %5, %6
%8 = fmul float %7, 1.000000e+02
br label %9
9: ; preds = %2, %4
%10 = phi float [ %8, %4 ], [ 0.000000e+00, %2 ]
ret float %10
}
short Maxval(short a, short b) {
  if (a > b)
    return a;
  else
    return b;
}


x86 assembly (clang, -O0):
<Maxval>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movswl -0x4(%rbp),%eax
movswl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jle    112f <Maxval+0x2f>
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
jmp    1137 <Maxval+0x37>
mov    -0x6(%rbp),%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Maxval>:
mov    %esi,%eax
cmp    %ax,%di
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define signext i16 @Maxval(i16 signext %0, i16 signext %1) {
%3 = icmp sgt i16 %0, %1
%4 = select i1 %3, i16 %0, i16 %1
ret i16 %4
}
/* Type definitions */
struct rusage {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getpid();
int wait4(int /*<<< orphan*/, int *, int /*<<< orphan*/, struct rusage *);
int main(void) {
  int status;
  struct rusage rusage;
  return wait4(getpid(), &status, 0, &rusage);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %eax,%edi
xor    %edx,%edx
call   1040 <wait4@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.rusage = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.rusage
store i32 0, i32* %1
%4 = call i32 (...) @getpid()
%5 = call i32 @wait4(i32 %4, i32* %2, i32 0, %struct.rusage* %3)
ret i32 %5
}

LLVM IR (-O2):
%struct.rusage = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rusage
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.rusage* %2 to i8*
%5 = tail call i32 (...) @getpid()
%6 = call i32 @wait4(i32 %5, i32* %1, i32 0, %struct.rusage* %2)
ret i32 %6
}
int test_imm_E8int8_mem(signed char *val) {
  return ((*val) & (0xE8 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E8int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xe8,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E8int8_mem>:
testb  $0xe8,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E8int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -24
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct uniform_random {
  int dummy;
};

/* Variables and functions */
scalar_t__ int64(struct uniform_random *);
unsigned int int32(struct uniform_random *ran) {
  return (unsigned int)int64(ran);
}


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

x86 assembly (clang, -O2):
<int32>:
jmp    1030 <int64@plt>

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

LLVM IR (-O2):
%struct.uniform_random = type { i32 }
define i32 @int32(%struct.uniform_random* %0) {
%2 = tail call i64 @int64(%struct.uniform_random* %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void ldclt_sleep(int nseconds) { sleep(nseconds); }


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

x86 assembly (clang, -O2):
<ldclt_sleep>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @ldclt_sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LEDOutput(int);
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ set_rclk(int);
void MatrixLedCleanScreen() {
  LEDOutput((0x346B));
  set_rclk(0);
  delay((0x01));
  set_rclk(1);
  delay((0x01));
}


x86 assembly (clang, -O0):
<MatrixLedCleanScreen>:
push   %rbp
mov    %rsp,%rbp
mov    $0x346b,%edi
call   1050 <LEDOutput@plt>
xor    %edi,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
call   1030 <delay@plt>
mov    $0x1,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MatrixLedCleanScreen>:
push   %rax
mov    $0x346b,%edi
call   1050 <LEDOutput@plt>
xor    %edi,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
call   1030 <delay@plt>
mov    $0x1,%edi
call   1040 <set_rclk@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @MatrixLedCleanScreen() {
%1 = call i32 @LEDOutput(i32 13419)
%2 = call i32 @set_rclk(i32 0)
%3 = call i32 @delay(i32 1)
%4 = call i32 @set_rclk(i32 1)
%5 = call i32 @delay(i32 1)
ret void
}

LLVM IR (-O2):
define void @MatrixLedCleanScreen() {
%1 = tail call i32 @LEDOutput(i32 13419)
%2 = tail call i32 @set_rclk(i32 0)
%3 = tail call i32 @delay(i32 1)
%4 = tail call i32 @set_rclk(i32 1)
%5 = tail call i32 @delay(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ talloc_abort(char *);
void talloc_abort_double_free(void) {
  talloc_abort("Bad talloc magic value - double free");
}


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"Bad talloc magic value - double free\00"
define void @talloc_abort_double_free() {
%1 = call i32 @talloc_abort(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Bad talloc magic value - double free\00"
define void @talloc_abort_double_free() {
%1 = tail call i32 @talloc_abort(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printValue(int, int);
int /*<<< orphan*/ printf(char *);
int turnOffRightmostContiguousStringOfSet(int value) {
  value = ((value | (value - 1)) + 1) & value;
  printValue(value, 8);
  printf(" TORCSOS\n");
  return value;
}


x86 assembly (clang, -O0):
<turnOffRightmostContiguousStringOfSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
or     %ecx,%eax
add    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1040 <printValue@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turnOffRightmostContiguousStringOfSet>:
push   %rbx
lea    -0x1(%rdi),%ebx
or     %edi,%ebx
add    $0x1,%ebx
and    %edi,%ebx
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <printValue@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c" TORCSOS\0A\00"
define i32 @turnOffRightmostContiguousStringOfSet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 1
%6 = or i32 %3, %5
%7 = add nsw i32 %6, 1
%8 = load i32, i32* %2
%9 = and i32 %7, %8
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @printValue(i32 %10, i32 8)
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@str = [9 x i8] c" TORCSOS\00"
define i32 @turnOffRightmostContiguousStringOfSet(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = or i32 %2, %0
%4 = add nsw i32 %3, 1
%5 = and i32 %4, %0
%6 = tail call i32 @printValue(i32 %5, i32 8)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 %5
}
void update_int_unlock() {}


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

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

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

LLVM IR (-O2):
define void @update_int_unlock() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t cpu_to_le32(uint32_t v) { return (v); }


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

x86 assembly (clang, -O2):
<cpu_to_le32>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cpu_to_le32(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ handle_args(int, char **);
int /*<<< orphan*/ startThreads(int, char **);
int main(int argc, char *argv[]) {
  handle_args(argc, argv);
  startThreads(argc, argv);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <handle_args@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <startThreads@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <handle_args@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <startThreads@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @handle_args(i32 %6, i8** %7)
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @startThreads(i32 %9, i8** %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @handle_args(i32 %0, i8** %1)
%4 = tail call i32 @startThreads(i32 %0, i8** %1)
ret i32 0
}
void RTLogRelPrintf(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLogRelPrintf() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void smpte_hbrmt_set_frame_count(uint8_t *p_hbrmt, uint8_t frcount) {
  p_hbrmt[1] = frcount;
}


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

x86 assembly (clang, -O2):
<smpte_hbrmt_set_frame_count>:
mov    %esi,0x4(%rdi)
ret

LLVM IR (-O0):
define void @smpte_hbrmt_set_frame_count(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @smpte_hbrmt_set_frame_count(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
char *ParseMalloc(int);
char *myalloc(int x) {
  ;
  return (ParseMalloc(x));
}


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

x86 assembly (clang, -O2):
<myalloc>:
jmp    1030 <ParseMalloc@plt>

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

LLVM IR (-O2):
define i8* @myalloc(i32 %0) {
%2 = tail call i8* @ParseMalloc(i32 %0)
ret i8* %2
}