xunge/DecIR huggingface dataset:
/* Variables and functions */
int pow(int, int);
int _next_position(int k) { return (pow(3, k) - 1) / 2; }


x86 assembly (clang, -O0):
<_next_position>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x3,%edi
call   1030 <pow@plt>
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_next_position>:
push   %rax
mov    %edi,%esi
mov    $0x3,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
add    $0xffffffff,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0xffffffff,%eax
sar    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_next_position(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @pow(i32 3, i32 %3)
%5 = sub nsw i32 %4, 1
%6 = sdiv i32 %5, 2
ret i32 %6
}

LLVM IR (-O2):
define i32 @_next_position(i32 %0) {
%2 = tail call i32 @pow(i32 3, i32 %0)
%3 = add nsw i32 %2, -1
%4 = sdiv i32 %3, 2
ret i32 %4
}
/* Variables and functions */
unsigned char msg_send2(int, unsigned char, unsigned char);
unsigned char ANT_SetChannelRFFreq(unsigned char chan, unsigned char freq) {
  return msg_send2(0x45, chan, freq);
}


x86 assembly (clang, -O0):
<ANT_SetChannelRFFreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
mov    $0x45,%edi
movzbl %al,%esi
movzbl -0x2(%rbp),%edx
call   1030 <msg_send2@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ANT_SetChannelRFFreq>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x45,%edi
jmp    1030 <msg_send2@plt>

