xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ readWord(int /*<<< orphan*/ *);
void skipWordArray(FILE *fyle, int length) {
  int i;
  for (i = 0; i < length; ++i) {
    readWord(fyle);
  }
}


x86 assembly (clang, -O0):
<skipWordArray>:
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    1149 <skipWordArray+0x39>
mov    -0x8(%rbp),%rdi
call   1030 <readWord@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <skipWordArray+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipWordArray>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    112d <skipWordArray+0x1d>
mov    %esi,%ebx
mov    %rdi,%r14
nopl   (%rax)
mov    %r14,%rdi
call   1030 <readWord@plt>
add    $0xffffffff,%ebx
jne    1120 <skipWordArray+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @skipWordArray(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 = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = call i32 @readWord(i32* %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @skipWordArray(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @readWord(i32* %0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
__attribute__((always_)) uint64_t
__checkint_uint64_div_unsigned_unsigned(uint64_t x, uint64_t y, int32_t *err) {
  return x / y;
}


x86 assembly (clang, -O0):
<__checkint_uint64_div_unsigned_unsigned>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__checkint_uint64_div_unsigned_unsigned>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @__checkint_uint64_div_unsigned_unsigned(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = sdiv i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @__checkint_uint64_div_unsigned_unsigned(i32 %0, i32 %1, i32* nocapture readnone %2) {
%4 = sdiv i32 %0, %1
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
void cast_signed_to_unsigned_Good() {
  char arr[10];
  int32_t x = 15;
  uint32_t y = (uint32_t)x;
  if (y < 10) {
    arr[y] = 0;
  }
}


x86 assembly (clang, -O0):
<cast_signed_to_unsigned_Good>:
push   %rbp
mov    %rsp,%rbp
movl   $0xf,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1124 <cast_signed_to_unsigned_Good+0x24>
movslq -0x14(%rbp),%rax
movb   $0x0,-0xa(%rbp,%rax,1)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @cast_signed_to_unsigned_Good() {
ret void
}
int of_regulator_match(struct device *dev, struct device_node *node,
                       struct of_regulator_match *matches,
                       unsigned int num_matches) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.device = type opaque
%struct.device_node = type opaque
%struct.of_regulator_match = type opaque
define i32 @of_regulator_match(%struct.device* %0, %struct.device_node* %1, %struct.of_regulator_match* %2, i32 %3) {
%5 = alloca %struct.device*
%6 = alloca %struct.device_node*
%7 = alloca %struct.of_regulator_match*
%8 = alloca i32
store %struct.device* %0, %struct.device** %5
store %struct.device_node* %1, %struct.device_node** %6
store %struct.of_regulator_match* %2, %struct.of_regulator_match** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.device = type opaque
%struct.device_node = type opaque
%struct.of_regulator_match = type opaque
define i32 @of_regulator_match(%struct.device* nocapture readnone %0, %struct.device_node* nocapture readnone %1, %struct.of_regulator_match* nocapture readnone %2, i32 %3) {
ret i32 0
}
void OCSP_ONEREQ_new(void) {}


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

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

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

LLVM IR (-O2):
define void @OCSP_ONEREQ_new() {
ret void
}
void SensorSetBrightness_Test(unsigned char val) {}


x86 assembly (clang, -O0):
<SensorSetBrightness_Test>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @SensorSetBrightness_Test(i8 zeroext %0) {
ret void
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
ssize_t imcd_packbits_encode_size(const ssize_t srcsize) {
  return srcsize + (srcsize + 127) / 128;
}


x86 assembly (clang, -O0):
<imcd_packbits_encode_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7f,%eax
mov    $0x80,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imcd_packbits_encode_size>:
lea    0x7f(%rdi),%ecx
lea    0xfe(%rdi),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x7,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @imcd_packbits_encode_size(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 127
%6 = sdiv i32 %5, 128
%7 = add nsw i32 %3, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @imcd_packbits_encode_size(i32 %0) {
%2 = add nsw i32 %0, 127
%3 = sdiv i32 %2, 128
%4 = add nsw i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int __builtin_mips_cabs_ult_s(float, float);
int test5(float a, float b) { return __builtin_mips_cabs_ult_s(a, b); }


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <__builtin_mips_cabs_ult_s@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
jmp    1030 <__builtin_mips_cabs_ult_s@plt>

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

LLVM IR (-O2):
define i32 @test5(float %0, float %1) {
%3 = tail call i32 @__builtin_mips_cabs_ult_s(float %0, float %1)
ret i32 %3
}
/* Variables and functions */
int _valid_index(int, int, int);
int _next(int curr, int cap) { return _valid_index(curr, 1, cap); }


x86 assembly (clang, -O0):
<_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x1,%esi
call   1030 <_valid_index@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_next>:
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <_valid_index@plt>

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

LLVM IR (-O2):
define i32 @_next(i32 %0, i32 %1) {
%3 = tail call i32 @_valid_index(i32 %0, i32 1, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ test50_TestProg_test__E();
void test50_TestProg_pollen__run__E() { test50_TestProg_test__E(); }


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

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

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

LLVM IR (-O2):
define void @test50_TestProg_pollen__run__E() {
%1 = tail call i32 (...) @test50_TestProg_test__E()
ret void
}
unsigned long wimaxll_le32_to_cpu(unsigned long le32) {
  unsigned long cpu;
  cpu = le32;
  return cpu;
}


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

x86 assembly (clang, -O2):
<wimaxll_le32_to_cpu>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @wimaxll_le32_to_cpu(i64 returned %0) {
ret i64 %0
}
void ff_hevc_put_hevc_uni_epel_hv6_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_hv6_10_sse4() {
ret void
}
/* Variables and functions */
scalar_t__ ldexp(double, int);
long double ldexpl(long double x, int exp) {
  return (long double)ldexp((double)x, exp);
}


x86 assembly (clang, -O0):
<ldexpl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %edi,-0x14(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x14(%rbp),%edi
call   1030 <ldexp@plt>
mov    %rax,-0x20(%rbp)
fildll -0x20(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexpl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <ldexp@plt>
mov    %rax,0x10(%rsp)
fildll 0x10(%rsp)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @ldexpl(x86_fp80 %0, i32 %1) {
%3 = alloca x86_fp80
%4 = alloca i32
store x86_fp80 %0, x86_fp80* %3
store i32 %1, i32* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = fptrunc x86_fp80 %5 to double
%7 = load i32, i32* %4
%8 = call i64 @ldexp(double %6, i32 %7)
%9 = sitofp i64 %8 to x86_fp80
ret x86_fp80 %9
}

LLVM IR (-O2):
define x86_fp80 @ldexpl(x86_fp80 %0, i32 %1) {
%3 = fptrunc x86_fp80 %0 to double
%4 = tail call i64 @ldexp(double %3, i32 %1)
%5 = sitofp i64 %4 to x86_fp80
ret x86_fp80 %5
}
/* Variables and functions */
scalar_t__ bar();
scalar_t__ foo();
void __attribute__((constructor)) init(void) { (void)(foo() - bar()); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = call i64 (...) @foo()
%2 = call i64 (...) @bar()
%3 = sub nsw i64 %1, %2
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = tail call i64 (...) @foo()
%2 = tail call i64 (...) @bar()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int cleanup_all() {
  endwin();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @cleanup_all() {
%1 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
define i32 @cleanup_all() {
%1 = tail call i32 (...) @endwin()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _usage(char *const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char, char const *);
int /*<<< orphan*/ stderr;
void _usage_invalid_opt_arg(int opt, const char *arg, char *const *argv) {
  fprintf(stderr, "Invalid value for option -%c: %s\n", (char)opt, arg);
  _usage(argv);
}


x86 assembly (clang, -O0):
<_usage_invalid_opt_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
lea    0xeb6(%rip),%rsi
movsbl %al,%edx
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <_usage@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage_invalid_opt_arg>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rcx
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
movsbl %dil,%edx
lea    0xec5(%rip),%rsi
mov    %eax,%edi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <_usage@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Invalid value for option -%c: %s\0A\00"
define void @_usage_invalid_opt_arg(i32 %0, i8* %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
%7 = load i32, i32* @stderr
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %5
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %9, i8* %10)
%12 = load i8**, i8*** %6
%13 = call i32 @_usage(i8** %12)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Invalid value for option -%c: %s\0A\00"
define void @_usage_invalid_opt_arg(i32 %0, i8* %1, i8** %2) {
%4 = load i32, i32* @stderr
%5 = trunc i32 %0 to i8
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %5, i8* %1)
%7 = tail call i32 @_usage(i8** %2)
ret void
}
int test_imm_6Eint32_reg(int val) { return ((val) & (0x6E << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_6Eint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x6e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Eint32_reg>:
test   $0x6e,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_6Eint32_reg(i32 %0) {
%2 = and i32 %0, 110
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double cbrt(double);
double pow(int, double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double cube;
  double putere;
  cube = cbrt(2.0);
  putere = pow(2, 0.33333);
  printf(" The cube root of 2 is %f\n", cube);
  printf(" 2 to the 1/3 power is %f", putere);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
call   1040 <cbrt@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x2,%edi
movsd  0xea2(%rip),%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movsd  0xec4(%rip),%xmm0
call   1040 <cbrt@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xeb9(%rip),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xeaa(%rip),%rdi
movsd  0x10(%rsp),%xmm0
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c" The cube root of 2 is %f\0A\00"
@.str.1 = [26 x i8] c" 2 to the 1/3 power is %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call double @cbrt(double 2.000000e+00)
store double %4, double* %2
%5 = call double @pow(i32 2, double 3.333300e-01)
store double %5, double* %3
%6 = load double, double* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %6)
%8 = load double, double* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c" The cube root of 2 is %f\0A\00"
@.str.1 = [26 x i8] c" 2 to the 1/3 power is %f\00"
define i32 @main() {
%1 = tail call double @cbrt(double 2.000000e+00)
%2 = tail call double @pow(i32 2, double 3.333300e-01)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), double %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double %2)
ret i32 0
}
int max(unsigned int a, unsigned int b) { return (((a) > (b)) ? (a) : (b)); }


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

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

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
__attribute__((always_)) int pm_request_idle(struct device *dev) { return -38; }


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define i32 @pm_request_idle(%struct.device* nocapture readnone %0) {
ret i32 -38
}
int gy(int i, int j) { return j == 0 ? i : gy(j, i % j); }


x86 assembly (clang, -O0):
<gy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1133 <gy+0x23>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <gy+0x37>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <gy@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gy>:
mov    %edi,%eax
test   %esi,%esi
je     111d <gy+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gy+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @gy(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
br label %15
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = srem i32 %11, %12
%14 = call i32 @gy(i32 %10, i32 %13)
br label %15
15: ; preds = %9, %7
%16 = phi i32 [ %8, %7 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @gy(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  i = 5;
  for (; i; i--) {
    printf("%d", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114d <main+0x3d>
mov    -0x8(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t bsd_umax(uint32_t a, uint32_t b) { return (a > b ? a : b); }


x86 assembly (clang, -O0):
<bsd_umax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <bsd_umax+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <bsd_umax+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsd_umax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @bsd_umax(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @bsd_umax(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int main() {
  int x, y;
  x = 1;
  y = 1;
  while (x >= 0) {
    x = 2 * x;
    y = 3 * y;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1138 <main+0x38>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
imul   $0x3,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O2):
short signed int f1(short signed int arg) { return arg; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i16 @f1(i16 returned signext %0) {
ret i16 %0
}
int _ADStranslateWrError(int rc, int nErr) {
  switch (rc) {
  case 0:
    return 0x1a;
  case -3:
  case -4:
    return 0x1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_ADStranslateWrError>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
add    $0x4,%eax
sub    $0x2,%eax
jb     113d <_ADStranslateWrError+0x3d>
jmp    1121 <_ADStranslateWrError+0x21>
mov    -0x10(%rbp),%eax
test   %eax,%eax
jne    1149 <_ADStranslateWrError+0x49>
jmp    1131 <_ADStranslateWrError+0x31>
movl   $0x1a,-0x4(%rbp)
jmp    1150 <_ADStranslateWrError+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1150 <_ADStranslateWrError+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ADStranslateWrError>:
add    $0x4,%edi
xor    %eax,%eax
cmp    $0x4,%edi
ja     1117 <_ADStranslateWrError+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table._ADStranslateWrError = [5 x i32] [i32 1, i32 1, i32 0, i32 0, i32 26]
define i32 @_ADStranslateWrError(i32 %0, i32 %1) {
%3 = add i32 %0, 4
%4 = icmp ult i32 %3, 5
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table._ADStranslateWrError, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int hammingDistance(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int dis;
  dis = hammingDistance(1, 4);
  printf("dis: %d\n", dis);
  return dis;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x4,%esi
call   1040 <hammingDistance@plt>
mov    %eax,%ebx
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"dis: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @hammingDistance(i32 1, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %1
}
/* Variables and functions */
int HexDigit(char const);
int HexByte(const char *hex) {
  int b = (HexDigit(hex[0]) << 4) + HexDigit(hex[1]);
  return b;
}


x86 assembly (clang, -O0):
<HexByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <HexDigit@plt>
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <HexDigit@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HexByte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <HexDigit@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <HexDigit@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @HexByte(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = call i32 @HexDigit(i8 signext %6)
%8 = shl i32 %7, 4
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = call i32 @HexDigit(i8 signext %11)
%13 = add nsw i32 %8, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @HexByte(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @HexDigit(i8 signext %2)
%4 = shl i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @HexDigit(i8 signext %6)
%8 = add nsw i32 %7, %4
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ usleep(int);
void os_usleep(int s, int u) {
  if (s == 0) {
    usleep(u);
  } else {
    sleep(s);
  }
}


x86 assembly (clang, -O0):
<os_usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1145 <os_usleep+0x25>
mov    -0x8(%rbp),%edi
call   1040 <usleep@plt>
jmp    114d <os_usleep+0x2d>
mov    -0x4(%rbp),%edi
call   1030 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_usleep>:
test   %edi,%edi
je     1129 <os_usleep+0x9>
jmp    1030 <sleep@plt>
mov    %esi,%edi
jmp    1040 <usleep@plt>

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

LLVM IR (-O2):
define void @os_usleep(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @usleep(i32 %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @sleep(i32 %0)
br label %8
8: ; preds = %6, %4
ret void
}
int foo(void (*q)(void)) {
  int r = q;
  if (r != 0)
    return 1;
  else
    return 2;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1125 <foo+0x25>
movl   $0x1,-0x4(%rbp)
jmp    112c <foo+0x2c>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x1,%edi
mov    $0x1,%eax
adc    $0x0,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(void ()* %0) {
%2 = ptrtoint void ()* %0 to i64
%3 = trunc i64 %2 to i32
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 2, i32 1
ret i32 %5
}
void sched_rt_rq_dequeue(struct rt_rq *rt_rq) {}


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

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

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

LLVM IR (-O2):
%struct.rt_rq = type opaque
define void @sched_rt_rq_dequeue(%struct.rt_rq* nocapture %0) {
ret void
}
int _abs(int r) {
  if (r < 0)
    return (r * -1);
  else
    return (r);
}


x86 assembly (clang, -O0):
<_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <_abs+0x1d>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1123 <_abs+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int main(void) {
#pragma acc parallel
  ;
}


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

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

LLVM IR (-O0):
define i32 @main() {
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int routine1(int n) {
  int i;
#pragma acc loop
  for (i = 0; i < n; i++)
    ;
  return n + 1;
}


x86 assembly (clang, -O0):
<routine1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112d <routine1+0x2d>
jmp    111f <routine1+0x1f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <routine1+0xe>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @routine1(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
void __ptr_cpy(void *a, void *b) { *(void **)a = *(void **)b; }


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

x86 assembly (clang, -O2):
<__ptr_cpy>:
mov    (%rsi),%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @__ptr_cpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i8**
store i8* %7, i8** %9
ret void
}

LLVM IR (-O2):
define void @__ptr_cpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %0 to i8**
store i8* %4, i8** %5
ret void
}
double mbar2stdatmo(double p_mbar) {
  double stdatmo;
  stdatmo = p_mbar / 1013.25;
  return (stdatmo);
}


x86 assembly (clang, -O0):
<mbar2stdatmo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @mbar2stdatmo(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fdiv double %4, 1.013250e+03
store double %5, double* %3
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @mbar2stdatmo(double %0) {
%2 = fdiv double %0, 1.013250e+03
ret double %2
}
int external(int n) { return n + 1; }


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

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

LLVM IR (-O0):
define i32 @external(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @external(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
int leftChild(int i) { return (i << 1) + 1; }


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

x86 assembly (clang, -O2):
<leftChild>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @leftChild(i32 %0) {
%2 = shl i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
extern unsigned int csum_fold(unsigned int sum) {
  while (sum >> 16)
    sum = (sum & 0xffff) + (sum >> 16);
  return ~sum;
}


x86 assembly (clang, -O0):
<csum_fold>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
cmp    $0x0,%eax
je     112e <csum_fold+0x2e>
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    -0x4(%rbp),%ecx
shr    $0x10,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <csum_fold+0x7>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_fold>:
mov    %edi,%eax
cmp    $0x10000,%edi
jb     1121 <csum_fold+0x21>
nopw   0x0(%rax,%rax,1)
mov    %eax,%ecx
shr    $0x10,%ecx
movzwl %ax,%eax
add    %ecx,%eax
cmp    $0xffff,%eax
ja     1110 <csum_fold+0x10>
not    %eax
ret

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

LLVM IR (-O2):
define i32 @csum_fold(i32 %0) {
%2 = icmp ult i32 %0, 65536
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = lshr i32 %4, 16
%6 = and i32 %4, 65535
%7 = add nuw nsw i32 %6, %5
%8 = icmp ult i32 %7, 65536
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ %0, %1 ], [ %7, %3 ]
%11 = xor i32 %10, -1
ret i32 %11
}
/* Variables and functions */
void *child_thread(void *data) {
  char *start = (char *)data;
  int i;
  for (i = 0; i < (100 * 1024); i++) {
    start[i * (4096)] = i;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<child_thread>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x19000,-0x14(%rbp)
jge    1147 <child_thread+0x47>
mov    -0x14(%rbp),%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0xc,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <child_thread+0x17>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_thread>:
add    $0x4000,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %al,-0x4000(%rdi)
lea    0x1(%rax),%ecx
mov    %cl,-0x3000(%rdi)
lea    0x2(%rax),%ecx
mov    %cl,-0x2000(%rdi)
lea    0x3(%rax),%ecx
mov    %cl,-0x1000(%rdi)
lea    0x4(%rax),%ecx
mov    %cl,(%rdi)
add    $0x5,%rax
add    $0x5000,%rdi
cmp    $0x19000,%rax
jne    1110 <child_thread+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @child_thread(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %23, %2 ]
%4 = trunc i64 %3 to i8
%5 = shl nuw nsw i64 %3, 12
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %4, i8* %6
%7 = add nuw nsw i64 %3, 1
%8 = trunc i64 %7 to i8
%9 = shl nuw nsw i64 %7, 12
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 %8, i8* %10
%11 = add nuw nsw i64 %3, 2
%12 = trunc i64 %11 to i8
%13 = shl nuw nsw i64 %11, 12
%14 = getelementptr inbounds i8, i8* %0, i64 %13
store i8 %12, i8* %14
%15 = add nuw nsw i64 %3, 3
%16 = trunc i64 %15 to i8
%17 = shl nuw nsw i64 %15, 12
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 %16, i8* %18
%19 = add nuw nsw i64 %3, 4
%20 = trunc i64 %19 to i8
%21 = shl nuw nsw i64 %19, 12
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 %20, i8* %22
%23 = add nuw nsw i64 %3, 5
%24 = icmp eq i64 %23, 102400
br i1 %24, label %25, label %2
25: ; preds = %2
ret i8* null
}
int BUK2() { return 0; }


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

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

LLVM IR (-O0):
define i32 @BUK2() {
ret i32 0
}

LLVM IR (-O2):
define i32 @BUK2() {
ret i32 0
}
__attribute__((no)) int zap() { return 0; }


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

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

LLVM IR (-O0):
define i32 @zap() {
ret i32 0
}

LLVM IR (-O2):
define i32 @zap() {
ret i32 0
}
const char *X509_get_default_cert_area(void) { return ("/etc/ssl"); }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"/etc/ssl\00"
define i8* @X509_get_default_cert_area() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"/etc/ssl\00"
define i8* @X509_get_default_cert_area() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
double read_U16Fixed16Number(char *p) {
  unsigned long o32;
  o32 = 16777216 * (unsigned long)((unsigned char *)p)[0] +
        65536 * (unsigned long)((unsigned char *)p)[1] +
        256 * (unsigned long)((unsigned char *)p)[2] +
        (unsigned long)((unsigned char *)p)[3];
  return (double)o32 / 65536.0;
}


x86 assembly (clang, -O0):
<read_U16Fixed16Number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x20,%rax
bswap  %rax
mov    %rax,-0x10(%rbp)
movaps 0xef0(%rip),%xmm1
movq   -0x10(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xeef(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb8(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_U16Fixed16Number>:
mov    (%rdi),%eax
shl    $0x20,%rax
bswap  %rax
cvtsi2sd %rax,%xmm0
mulsd  0xeea(%rip),%xmm0
ret

LLVM IR (-O0):
define double @read_U16Fixed16Number(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = mul i64 16777216, %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = mul i64 65536, %12
%14 = add i64 %8, %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = mul i64 256, %18
%20 = add i64 %14, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 3
%23 = load i8, i8* %22
%24 = zext i8 %23 to i64
%25 = add i64 %20, %24
store i64 %25, i64* %3
%26 = load i64, i64* %3
%27 = uitofp i64 %26 to double
%28 = fdiv double %27, 6.553600e+04
ret double %28
}

LLVM IR (-O2):
define double @read_U16Fixed16Number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = shl nuw nsw i64 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %7, 16
%9 = or i64 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = shl nuw nsw i64 %12, 8
%14 = or i64 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = or i64 %14, %17
%19 = uitofp i64 %18 to double
%20 = fmul double %19, 0x3EF0000000000000
ret double %20
}