xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *get_error_filename(char *appaserver_error_directory,
                         char *destination_application) {
  static char error_filename[256];
  sprintf(error_filename, "%s/appaserver_%s.err", appaserver_error_directory,
          destination_application);
  return error_filename;
}


x86 assembly (clang, -O0):
<get_error_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0x2f11(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2efe(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_error_filename>:
push   %rbx
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0x2f22(%rip),%rbx
lea    0xedb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@get_error_filename.error_filename = internal global [256 x i8] zeroinitializer
@.str = [21 x i8] c"%s/appaserver_%s.err\00"
define i8* @get_error_filename(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 @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_error_filename.error_filename, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_error_filename.error_filename, i64 0, i64 0)
}

LLVM IR (-O2):
@get_error_filename.error_filename = internal global [256 x i8] zeroinitializer
@.str = [21 x i8] c"%s/appaserver_%s.err\00"
define i8* @get_error_filename(i8* %0, i8* %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @get_error_filename.error_filename, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @get_error_filename.error_filename, i64 0, i64 0)
}
int test_imm_21int8_mem(signed char *val) {
  return ((*val) & (-0x21 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_21int8_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, -33
%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_21int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -33
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ rnd(int);
int roll(int number, int sides) {
  int dtotal = 0;
  while (number--)
    dtotal += rnd(sides) + 1;
  return dtotal;
}


x86 assembly (clang, -O0):
<roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1157 <roll+0x47>
mov    -0x8(%rbp),%edi
call   1030 <rnd@plt>
mov    %rax,%rcx
add    $0x1,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
jmp    1125 <roll+0x15>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
je     1134 <roll+0x24>
mov    %esi,%r14d
mov    %edi,%ebp
xor    %ebx,%ebx
nop
mov    %r14d,%edi
call   1030 <rnd@plt>
add    %eax,%ebx
add    $0x1,%ebx
add    $0xffffffff,%ebp
jne    1120 <roll+0x10>
jmp    1136 <roll+0x26>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @roll(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* %3
%8 = add nsw i32 %7, -1
store i32 %8, i32* %3
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i32, i32* %4
%12 = call i64 @rnd(i32 %11)
%13 = add nsw i64 %12, 1
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
br label %6
18: ; preds = %6
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @roll(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = add nsw i32 %6, -1
%8 = tail call i64 @rnd(i32 %1)
%9 = trunc i64 %8 to i32
%10 = add i32 %5, 1
%11 = add i32 %10, %9
%12 = icmp eq i32 %7, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ assert_test_existence();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_hello_world();
int main(int argc, char **argv) {
  assert_test_existence();
  test_hello_world();
  printf("All tests passed.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <assert_test_existence@plt>
mov    $0x0,%al
call   1030 <test_hello_world@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"All tests passed.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @assert_test_existence()
%6 = call i32 (...) @test_hello_world()
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"All tests passed.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @assert_test_existence()
%4 = tail call i32 (...) @test_hello_world()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lua_pushusertag(void *, int /*<<< orphan*/);
void(lua_pushuserdata)(void *u) { lua_pushusertag(u, 0); }


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

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

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

LLVM IR (-O2):
define void @lua_pushuserdata(i8* %0) {
%2 = tail call i32 @lua_pushusertag(i8* %0, i32 0)
ret void
}
/* Variables and functions */
unsigned long long get_timer64();
unsigned long long get_ticks(void) { return get_timer64(); }


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

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

LLVM IR (-O0):
define i64 @get_ticks() {
%1 = call i64 (...) @get_timer64()
ret i64 %1
}

LLVM IR (-O2):
define i64 @get_ticks() {
%1 = tail call i64 (...) @get_timer64()
ret i64 %1
}
/* Variables and functions */
int pow(double, int);
double f(double x) { return (pow(x, 3) - 6 * x + 2); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xecb(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb3(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
movsd  %xmm0,(%rsp)
mov    $0x3,%edi
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
mulsd  0xecf(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0xecb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @pow(double %3, i32 3)
%5 = sitofp i32 %4 to double
%6 = load double, double* %2
%7 = call double @llvm.fmuladd.f64(double -6.000000e+00, double %6, double %5)
%8 = fadd double %7, 2.000000e+00
ret double %8
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call i32 @pow(double %0, i32 3)
%3 = sitofp i32 %2 to double
%4 = tail call double @llvm.fmuladd.f64(double %0, double -6.000000e+00, double %3)
%5 = fadd double %4, 2.000000e+00
ret double %5
}
int isLess(int x, int y) {
  int tY = ~y;
  int signR = x + tY + 1;
  int case1 = x & tY;
  int case2 = (~(x ^ y)) & signR;
  return ((case1 | case2) >> 31) & 1;
}


x86 assembly (clang, -O0):
<isLess>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLess>:
mov    %esi,%ecx
not    %ecx
mov    %edi,%eax
sub    %esi,%eax
and    %edi,%ecx
xor    %edi,%esi
not    %esi
and    %esi,%eax
or     %ecx,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @isLess(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = xor i32 %9, -1
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %6
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = and i32 %15, %16
store i32 %17, i32* %7
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = xor i32 %18, %19
%21 = xor i32 %20, -1
%22 = load i32, i32* %6
%23 = and i32 %21, %22
store i32 %23, i32* %8
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = or i32 %24, %25
%27 = ashr i32 %26, 31
%28 = and i32 %27, 1
ret i32 %28
}

LLVM IR (-O2):
define i32 @isLess(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = sub i32 %0, %1
%5 = and i32 %3, %0
%6 = xor i32 %1, %0
%7 = xor i32 %6, -1
%8 = and i32 %4, %7
%9 = or i32 %8, %5
%10 = lshr i32 %9, 31
ret i32 %10
}
void pinmux_select_spi(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ w_type(struct t_item *);
char const *wt_get_name_sub(int /*<<< orphan*/, unsigned int);
const char *get_weapon_name_sub(struct t_item *w, unsigned subtype) {
  return wt_get_name_sub(w_type(w), subtype);
}


x86 assembly (clang, -O0):
<get_weapon_name_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <w_type@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%esi
call   1030 <wt_get_name_sub@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_weapon_name_sub>:
push   %rbx
mov    %esi,%ebx
call   1040 <w_type@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <wt_get_name_sub@plt>

LLVM IR (-O0):
%struct.t_item = type { i32 }
define i8* @get_weapon_name_sub(%struct.t_item* %0, i32 %1) {
%3 = alloca %struct.t_item*
%4 = alloca i32
store %struct.t_item* %0, %struct.t_item** %3
store i32 %1, i32* %4
%5 = load %struct.t_item*, %struct.t_item** %3
%6 = call i32 @w_type(%struct.t_item* %5)
%7 = load i32, i32* %4
%8 = call i8* @wt_get_name_sub(i32 %6, i32 %7)
ret i8* %8
}

LLVM IR (-O2):
%struct.t_item = type { i32 }
define i8* @get_weapon_name_sub(%struct.t_item* %0, i32 %1) {
%3 = tail call i32 @w_type(%struct.t_item* %0)
%4 = tail call i8* @wt_get_name_sub(i32 %3, i32 %1)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv0) {
  fprintf(stderr, "%s: usage: %s [-f] [-x] <script> <command>\n\n", argv0,
          argv0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rcx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
mov    %rcx,%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"%s: usage: %s [-f] [-x] <script> <command>\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"%s: usage: %s [-f] [-x] <script> <command>\0A\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SCSI_Glitch_Ctl_SaveConfig();
void SCSI_Glitch_Ctl_Sleep(void) { SCSI_Glitch_Ctl_SaveConfig(); }


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

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

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

LLVM IR (-O2):
define void @SCSI_Glitch_Ctl_Sleep() {
%1 = tail call i32 (...) @SCSI_Glitch_Ctl_SaveConfig()
ret void
}
float lms_log(r)
float r;
{ return 4.5; }


x86 assembly (clang, -O0):
<lms_log>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xeeb(%rip),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @lms_log(double %0) {
%2 = alloca float
%3 = fptrunc double %0 to float
store float %3, float* %2
ret float 4.500000e+00
}

LLVM IR (-O2):
define float @lms_log(double %0) {
ret float 4.500000e+00
}
/* Variables and functions */
int mt_rand_uint64();
double mt_rand_double_3(void) {
  return ((mt_rand_uint64() >> 12) + 0.5) * (1.0 / 4503599627370496.0);
}


x86 assembly (clang, -O0):
<mt_rand_double_3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mt_rand_uint64@plt>
sar    $0xc,%eax
cvtsi2sd %eax,%xmm0
movsd  0xede(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeca(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mt_rand_double_3>:
push   %rax
xor    %eax,%eax
call   1030 <mt_rand_uint64@plt>
sar    $0xc,%eax
cvtsi2sd %eax,%xmm0
addsd  0xed9(%rip),%xmm0
mulsd  0xed9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @mt_rand_double_3() {
%1 = call i32 (...) @mt_rand_uint64()
%2 = ashr i32 %1, 12
%3 = sitofp i32 %2 to double
%4 = fadd double %3, 5.000000e-01
%5 = fmul double %4, 0x3CB0000000000000
ret double %5
}

LLVM IR (-O2):
define double @mt_rand_double_3() {
%1 = tail call i32 (...) @mt_rand_uint64()
%2 = ashr i32 %1, 12
%3 = sitofp i32 %2 to double
%4 = fadd double %3, 5.000000e-01
%5 = fmul double %4, 0x3CB0000000000000
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello NDK_OUT!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [15 x i8] c"Hello NDK_OUT!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void connection_check_phase2(void) {}


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

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

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

LLVM IR (-O2):
define void @connection_check_phase2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ stuff();
int main() {
  if (0) {
  foo:
    stuff();
  } else {
    assert(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    113e <main+0x1e>
jmp    114f <main+0x2f>
jmp    1143 <main+0x23>
mov    $0x0,%al
call   1030 <stuff@plt>
jmp    1159 <main+0x39>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br i1 false, label %2, label %5
2: ; preds = %0
br label %3
3: ; preds = %2
%4 = call i32 (...) @stuff()
br label %7
5: ; preds = %0
%6 = call i32 @assert(i32 1)
br label %7
7: ; preds = %5, %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
void free_char_matrix(char **matrix, int maxCols) {
  int i;
  for (i = 0; i < maxCols; i++)
    free(matrix[i]);
  free(matrix);
}


x86 assembly (clang, -O0):
<free_char_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_char_matrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_char_matrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_char_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_char_matrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_char_matrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_char_matrix(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
ret void
}
const char *mg_version(void) { return "3.2"; }


x86 assembly (clang, -O0):
<mg_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"3.2\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"3.2\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ fprintRTF(char *, char);
void BeginCellRTF(char align) { fprintRTF("{\\pard\\intbl\\q%c ", align); }


x86 assembly (clang, -O0):
<BeginCellRTF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <fprintRTF@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"{\\pard\\intbl\\q%c \00"
define void @BeginCellRTF(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @fprintRTF(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"{\\pard\\intbl\\q%c \00"
define void @BeginCellRTF(i8 signext %0) {
%2 = tail call i32 @fprintRTF(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret void
}
/* Type definitions */
struct VariableDensity {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct VariableDensity *);
void deleteVariableDensity(struct VariableDensity **variableDensity) {
  if (*variableDensity) {
    free(*variableDensity);
    *variableDensity = NULL;
  }
}


x86 assembly (clang, -O0):
<deleteVariableDensity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1141 <deleteVariableDensity+0x31>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteVariableDensity>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <deleteVariableDensity+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.VariableDensity = type { i32 }
define void @deleteVariableDensity(%struct.VariableDensity** nocapture %0) {
%2 = load %struct.VariableDensity*, %struct.VariableDensity** %0
%3 = icmp eq %struct.VariableDensity* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(%struct.VariableDensity* %2)
store %struct.VariableDensity* null, %struct.VariableDensity** %0
br label %6
6: ; preds = %4, %1
ret void
}
int mystrcmp(char *dst, char *src, int len) {
  while ((len--) > 0)
    if ((*(dst++)) != (*(src++)))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<mystrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
jle    1160 <mystrcmp+0x60>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     115b <mystrcmp+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    1167 <mystrcmp+0x67>
jmp    110f <mystrcmp+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcmp>:
xor    %eax,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %edx,%edx
jle    112e <mystrcmp+0x2e>
add    $0xffffffff,%edx
movzbl (%rdi,%rcx,1),%r8d
lea    0x1(%rcx),%r9
cmp    (%rsi,%rcx,1),%r8b
mov    %r9,%rcx
je     1110 <mystrcmp+0x10>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @mystrcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %0, %3 ], [ %11, %9 ]
%6 = phi i8* [ %1, %3 ], [ %13, %9 ]
%7 = phi i32 [ %2, %3 ], [ %10, %9 ]
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %6
%15 = icmp eq i8 %12, %14
br i1 %15, label %4, label %16
16: ; preds = %4, %9
%17 = phi i32 [ 1, %9 ], [ 0, %4 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ f06();
int /*<<< orphan*/ f08();
int /*<<< orphan*/ f10();
int /*<<< orphan*/ f12();
void test3(void) {
  f06();
  f08();
  f10();
  f12();
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <f06@plt>
mov    $0x0,%al
call   1040 <f08@plt>
mov    $0x0,%al
call   1060 <f10@plt>
mov    $0x0,%al
call   1050 <f12@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rax
xor    %eax,%eax
call   1030 <f06@plt>
xor    %eax,%eax
call   1040 <f08@plt>
xor    %eax,%eax
call   1060 <f10@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <f12@plt>

LLVM IR (-O0):
define void @test3() {
%1 = call i32 (...) @f06()
%2 = call i32 (...) @f08()
%3 = call i32 (...) @f10()
%4 = call i32 (...) @f12()
ret void
}

LLVM IR (-O2):
define void @test3() {
%1 = tail call i32 (...) @f06()
%2 = tail call i32 (...) @f08()
%3 = tail call i32 (...) @f10()
%4 = tail call i32 (...) @f12()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ calc3_parse(int *, int *);
int /*<<< orphan*/ feof(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(void) {
  int regs[26];
  int base = 10;
  while (!feof(stdin)) {
    calc3_parse(regs, &base);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x74(%rbp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115c <main+0x3c>
jmp    116e <main+0x4e>
lea    -0x70(%rbp),%rdi
lea    -0x74(%rbp),%rsi
call   1030 <calc3_parse@plt>
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
movl   $0xa,0xc(%rsp)
mov    0x2ead(%rip),%r15
mov    (%r15),%edi
call   1040 <feof@plt>
test   %eax,%eax
jne    1177 <main+0x57>
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <calc3_parse@plt>
mov    (%r15),%edi
call   1040 <feof@plt>
test   %eax,%eax
je     1160 <main+0x40>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [26 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %3
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* @stdin
%6 = call i32 @feof(i32 %5)
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = getelementptr inbounds [26 x i32], [26 x i32]* %2, i64 0, i64 0
%11 = call i32 @calc3_parse(i32* %10, i32* %3)
br label %4
12: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca [26 x i32]
%2 = alloca i32
%3 = bitcast [26 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%5 = load i32, i32* @stdin
%6 = call i32 @feof(i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %0
%9 = getelementptr inbounds [26 x i32], [26 x i32]* %1, i64 0, i64 0
br label %10
10: ; preds = %8, %10
%11 = call i32 @calc3_parse(i32* %9, i32* %2)
%12 = load i32, i32* @stdin
%13 = call i32 @feof(i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %10, label %15
15: ; preds = %10, %0
ret i32 0
}
int fun1303() { return 1303; }


x86 assembly (clang, -O0):
<fun1303>:
push   %rbp
mov    %rsp,%rbp
mov    $0x517,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun1303() {
ret i32 1303
}

LLVM IR (-O2):
define i32 @fun1303() {
ret i32 1303
}
/* Variables and functions */
int rand();
void pick_site_two(long id[2]) {
  switch (rand() % 2) {
  case 0:
    id[0] += 1;
    break;
  case 1:
    id[0] -= 1;
  }
}


x86 assembly (clang, -O0):
<pick_site_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
je     1150 <pick_site_two+0x40>
jmp    113f <pick_site_two+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1163 <pick_site_two+0x53>
jmp    1171 <pick_site_two+0x61>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1171 <pick_site_two+0x61>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
sub    $0x1,%rcx
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pick_site_two>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
je     1137 <pick_site_two+0x27>
cmp    $0x1,%eax
jne    113f <pick_site_two+0x2f>
mov    $0xffffffffffffffff,%rax
jmp    113c <pick_site_two+0x2c>
mov    $0x1,%eax
add    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @pick_site_two(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 2
switch i32 %4, label %15 [
i32 0, label %5
i32 1, label %10
]
5: ; preds = %1
%6 = load i64*, i64** %2
%7 = getelementptr inbounds i64, i64* %6, i64 0
%8 = load i64, i64* %7
%9 = add nsw i64 %8, 1
store i64 %9, i64* %7
br label %15
10: ; preds = %1
%11 = load i64*, i64** %2
%12 = getelementptr inbounds i64, i64* %11, i64 0
%13 = load i64, i64* %12
%14 = sub nsw i64 %13, 1
store i64 %14, i64* %12
br label %15
15: ; preds = %10, %1, %5
ret void
}

LLVM IR (-O2):
define void @pick_site_two(i64* nocapture %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 2
switch i32 %3, label %9 [
i32 0, label %5
i32 1, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
%6 = phi i64 [ -1, %4 ], [ 1, %1 ]
%7 = load i64, i64* %0
%8 = add nsw i64 %7, %6
store i64 %8, i64* %0
br label %9
9: ; preds = %5, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ ptrdiff_t;

/* Variables and functions */
void *ptr_offset(void *addr, ptrdiff_t diff) {
  return (void *)((uint8_t *)addr + diff);
}


x86 assembly (clang, -O0):
<ptr_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptr_offset>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rax
ret

LLVM IR (-O0):
define i8* @ptr_offset(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @ptr_offset(i8* readnone %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %3, i64 %4
%6 = bitcast i32* %5 to i8*
ret i8* %6
}
int is_prime(int *val) {
  int i, num = *val;
  for (i = 2; i < num; i++) {
    if (num % i == 0 && i != num)
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    115f <is_prime+0x5f>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    114c <is_prime+0x4c>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     114c <is_prime+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1166 <is_prime+0x66>
jmp    1151 <is_prime+0x51>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <is_prime+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    (%rdi),%esi
xor    %ecx,%ecx
cmp    $0x3,%esi
jl     1120 <is_prime+0x20>
mov    $0x2,%edi
xchg   %ax,%ax
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
je     1123 <is_prime+0x23>
add    $0x1,%edi
cmp    %edi,%esi
jne    1110 <is_prime+0x10>
mov    %ecx,%eax
ret
mov    $0xffffffff,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp sgt i32 %2, 2
br i1 %3, label %6, label %11
4: ; preds = %6
%5 = icmp eq i32 %10, %2
br i1 %5, label %11, label %6
6: ; preds = %1, %4
%7 = phi i32 [ %10, %4 ], [ 2, %1 ]
%8 = srem i32 %2, %7
%9 = icmp eq i32 %8, 0
%10 = add nuw nsw i32 %7, 1
br i1 %9, label %11, label %4
11: ; preds = %6, %4, %1
%12 = phi i32 [ 0, %1 ], [ 0, %4 ], [ -1, %6 ]
ret i32 %12
}
double power7(double a, double b) { return __builtin_copysign(a, b); }


x86 assembly (clang, -O0):
<power7>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movaps 0xee1(%rip),%xmm2
pand   %xmm2,%xmm1
movaps 0xee6(%rip),%xmm2
pand   %xmm2,%xmm0
por    %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<power7>:
andps  0xef9(%rip),%xmm1
andps  0xf02(%rip),%xmm0
orps   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @power7(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @llvm.copysign.f64(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @power7(double %0, double %1) {
%3 = tail call double @llvm.copysign.f64(double %0, double %1)
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void thread_destroy(pthread_t *pthread) { free(pthread); }


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

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

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

LLVM IR (-O2):
define void @thread_destroy(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
double pathcon_nm6_sq(double x) { return x * x; }


x86 assembly (clang, -O0):
<pathcon_nm6_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathcon_nm6_sq>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @pathcon_nm6_sq(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @pathcon_nm6_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
char *double_marshall(void *obj) {
  double d;
  static char buf[128];
  uint32_t i;
  d = *(double *)obj;
  for (i = 0; i < sizeof(double); ++i)
    buf[i] = *(((char *)&d) + i);
  return buf;
}


x86 assembly (clang, -O0):
<double_marshall>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x8,%rax
jae    114e <double_marshall+0x4e>
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,1),%dl
movslq -0x14(%rbp),%rcx
lea    0x2ef3(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <double_marshall+0x1c>
lea    0x2edb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_marshall>:
movsd  (%rdi),%xmm0
movsd  %xmm0,0x2f24(%rip)
lea    0x2f1d(%rip),%rax
ret

LLVM IR (-O0):
@double_marshall.buf = internal global [128 x i8] zeroinitializer
define i8* @double_marshall(i8* %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to double*
%7 = load double, double* %6
store double %7, double* %3
store i32 0, i32* %4
br label %8
8: ; preds = %21, %1
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 8
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = bitcast double* %3 to i8*
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [128 x i8], [128 x i8]* @double_marshall.buf, i64 0, i64 %19
store i8 %17, i8* %20
br label %21
21: ; preds = %12
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %8
24: ; preds = %8
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @double_marshall.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@double_marshall.buf = internal global [128 x i8] zeroinitializer
define i8* @double_marshall(i8* nocapture %0) {
%2 = bitcast i8* %0 to double*
%3 = load double, double* %2
store double %3, double* bitcast ([128 x i8]* @double_marshall.buf to double*)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @double_marshall.buf, i64 0, i64 0)
}
int test_imm_93int16_reg(short val) {
  return ((val) & (-0x93 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_93int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff6d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_93int16_reg>:
test   $0xff6d,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_93int16_reg(i16 signext %0) {
%2 = and i16 %0, -147
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ UpnpResponse_MediaRenderer_AVTransport_Play(void *);
int /*<<< orphan*/ printf(char *, unsigned int, char *);
void UpnpMediaRenderer_AVTransport_Play(void *upnptoken,
                                        unsigned int InstanceID, char *Speed) {
  printf("Invoke: UpnpMediaRenderer_AVTransport_Play(%u,%s);\r\n", InstanceID,
         Speed);
  UpnpResponse_MediaRenderer_AVTransport_Play(upnptoken);
}


x86 assembly (clang, -O0):
<UpnpMediaRenderer_AVTransport_Play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <UpnpResponse_MediaRenderer_AVTransport_Play@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnpMediaRenderer_AVTransport_Play>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <UpnpResponse_MediaRenderer_AVTransport_Play@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Invoke: UpnpMediaRenderer_AVTransport_Play(%u,%s);\0D\0A\00"
define void @UpnpMediaRenderer_AVTransport_Play(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = load i8*, i8** %6
%9 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
%10 = load i8*, i8** %4
%11 = call i32 @UpnpResponse_MediaRenderer_AVTransport_Play(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"Invoke: UpnpMediaRenderer_AVTransport_Play(%u,%s);\0D\0A\00"
define void @UpnpMediaRenderer_AVTransport_Play(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
%5 = tail call i32 @UpnpResponse_MediaRenderer_AVTransport_Play(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void stdError(char *errorString, int value) {
  fprintf(stderr, "%s: %d\n", errorString, value);
  exit(1);
}


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

x86 assembly (clang, -O2):
<stdError>:
push   %rax
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %d\0A\00"
define void @stdError(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%5 = tail call i32 @exit(i32 1)
unreachable
}
int fvin_get_configuration(int opcode) {
  switch (opcode) {
  case 0:
    return (25);
  case 1:
    return (10);
  case 2:
    return (0xffff);
  }
}


x86 assembly (clang, -O0):
<fvin_get_configuration>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     113c <fvin_get_configuration+0x3c>
jmp    111a <fvin_get_configuration+0x1a>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1148 <fvin_get_configuration+0x48>
jmp    112b <fvin_get_configuration+0x2b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1154 <fvin_get_configuration+0x54>
jmp    115b <fvin_get_configuration+0x5b>
movl   $0x19,-0x4(%rbp)
jmp    115b <fvin_get_configuration+0x5b>
movl   $0xa,-0x4(%rbp)
jmp    115b <fvin_get_configuration+0x5b>
movl   $0xffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fvin_get_configuration>:
cmp    $0x1,%edi
mov    $0xa,%eax
mov    $0x19,%ecx
cmove  %eax,%ecx
cmp    $0x2,%edi
mov    $0xffff,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fvin_get_configuration(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i32 10, i32 25
%4 = icmp eq i32 %0, 2
%5 = select i1 %4, i32 65535, i32 %3
ret i32 %5
}
/* Variables and functions */
int getpid();
int ModelicaInternal_getpid(void) { return getpid(); }


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

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

LLVM IR (-O0):
define i32 @ModelicaInternal_getpid() {
%1 = call i32 (...) @getpid()
ret i32 %1
}

LLVM IR (-O2):
define i32 @ModelicaInternal_getpid() {
%1 = tail call i32 (...) @getpid()
ret i32 %1
}