LLVM IR (-O0):
define zeroext i8 @ANT_SetChannelRFFreq(i8 zeroext %0, i8 zeroext %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 zeroext i8 @msg_send2(i32 69, i8 zeroext %5, i8 zeroext %6)
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @ANT_SetChannelRFFreq(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call zeroext i8 @msg_send2(i32 69, i8 zeroext %0, i8 zeroext %1)
ret i8 %3
}
char *find(char *haystack, char needle) {
  if (needle == *haystack)
    return (void *)1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    112f <find+0x2f>
mov    $0x1,%eax
mov    %rax,-0x8(%rbp)
jmp    1137 <find+0x37>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
xor    %eax,%eax
cmp    %sil,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i8* @find(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
%5 = select i1 %4, i8* inttoptr (i64 1 to i8*), i8* null
ret i8* %5
}
void handle_54(sig) int sig;
{}


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

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

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

LLVM IR (-O2):
define void @handle_54(i32 %0) {
ret void
}
void g_DUMMY_menu_destroy_buttonbar2(int win_id) { win_id = win_id; }


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

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

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

LLVM IR (-O2):
define void @g_DUMMY_menu_destroy_buttonbar2(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ btree_build(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ dfile_close(int);
int /*<<< orphan*/ dfile_create(char *, char *, char *, int, int, int);
int dfile_open(char *, int);
void g_create_object_file(char *name, char *ident, int compress) {
  int id;
  dfile_create(name, ident, "GP00", 1, 1, compress);
  id = dfile_open(name, 1);
  btree_build(id, 0, 32);
  dfile_close(id);
}


x86 assembly (clang, -O0):
<g_create_object_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%r9d
lea    0xe9a(%rip),%rdx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1040 <dfile_create@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1050 <dfile_open@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <btree_build@plt>
mov    -0x18(%rbp),%edi
call   1030 <dfile_close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_create_object_file>:
push   %rbx
mov    %edx,%r9d
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1040 <dfile_create@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <dfile_open@plt>
mov    %eax,%ebx
mov    %eax,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <btree_build@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <dfile_close@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"GP00\00"
define void @g_create_object_file(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @dfile_create(i8* %8, i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, i32 %10)
%12 = load i8*, i8** %4
%13 = call i32 @dfile_open(i8* %12, i32 1)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = call i32 @btree_build(i32 %14, i32 0, i32 32)
%16 = load i32, i32* %7
%17 = call i32 @dfile_close(i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"GP00\00"
define void @g_create_object_file(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @dfile_create(i8* %0, i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, i32 %2)
%5 = tail call i32 @dfile_open(i8* %0, i32 1)
%6 = tail call i32 @btree_build(i32 %5, i32 0, i32 32)
%7 = tail call i32 @dfile_close(i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ at_assert_f(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ error();
void _at_tf_Errorx(int *data) {
  if (!at_assert_f(error(),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/alexandream/atest/refs/"
                   "heads/master/src/example.c",
                   48))
    return;
}


x86 assembly (clang, -O0):
<_at_tf_Errorx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <error@plt>
mov    %eax,%edi
lea    0xec4(%rip),%rsi
mov    $0x30,%edx
call   1040 <at_assert_f@plt>
cmp    $0x0,%eax
jne    1154 <_at_tf_Errorx+0x34>
jmp    1154 <_at_tf_Errorx+0x34>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_at_tf_Errorx>:
push   %rax
xor    %eax,%eax
call   1030 <error@plt>
lea    0xed1(%rip),%rsi
mov    %eax,%edi
mov    $0x30,%edx
pop    %rax
jmp    1040 <at_assert_f@plt>

LLVM IR (-O0):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alexandream/atest/refs/heads/master/src/example.c\00"
define void @_at_tf_Errorx(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (...) @error()
%4 = call i32 @at_assert_f(i32 %3, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 48)
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
br label %7
7: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alexandream/atest/refs/heads/master/src/example.c\00"
define void @_at_tf_Errorx(i32* nocapture readnone %0) {
%2 = tail call i32 (...) @error()
%3 = tail call i32 @at_assert_f(i32 %2, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 48)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", 1);
  printf("%d\n", 0);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 0
}
/* Variables and functions */
int INT_MIN;
int test4(int x) { return (x ^ 0x1234) + INT_MIN; }


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x1234,%eax
mov    0x2ed2(%rip),%rcx
add    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
mov    %edi,%eax
xor    $0x1234,%eax
mov    0x2eda(%rip),%rcx
add    (%rcx),%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @test4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, 4660
%5 = load i32, i32* @INT_MIN
%6 = add nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @test4(i32 %0) {
%2 = xor i32 %0, 4660
%3 = load i32, i32* @INT_MIN
%4 = add nsw i32 %3, %2
ret i32 %4
}
void ff_hevc_put_hevc_bi_epel_h32_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_h32_10_sse4() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int set_standard_state_to_verbose(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(630, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<set_standard_state_to_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x276,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_standard_state_to_verbose>:
mov    $0x276,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @set_standard_state_to_verbose() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 630, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @set_standard_state_to_verbose() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 630, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char buffer[128] = {0};
  printf("insert ropchain: ");
  gets(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1050 <gets@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
xor    %eax,%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"insert ropchain: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
store i32 0, i32* %1
%3 = bitcast [128 x i8]* %2 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"insert ropchain: \00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ doTick();
void our_tick() { doTick(); }


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

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

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

LLVM IR (-O2):
define void @our_tick() {
%1 = tail call i32 (...) @doTick()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void jmp_reg32(unsigned int reg32) {
  put8(0xFF);
  put8(0xE0 + reg32);
}


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

x86 assembly (clang, -O2):
<jmp_reg32>:
push   %rbx
mov    %edi,%ebx
mov    $0xff,%edi
call   1030 <put8@plt>
add    $0xe0,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @jmp_reg32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 255)
%4 = load i32, i32* %2
%5 = add i32 224, %4
%6 = call i32 @put8(i32 %5)
ret void
}

LLVM IR (-O2):
define void @jmp_reg32(i32 %0) {
%2 = tail call i32 @put8(i32 255)
%3 = add i32 %0, 224
%4 = tail call i32 @put8(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main() {
  int i, j, k[3];
  j = 0;
  for (i = 0; i < 3; i++) {
    k[i] = j++;
  }
  for (i = 2; i >= 0; i--) {
    if (k[i] != i)
      abort();
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1168 <main+0x48>
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0x8(%rbp),%rax
mov    %ecx,-0x18(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
movl   $0x2,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11a4 <main+0x84>
movslq -0x8(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%eax
cmp    -0x8(%rbp),%eax
je     1191 <main+0x71>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <main+0x4f>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %2
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %12
store i32 %9, i32* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %5
17: ; preds = %5
store i32 2, i32* %2
br label %18
18: ; preds = %31, %17
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %34
21: ; preds = %18
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %2
%27 = icmp ne i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = call i32 (...) @abort()
unreachable
30: ; preds = %21
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, -1
store i32 %33, i32* %2
br label %18
34: ; preds = %18
%35 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_9Fint16_reg(short val) {
  return ((val) & (-0x9F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_9Fint16_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, -159
%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_9Fint16_reg(i16 signext %0) {
%2 = and i16 %0, -159
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
int waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sig_handler(int sig) {
  pid_t p;
  while ((p = waitpid(-1, NULL, WNOHANG)) <= 0)
    ;
  printf("\nExiting process pid = %d\n", p);
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jg     1153 <sig_handler+0x33>
jmp    112b <sig_handler+0xb>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rbx
mov    0x2ec0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <waitpid@plt>
test   %eax,%eax
jle    1130 <sig_handler+0x10>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@WNOHANG = global i32 0
@.str = [27 x i8] c"\0AExiting process pid = %d\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* null, i32 %5)
store i32 %6, i32* %3
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
@.str = [27 x i8] c"\0AExiting process pid = %d\0A\00"
define void @sig_handler(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load i32, i32* @WNOHANG
%4 = tail call i32 @waitpid(i32 -1, i32* null, i32 %3)
%5 = icmp slt i32 %4, 1
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bzero(unsigned char *, int);
scalar_t__ malloc(int);
unsigned char *create_bitmap(int size) {
  int n = (size / 8);
  if (size % 8 > 0)
    n++;
  unsigned char *m = (unsigned char *)malloc(n * sizeof(unsigned char));
  bzero(m, n * sizeof(unsigned char));
  return m;
}


x86 assembly (clang, -O0):
<create_bitmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jle    1156 <create_bitmap+0x36>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%esi
call   1040 <bzero@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_bitmap>:
push   %r14
push   %rbx
push   %rax
lea    0x7(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x3,%eax
xor    %ebx,%ebx
test   $0x80000007,%edi
setg   %bl
add    %eax,%ebx
mov    %ebx,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %ebx,%esi
call   1040 <bzero@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @create_bitmap(i32 %0) {
%2 = sdiv i32 %0, 8
%3 = and i32 %0, -2147483641
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
%6 = add nsw i32 %2, %5
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @bzero(i8* %8, i32 %6)
ret i8* %8
}
/* Variables and functions */
int write(int, char const *, size_t);
int nmcadec_write(int fd, const char *buf, size_t size) {
  return write(fd, buf, size);
}


x86 assembly (clang, -O0):
<nmcadec_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmcadec_write>:
jmp    1030 <write@plt>

LLVM IR (-O0):
define i32 @nmcadec_write(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @write(i32 %7, i8* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @nmcadec_write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint8_t luminance(uint8_t r, uint8_t g, uint8_t b) {
  return (uint8_t)(((uint32_t)r + r + r + b + g + g + g + g) >> 3);
}


x86 assembly (clang, -O0):
<luminance>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cltq
add    -0x8(%rbp),%rax
add    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
add    -0x10(%rbp),%rax
add    -0x10(%rbp),%rax
add    -0x10(%rbp),%rax
sar    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<luminance>:
movslq %edi,%rax
lea    (%rax,%rdi,2),%rax
add    %rdx,%rax
lea    (%rax,%rsi,4),%rax
sar    $0x3,%rax
ret

LLVM IR (-O0):
define i64 @luminance(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = sext i32 %8 to i64
%10 = load i64, i64* %4
%11 = add nsw i64 %9, %10
%12 = load i64, i64* %4
%13 = add nsw i64 %11, %12
%14 = load i64, i64* %6
%15 = add nsw i64 %13, %14
%16 = load i64, i64* %5
%17 = add nsw i64 %15, %16
%18 = load i64, i64* %5
%19 = add nsw i64 %17, %18
%20 = load i64, i64* %5
%21 = add nsw i64 %19, %20
%22 = load i64, i64* %5
%23 = add nsw i64 %21, %22
%24 = ashr i64 %23, 3
ret i64 %24
}

LLVM IR (-O2):
define i64 @luminance(i64 %0, i64 %1, i64 %2) {
%4 = shl i64 %0, 32
%5 = ashr exact i64 %4, 32
%6 = shl i64 %0, 1
%7 = add i64 %5, %6
%8 = add nsw i64 %7, %2
%9 = shl i64 %1, 2
%10 = add i64 %8, %9
%11 = ashr i64 %10, 3
ret i64 %11
}
/* Variables and functions */
double pow(int /*<<< orphan*/, int);
int /*<<< orphan*/ sin(double);
double fun(double x) { return (3.0 / 2) * pow(sin(x), 3); }


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rax
call   1030 <sin@plt>
mov    %eax,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
mulsd  0xec6(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @fun(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @sin(double %3)
%5 = call double @pow(i32 %4, i32 3)
%6 = fmul double 1.500000e+00, %5
ret double %6
}

LLVM IR (-O2):
define double @fun(double %0) {
%2 = tail call i32 @sin(double %0)
%3 = tail call double @pow(i32 %2, i32 3)
%4 = fmul double %3, 1.500000e+00
ret double %4
}
/* Variables and functions */
void *m_alloc(size_t, int, int /*<<< orphan*/ *, char *, int);
void *m_malloc_(size_t size, char *file, int lineno) {
  return m_alloc(size, -1, NULL, file, lineno);
}


x86 assembly (clang, -O0):
<m_malloc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0xffffffff,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <m_alloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_malloc_>:
mov    %edx,%r8d
mov    %rsi,%rcx
mov    $0xffffffff,%esi
xor    %edx,%edx
jmp    1030 <m_alloc@plt>

LLVM IR (-O0):
define i8* @m_malloc_(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @m_alloc(i64 %7, i32 -1, i32* null, i8* %8, i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @m_malloc_(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @m_alloc(i64 %0, i32 -1, i32* null, i8* %1, i32 %2)
ret i8* %4
}
void init_uart(void) {
  (*(volatile unsigned long *)(0x50000000 + 0x00)) = 3;
  (*(volatile unsigned long *)(0x50000000 + 0x04)) = 4;
  (*(volatile unsigned long *)(0x50000000 + 0x08)) = 0;
  (*(volatile unsigned long *)(0x50000000 + 0x0C)) = 0;
  (*(volatile unsigned long *)(0x50000000 + 0x28)) =
      ((50625000 / (115200 * 16)) - 1);
  (*(volatile unsigned long *)(0x56000000 + 0x70)) = 0xaaa;
  (*(volatile unsigned long *)(0x56000000 + 0x78)) = 0x7ff;
}


x86 assembly (clang, -O0):
<init_uart>:
push   %rbp
mov    %rsp,%rbp
mov    $0x50000000,%eax
movq   $0x3,(%rax)
mov    $0x50000004,%eax
movq   $0x4,(%rax)
mov    $0x50000008,%eax
movq   $0x0,(%rax)
mov    $0x5000000c,%eax
movq   $0x0,(%rax)
mov    $0x50000028,%eax
movq   $0x1a,(%rax)
mov    $0x56000070,%eax
movq   $0xaaa,(%rax)
mov    $0x56000078,%eax
movq   $0x7ff,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_uart>:
movq   $0x3,0x50000000
movq   $0x4,0x50000004
movq   $0x0,0x50000008
movq   $0x0,0x5000000c
movq   $0x1a,0x50000028
movq   $0xaaa,0x56000070
movq   $0x7ff,0x56000078
ret

LLVM IR (-O0):
define void @init_uart() {
store volatile i64 3, i64* inttoptr (i64 1342177280 to i64*)
store volatile i64 4, i64* inttoptr (i64 1342177284 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177288 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177292 to i64*)
store volatile i64 26, i64* inttoptr (i64 1342177320 to i64*)
store volatile i64 2730, i64* inttoptr (i64 1442840688 to i64*)
store volatile i64 2047, i64* inttoptr (i64 1442840696 to i64*)
ret void
}

LLVM IR (-O2):
define void @init_uart() {
store volatile i64 3, i64* inttoptr (i64 1342177280 to i64*)
store volatile i64 4, i64* inttoptr (i64 1342177284 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177288 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177292 to i64*)
store volatile i64 26, i64* inttoptr (i64 1342177320 to i64*)
store volatile i64 2730, i64* inttoptr (i64 1442840688 to i64*)
store volatile i64 2047, i64* inttoptr (i64 1442840696 to i64*)
ret void
}
unsigned getu32(const unsigned char *addr) {
  return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 |
         addr[0];
}


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

x86 assembly (clang, -O2):
<getu32>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @getu32(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl i64 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = or i64 %7, %11
%13 = shl i64 %12, 8
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = or i64 %13, %17
%19 = shl i64 %18, 8
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = zext i8 %22 to i64
%24 = or i64 %19, %23
%25 = trunc i64 %24 to i32
ret i32 %25
}

LLVM IR (-O2):
define i32 @getu32(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %4, 16
%9 = shl nuw nsw i32 %7, 8
%10 = or i32 %9, %8
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = or i32 %10, %13
%15 = shl nuw i32 %14, 8
%16 = load i8, i8* %0
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
main(void) {
  printf("RogerWu\nChina Hunan Zhangjiajie");
  getchar();
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"RogerWu\0AChina Hunan Zhangjiajie\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"RogerWu\0AChina Hunan Zhangjiajie\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int slen(char *s) {
  size_t rval;
  for (rval = 0; *s != 0; s++, rval++)
    ;
  return rval;
}


x86 assembly (clang, -O0):
<slen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1142 <slen+0x42>
jmp    1125 <slen+0x25>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <slen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<slen>:
cmpb   $0x0,(%rdi)
je     111c <slen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <slen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @slen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = trunc i64 %8 to i32
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 0, %1 ], [ %12, %11 ]
ret i32 %14
}
int check_prime(int num) {
  int i;
  for (i = 2; i <= num - 1; i++) {
    if (num % i == 0) {
      return 0;
    } else
      continue;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     114e <check_prime+0x4e>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113b <check_prime+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1155 <check_prime+0x55>
jmp    1140 <check_prime+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <check_prime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
void INT_Excep_CMTU0_CMT1(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_CMTU0_CMT1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
int main(int argc, char **argv) {
  int i = 0;
  for (i = 0; i < argc; ++i) {
    printf("arg%d = %s\n", i, argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1169 <main+0x59>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <main+0x37>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"arg%d = %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void WpeExpArrayDestroy(void *exp_array) {
  int *real_array;
  real_array = ((int *)exp_array) - 4;
  free(real_array);
}


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

x86 assembly (clang, -O2):
<WpeExpArrayDestroy>:
add    $0xfffffffffffffff0,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @WpeExpArrayDestroy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = getelementptr inbounds i32, i32* %5, i64 -4
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @free(i32* %7)
ret void
}

LLVM IR (-O2):
define void @WpeExpArrayDestroy(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -16
%3 = bitcast i8* %2 to i32*
%4 = tail call i32 @free(i32* %3)
ret void
}
unsigned char MSB(const unsigned short word) { return word >> 8; }


x86 assembly (clang, -O0):
<MSB>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MSB>:
mov    %edi,%eax
shr    $0x8,%eax
ret

LLVM IR (-O0):
define zeroext i8 @MSB(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @MSB(i16 zeroext %0) {
%2 = lshr i16 %0, 8
%3 = trunc i16 %2 to i8
ret i8 %3
}
/* Variables and functions */
char *ultoa(unsigned long, char *, int);
extern char *utoa(unsigned long value, char *string, int radix) {
  return ultoa(value, string, radix);
}


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

x86 assembly (clang, -O2):
<utoa>:
jmp    1030 <ultoa@plt>

LLVM IR (-O0):
define i8* @utoa(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @ultoa(i64 %7, i8* %8, i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @utoa(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @ultoa(i64 %0, i8* %1, i32 %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int exec_reset_error(int instanceId) {
  printf("Reset error\n");
  return -1;
}


x86 assembly (clang, -O0):
<exec_reset_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"Reset error\0A\00"
define i32 @exec_reset_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@str = [12 x i8] c"Reset error\00"
define i32 @exec_reset_error(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 -1
}
int test_imm_FCint16_mem(short *val) {
  return ((*val) & (-0xFC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_FCint16_mem>:
movzwl (%rdi),%eax
test   $0xff04,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_FCint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -252
%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_FCint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -252
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void f0(float b) {}


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

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

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

LLVM IR (-O2):
define void @f0(float %0) {
ret void
}
int fn5(int a, int b) {
  int tem1 = a ^ b;
  int tem2 = a | b;
  return tem1 ^ tem2;
}


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fn5(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = xor i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = or i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = xor i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn5(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ gtb_clear();
int /*<<< orphan*/ tt_free();
void uci_exit() {
  tt_free();
  gtb_clear();
  exit(0);
}


x86 assembly (clang, -O0):
<uci_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <tt_free@plt>
mov    $0x0,%al
call   1030 <gtb_clear@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<uci_exit>:
push   %rax
xor    %eax,%eax
call   1050 <tt_free@plt>
xor    %eax,%eax
call   1030 <gtb_clear@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @uci_exit() {
%1 = call i32 (...) @tt_free()
%2 = call i32 (...) @gtb_clear()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @uci_exit() {
%1 = tail call i32 (...) @tt_free()
%2 = tail call i32 (...) @gtb_clear()
%3 = tail call i32 @exit(i32 0)
unreachable
}