xunge/DecIR huggingface dataset:
unsigned round_up_to_granularity(unsigned value, unsigned granularity) {
  unsigned tmp = value + granularity - 1;
  return tmp - (tmp % granularity);
}


x86 assembly (clang, -O0):
<round_up_to_granularity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up_to_granularity>:
lea    (%rdi,%rsi,1),%ecx
add    $0xffffffff,%ecx
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
sub    %edx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @round_up_to_granularity(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = urem i32 %4, %1
%6 = sub i32 %4, %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ rgph_u32_murmur32s_data32(float const *, size_t, uintptr_t);
uint32_t rgph_u32_murmur32s_f32a(const float *key, size_t len, uintptr_t seed) {
  return rgph_u32_murmur32s_data32(key, len, seed);
}


x86 assembly (clang, -O0):
<rgph_u32_murmur32s_f32a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <rgph_u32_murmur32s_data32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u32_murmur32s_f32a>:
jmp    1030 <rgph_u32_murmur32s_data32@plt>

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

LLVM IR (-O2):
define i32 @rgph_u32_murmur32s_f32a(float* %0, i64 %1, i64 %2) {
%4 = tail call i32 @rgph_u32_murmur32s_data32(float* %0, i64 %1, i64 %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __get_uint_dec(char const *);
int /*<<< orphan*/ __get_uint_hex(char const *);
uint64_t __get_uint(const char *s) {
  if (s[0] == '0' && s[1] == 'x')
    return __get_uint_hex(s + 2);
  return __get_uint_dec(s);
}


x86 assembly (clang, -O0):
<__get_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1162 <__get_uint+0x42>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    1162 <__get_uint+0x42>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
call   1030 <__get_uint_hex@plt>
mov    %eax,-0x4(%rbp)
jmp    116e <__get_uint+0x4e>
mov    -0x10(%rbp),%rdi
call   1040 <__get_uint_dec@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__get_uint>:
cmpb   $0x30,(%rdi)
jne    1134 <__get_uint+0x14>
cmpb   $0x78,0x1(%rdi)
jne    1134 <__get_uint+0x14>
add    $0x2,%rdi
jmp    1030 <__get_uint_hex@plt>
jmp    1040 <__get_uint_dec@plt>

LLVM IR (-O0):
define i32 @__get_uint(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 48
br i1 %8, label %9, label %19
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 120
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = call i32 @__get_uint_hex(i8* %17)
store i32 %18, i32* %2
br label %22
19: ; preds = %9, %1
%20 = load i8*, i8** %3
%21 = call i32 @__get_uint_dec(i8* %20)
store i32 %21, i32* %2
br label %22
22: ; preds = %19, %15
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @__get_uint(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 48
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 120
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = tail call i32 @__get_uint_hex(i8* %9)
br label %13
11: ; preds = %4, %1
%12 = tail call i32 @__get_uint_dec(i8* %0)
br label %13
13: ; preds = %11, %8
%14 = phi i32 [ %10, %8 ], [ %12, %11 ]
ret i32 %14
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t minipack_unpack_fixstr(void *ptr, size_t *sz) {
  *sz = 1;
  return *((uint8_t *)ptr) & 0x1F;
}


x86 assembly (clang, -O0):
<minipack_unpack_fixstr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x1,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_unpack_fixstr>:
movq   $0x1,(%rsi)
mov    (%rdi),%eax
and    $0x1f,%eax
ret

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

LLVM IR (-O2):
define i32 @minipack_unpack_fixstr(i8* nocapture %0, i64* nocapture writeonly %1) {
store i64 1, i64* %1
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = and i32 %4, 31
ret i32 %5
}
int cval(char c) {
  if (c >= 'a')
    return c - 'a' + 0x0a;
  if (c >= 'A')
    return c - 'A' + 0x0a;
  return c - '0';
}


x86 assembly (clang, -O0):
<cval>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <cval+0x29>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <cval+0x52>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1148 <cval+0x48>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <cval+0x52>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cval>:
cmp    $0x41,%dil
mov    $0xffffffc9,%eax
mov    $0xffffffd0,%ecx
cmovge %eax,%ecx
cmp    $0x61,%dil
mov    $0xffffffa9,%eax
cmovl  %ecx,%eax
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cval(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = icmp sgt i8 %0, 96
%4 = icmp sgt i8 %0, 64
%5 = select i1 %4, i32 -55, i32 -48
%6 = select i1 %3, i32 -87, i32 %5
%7 = add nsw i32 %6, %2
ret i32 %7
}
int main(int argc, char *argv[]) {
#pragma starpu initialize
  int x[123] __attribute__((unused));
  static char z[345] __attribute__((unused));
#pragma starpu register x
#pragma starpu release
#pragma starpu release 123
#pragma starpu release does_not_exit
#pragma starpu release argc
#pragma starpu release y
#pragma starpu release x
#pragma starpu release x z
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
add    $0x180,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@main.z = internal global [345 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [123 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
ret i32 1
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 1
}
int test_imm_14uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x14 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_14uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 85899345920
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_1Bint64_lowword_reg(long long val) {
  return ((val) & (0x1B << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Bint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 27
%5 = icmp ne i64 %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_1Bint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 27
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void aws_dynamo_dump_batch_write_item_response(
    struct aws_dynamo_batch_write_item_response *r) {}


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

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

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

LLVM IR (-O2):
%struct.aws_dynamo_batch_write_item_response = type opaque
define void @aws_dynamo_dump_batch_write_item_response(%struct.aws_dynamo_batch_write_item_response* nocapture %0) {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  fprintf(stdout, "This file was edited on GitHub, compiled via emscripten on "
                  "TravisCI and deployed to bintray :)\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [96 x i8] c"This file was edited on GitHub, compiled via emscripten on TravisCI and deployed to bintray :)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @stdout
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [96 x i8] c"This file was edited on GitHub, compiled via emscripten on TravisCI and deployed to bintray :)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Variables and functions */
unsigned short get_hex_byte();
unsigned short get_hex_address() {
  unsigned short w;
  w = get_hex_byte();
  return (w << 8) + get_hex_byte();
}


x86 assembly (clang, -O0):
<get_hex_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_hex_byte@plt>
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_hex_byte@plt>
mov    %ax,%cx
mov    -0x8(%rbp),%eax
movzwl %cx,%ecx
add    %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hex_address>:
push   %rbx
xor    %eax,%eax
call   1030 <get_hex_byte@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
xor    %eax,%eax
call   1030 <get_hex_byte@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @get_hex_address() {
%1 = alloca i16
%2 = call zeroext i16 (...) @get_hex_byte()
store i16 %2, i16* %1
%3 = load i16, i16* %1
%4 = zext i16 %3 to i32
%5 = shl i32 %4, 8
%6 = call zeroext i16 (...) @get_hex_byte()
%7 = zext i16 %6 to i32
%8 = add nsw i32 %5, %7
%9 = trunc i32 %8 to i16
ret i16 %9
}

LLVM IR (-O2):
define zeroext i16 @get_hex_address() {
%1 = tail call zeroext i16 (...) @get_hex_byte()
%2 = shl i16 %1, 8
%3 = tail call zeroext i16 (...) @get_hex_byte()
%4 = add i16 %2, %3
ret i16 %4
}
/* Variables and functions */
void fact(size_t num) {
  for (size_t i = 2; i < num; ++i) {
    if (num % i == 0) {
      return;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<fact>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    114f <fact+0x4f>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
cmp    $0x0,%rdx
jne    1139 <fact+0x39>
jmp    1154 <fact+0x54>
jmp    113e <fact+0x3e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <fact+0x10>
jmp    1154 <fact+0x54>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @fact(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 2, i64* %3
br label %4
4: ; preds = %15, %1
%5 = load i64, i64* %3
%6 = load i64, i64* %2
%7 = icmp ult i64 %5, %6
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i64, i64* %2
%10 = load i64, i64* %3
%11 = urem i64 %9, %10
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
br label %19
14: ; preds = %8
br label %15
15: ; preds = %14
%16 = load i64, i64* %3
%17 = add i64 %16, 1
store i64 %17, i64* %3
br label %4
18: ; preds = %4
br label %19
19: ; preds = %18, %13
ret void
}

LLVM IR (-O2):
define void @fact(i64 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
void dump_alpha(double alpha) {
  printf("alpha = ");
  printf("%g", alpha);
  printf("\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<dump_alpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_alpha>:
push   %rax
movsd  %xmm0,(%rsp)
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"alpha = \00"
@.str.1 = [3 x i8] c"%g\00"
@.str.2 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define void @dump_alpha(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = load double, double* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"alpha = \00"
@.str.1 = [3 x i8] c"%g\00"
@stdout = global i32 0
define void @dump_alpha(double %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %0)
%4 = tail call i32 @putchar(i32 10)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Variables and functions */
float scalblnf(float, long);
float test8f(float x, long exp) { return scalblnf(x, exp); }


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

x86 assembly (clang, -O2):
<test8f>:
jmp    1030 <scalblnf@plt>

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

LLVM IR (-O2):
define float @test8f(float %0, i64 %1) {
%3 = tail call float @scalblnf(float %0, i64 %1)
ret float %3
}
void up_connect_to_server(char *server) {}


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

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

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

LLVM IR (-O2):
define void @up_connect_to_server(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int n1, n2, n3;
  printf("Enter a three-digit number: ");
  scanf("%1d%1d%1d", &n1, &n2, &n3);
  printf("The reversal is: %d%d%d\n", n3, n2, n1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Enter a three-digit number: \00"
@.str.1 = [10 x i8] c"%1d%1d%1d\00"
@.str.2 = [25 x i8] c"The reversal is: %d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter a three-digit number: \00"
@.str.1 = [10 x i8] c"%1d%1d%1d\00"
@.str.2 = [25 x i8] c"The reversal is: %d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
ret i32 0
}
/* Variables and functions */
int func_six(int);
int func_five(int x) { return func_six(x + 5); }


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

x86 assembly (clang, -O2):
<func_five>:
add    $0x5,%edi
jmp    1030 <func_six@plt>

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

LLVM IR (-O2):
define i32 @func_five(i32 %0) {
%2 = add nsw i32 %0, 5
%3 = tail call i32 @func_six(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ wchar_t;
struct buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ buffer_append(struct buffer *, int /*<<< orphan*/);
void buffer_appendAll(struct buffer *b, const wchar_t *s) {
  while (*s)
    buffer_append(b, *s++);
}


x86 assembly (clang, -O0):
<buffer_appendAll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1150 <buffer_appendAll+0x40>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
call   1030 <buffer_append@plt>
jmp    1120 <buffer_appendAll+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_appendAll>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1144 <buffer_appendAll+0x34>
mov    %rdi,%r14
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <buffer_append@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <buffer_appendAll+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
define void @buffer_appendAll(%struct.buffer* %0, i64* %1) {
%3 = alloca %struct.buffer*
%4 = alloca i64*
store %struct.buffer* %0, %struct.buffer** %3
store i64* %1, i64** %4
br label %5
5: ; preds = %9, %2
%6 = load i64*, i64** %4
%7 = load i64, i64* %6
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load %struct.buffer*, %struct.buffer** %3
%11 = load i64*, i64** %4
%12 = getelementptr inbounds i64, i64* %11, i32 1
store i64* %12, i64** %4
%13 = load i64, i64* %11
%14 = trunc i64 %13 to i32
%15 = call i32 @buffer_append(%struct.buffer* %10, i32 %14)
br label %5
16: ; preds = %5
ret void
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define void @buffer_appendAll(%struct.buffer* %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = icmp eq i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %11, %5 ], [ %3, %2 ]
%7 = phi i64* [ %8, %5 ], [ %1, %2 ]
%8 = getelementptr inbounds i64, i64* %7, i64 1
%9 = trunc i64 %6 to i32
%10 = tail call i32 @buffer_append(%struct.buffer* %0, i32 %9)
%11 = load i64, i64* %8
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ g_utf8_get_char(char const *);
uint32_t stringprep_utf8_to_unichar(const char *p) {
  return g_utf8_get_char(p);
}


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

x86 assembly (clang, -O2):
<stringprep_utf8_to_unichar>:
jmp    1030 <g_utf8_get_char@plt>

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

LLVM IR (-O2):
define i32 @stringprep_utf8_to_unichar(i8* %0) {
%2 = tail call i32 @g_utf8_get_char(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
volatile uint8_t *port_to_pin_reg(volatile uint8_t *port_reg) {
  return port_reg - 0x02;
}


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

x86 assembly (clang, -O2):
<port_to_pin_reg>:
lea    -0x8(%rdi),%rax
ret

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

LLVM IR (-O2):
define i32* @port_to_pin_reg(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 -2
ret i32* %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long foreground;
};
typedef TYPE_1__ XGCValues;

/* Variables and functions */
void set_XGCValues_foreground(void *_p, unsigned long _v) {
  ((XGCValues *)_p)->foreground = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XGCValues_foreground(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XGCValues_foreground(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
double jcent2jd(double t) { return t * 36525.0 + 2451545.0; }


x86 assembly (clang, -O0):
<jcent2jd>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee6(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<jcent2jd>:
mulsd  0xef8(%rip),%xmm0
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @jcent2jd(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fmuladd.f64(double %3, double 3.652500e+04, double 0x4142B42C80000000)
ret double %4
}

LLVM IR (-O2):
define double @jcent2jd(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 3.652500e+04, double 0x4142B42C80000000)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "locale"
        " [-a | -m]\n      "
        "locale"
        " [-ck]\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Usage: locale [-a | -m]\0A locale [-ck]\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [44 x i8] c"Usage: locale [-a | -m]\0A locale [-ck]\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
/* Type definitions */
struct stringarray {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct stringarray *);
int /*<<< orphan*/ stringarray_cleanup(struct stringarray *);
void stringarray_destroy(struct stringarray *a) {
  stringarray_cleanup(a);
  free(a);
}


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

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

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

LLVM IR (-O2):
%struct.stringarray = type { i32 }
define void @stringarray_destroy(%struct.stringarray* %0) {
%2 = tail call i32 @stringarray_cleanup(%struct.stringarray* %0)
%3 = tail call i32 @free(%struct.stringarray* %0)
ret void
}
int quantum_inverse_mod(int n, int c) {
  int i;
  for (i = 1; (i * c) % n != 1; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<quantum_inverse_mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
cmp    $0x1,%edx
je     1138 <quantum_inverse_mod+0x38>
jmp    112a <quantum_inverse_mod+0x2a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <quantum_inverse_mod+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quantum_inverse_mod>:
xor    %r8d,%r8d
mov    %esi,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%eax
cltd
idiv   %edi
add    $0x1,%r8d
add    %esi,%ecx
cmp    $0x1,%edx
jne    1110 <quantum_inverse_mod+0x10>
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @quantum_inverse_mod(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 1, %2 ], [ %8, %3 ]
%5 = mul nsw i32 %4, %1
%6 = srem i32 %5, %0
%7 = icmp eq i32 %6, 1
%8 = add nuw nsw i32 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
ret i32 %4
}
int old_fun(size)
double size;
{ return old_fun(2 + size); }


x86 assembly (clang, -O0):
<old_fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <old_fun@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<old_fun>:
jmp    1100 <old_fun>

LLVM IR (-O0):
define i32 @old_fun(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double 2.000000e+00, %3
%5 = call i32 @old_fun(double %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @old_fun(double %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hola Mundo\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"Hola Mundo\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int finite(double const);
int gsl_finite(const double x) { return finite(x); }


x86 assembly (clang, -O0):
<gsl_finite>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xefb(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xedf(%rip),%xmm1
ucomisd %xmm1,%xmm0
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsl_finite>:
andpd  0xef8(%rip),%xmm0
xor    %eax,%eax
ucomisd 0xefe(%rip),%xmm0
setne  %al
ret

LLVM IR (-O0):
define i32 @gsl_finite(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
%5 = fcmp one double %4, 0x7FF0000000000000
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @gsl_finite(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp one double %2, 0x7FF0000000000000
%4 = zext i1 %3 to i32
ret i32 %4
}
int main() {
  int i;
  signed char result = 0;
  for (i = 0; i != 8000; ++i) {
    int tem = result;
    tem = tem + 2;
    result = tem;
  }
  if (__builtin_abs((int)(signed char)((unsigned char)result + 128)) != 0)
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f40,-0x8(%rbp)
je     115b <main+0x4b>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112a <main+0x1a>
movzbl -0x9(%rbp),%eax
add    $0x80,%eax
movsbl %al,%eax
xor    %ecx,%ecx
sub    %eax,%ecx
cmp    $0x0,%eax
cmovl  %ecx,%eax
cmp    $0x0,%eax
je     117f <main+0x6f>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
store i8 0, i8* %3
store i32 0, i32* %2
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 8000
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 2
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = trunc i32 %13 to i8
store i8 %14, i8* %3
br label %15
15: ; preds = %8
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %5
18: ; preds = %5
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
%21 = add nsw i32 %20, 128
%22 = trunc i32 %21 to i8
%23 = sext i8 %22 to i32
%24 = sub nsw i32 0, %23
%25 = icmp slt i32 %23, 0
%26 = select i1 %25, i32 %24, i32 %23
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %18
unreachable
29: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int clip_max(int v, int max) { return (v > max) ? max : v; }


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

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

LLVM IR (-O0):
define i32 @clip_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 sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
br label %12
10: ; preds = %2
%11 = load i32, i32* %3
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @clip_max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(int);
int *mallocInt(int a) {
  int *newInt = (int *)malloc(sizeof(int));
  *newInt = a;
  return newInt;
}


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

x86 assembly (clang, -O2):
<mallocInt>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %ebx,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i32* @mallocInt(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32, i32* %2
%7 = load i32*, i32** %3
store i32 %6, i32* %7
%8 = load i32*, i32** %3
ret i32* %8
}

LLVM IR (-O2):
define i32* @mallocInt(i32 %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32 %0, i32* %3
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void return_nothing(char thestring[]) {
  printf("I return NOTHING, %s!\n", thestring);
}


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

x86 assembly (clang, -O2):
<return_nothing>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"I return NOTHING, %s!\0A\00"
define void @return_nothing(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"I return NOTHING, %s!\0A\00"
define void @return_nothing(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *, char *);
char *yyBEGIN(char *);
int /*<<< orphan*/ yyEND(char const *);
void s_segment(int s) {
  do {
    const char *yytag = yyBEGIN("LI");
    ;
    print("segment %s", &"text\0bss\0.data\0lit\0.sym\0."[5 * s - 5]);
    yyEND(yytag);
  } while (0);
}


x86 assembly (clang, -O0):
<s_segment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1050 <yyBEGIN@plt>
mov    %rax,-0x10(%rbp)
imul   $0x5,-0x4(%rbp),%eax
sub    $0x5,%eax
cltq
lea    0xeb3(%rip),%rsi
add    %rax,%rsi
lea    0xe9e(%rip),%rdi
call   1040 <print@plt>
mov    -0x10(%rbp),%rdi
call   1030 <yyEND@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_segment>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xec3(%rip),%rdi
call   1050 <yyBEGIN@plt>
mov    %rax,%r14
lea    (%rbx,%rbx,4),%eax
cltq
lea    0xebd(%rip),%rcx
lea    (%rax,%rcx,1),%rsi
add    $0xfffffffffffffffb,%rsi
lea    0xea3(%rip),%rdi
call   1040 <print@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <yyEND@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"LI\00"
@.str.1 = [11 x i8] c"segment %s\00"
@.str.2 = [26 x i8] c"text\00bss\00.data\00lit\00.sym\00.\00"
define void @s_segment(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
br label %4
4: ; preds = %1
%5 = call i8* @yyBEGIN(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
%6 = load i32, i32* %2
%7 = mul nsw i32 5, %6
%8 = sub nsw i32 %7, 5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [26 x i8], [26 x i8]* @.str.2, i64 0, i64 %9
%11 = call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @yyEND(i8* %12)
br label %14
14: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"LI\00"
@.str.1 = [11 x i8] c"segment %s\00"
@.str.2 = [26 x i8] c"text\00bss\00.data\00lit\00.sym\00.\00"
define void @s_segment(i32 %0) {
%2 = tail call i8* @yyBEGIN(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = mul nsw i32 %0, 5
%4 = add nsw i32 %3, -5
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [26 x i8], [26 x i8]* @.str.2, i64 0, i64 %5
%7 = tail call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = tail call i32 @yyEND(i8* %2)
ret void
}
__attribute__((no, noclone)) int m1(int A, int B) {
  volatile int C = A & B;
  volatile int D = A ^ B;
  return C ^ D;
}


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

x86 assembly (clang, -O2):
<m1>:
mov    %esi,%eax
and    %edi,%eax
mov    %eax,-0x4(%rsp)
xor    %edi,%esi
mov    %esi,-0x8(%rsp)
mov    -0x4(%rsp),%eax
xor    -0x8(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @m1(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 = and i32 %7, %8
store volatile i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = xor i32 %10, %11
store volatile i32 %12, i32* %6
%13 = load volatile i32, i32* %5
%14 = load volatile i32, i32* %6
%15 = xor i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @m1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = and i32 %1, %0
store volatile i32 %6, i32* %3
%7 = bitcast i32* %4 to i8*
%8 = xor i32 %1, %0
store volatile i32 %8, i32* %4
%9 = load volatile i32, i32* %3
%10 = load volatile i32, i32* %4
%11 = xor i32 %10, %9
ret i32 %11
}
/* Variables and functions */
void *CALLOC(int, int);
int /*<<< orphan*/ ERROR(char *);
void *memalloc(int numel, int dtype) {
  int datasize;
  switch (dtype) {
  case 6:
    datasize = sizeof(double);
    break;
  case 7:
    datasize = sizeof(float);
    break;
  case 12:
    datasize = sizeof(int);
    break;
  case 3:
    datasize = sizeof(char);
    break;
  otherwise:
    ERROR("Unsupported datatype");
  }
  return CALLOC(datasize, numel);
}


x86 assembly (clang, -O0):
<memalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x9,%eax
ja     1172 <memalloc+0x62>
mov    -0x18(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x8,-0xc(%rbp)
jmp    1172 <memalloc+0x62>
movl   $0x4,-0xc(%rbp)
jmp    1172 <memalloc+0x62>
movl   $0x4,-0xc(%rbp)
jmp    1172 <memalloc+0x62>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <CALLOC@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memalloc>:
mov    %edi,%eax
cmp    $0x3,%esi
je     1132 <memalloc+0x22>
cmp    $0xc,%esi
je     1126 <memalloc+0x16>
mov    $0x8,%edi
cmp    $0x7,%esi
jne    1137 <memalloc+0x27>
mov    $0x4,%edi
mov    %eax,%esi
jmp    1030 <CALLOC@plt>
mov    $0x1,%edi
mov    %eax,%esi
jmp    1030 <CALLOC@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Unsupported datatype\00"
define i8* @memalloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
switch i32 %6, label %13 [
i32 6, label %7
i32 7, label %8
i32 12, label %9
i32 3, label %10
]
7: ; preds = %2
store i32 8, i32* %5
br label %13
8: ; preds = %2
store i32 4, i32* %5
br label %13
9: ; preds = %2
store i32 4, i32* %5
br label %13
10: ; preds = %2
store i32 1, i32* %5
br label %13
11: ; No predecessors!
%12 = call i32 @ERROR(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2, %10, %9, %8, %7
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = call i8* @CALLOC(i32 %14, i32 %15)
ret i8* %16
}

LLVM IR (-O2):
define i8* @memalloc(i32 %0, i32 %1) {
switch i32 %1, label %6 [
i32 3, label %5
i32 7, label %3
i32 12, label %4
]
3: ; preds = %2
br label %6
4: ; preds = %2
br label %6
5: ; preds = %2
br label %6
6: ; preds = %2, %5, %4, %3
%7 = phi i32 [ 1, %5 ], [ 4, %4 ], [ 4, %3 ], [ 8, %2 ]
%8 = tail call i8* @CALLOC(i32 %7, i32 %0)
ret i8* %8
}
/* Variables and functions */
int pointer_array(int *numbers[], size_t n) {
  if (n < 2)
    return 0;
  int *first = numbers[0];
  *first = 10;
  *(numbers[1]) = 5;
  return *first;
}


x86 assembly (clang, -O0):
<pointer_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x2,-0x18(%rbp)
jae    1123 <pointer_array+0x23>
movl   $0x0,-0x4(%rbp)
jmp    114f <pointer_array+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x5,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointer_array>:
xor    %eax,%eax
cmp    $0x2,%rsi
jb     111d <pointer_array+0x1d>
mov    (%rdi),%rax
movl   $0xa,(%rax)
mov    0x8(%rdi),%rcx
movl   $0x5,(%rcx)
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
define i32 @pointer_array(i32** nocapture %0, i64 %1) {
%3 = icmp ult i64 %1, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32*, i32** %0
store i32 10, i32* %5
%6 = getelementptr inbounds i32*, i32** %0, i64 1
%7 = load i32*, i32** %6
store i32 5, i32* %7
%8 = load i32, i32* %5
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ %8, %4 ], [ 0, %2 ]
ret i32 %10
}