xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ rax;

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
bool cpuid_perf_global_ctrl_EN_PMC(void) {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 10;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  if ((((uint64_t)(rax) &
        ((((uint64_t)1 << (((7)) - ((0)) + 1)) - 1) << ((0)))) >>
       (0)) > 0) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<cpuid_perf_global_ctrl_EN_PMC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x18(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
sar    $0x0,%eax
cmp    $0x0,%eax
jle    1157 <cpuid_perf_global_ctrl_EN_PMC+0x47>
movl   $0x1,-0x4(%rbp)
jmp    115e <cpuid_perf_global_ctrl_EN_PMC+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_perf_global_ctrl_EN_PMC>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0xa,%edi
call   1030 <cpuid@plt>
xor    %eax,%eax
cmpb   $0x0,0x8(%rsp)
setne  %al
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @cpuid_perf_global_ctrl_EN_PMC() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 10, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = and i32 %10, 255
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void halt(char *msg) {
  printf("%s, machine halted.\n", msg);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<halt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <halt+0x1c>

x86 assembly (clang, -O2):
<halt>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
jmp    1120 <halt+0x10>

LLVM IR (-O0):
@.str = [21 x i8] c"%s, machine halted.\0A\00"
define void @halt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %5
5: ; preds = %1, %5
br label %5
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s, machine halted.\0A\00"
define void @halt(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %3
3: ; preds = %1, %3
br label %3
}
/* Type definitions */
struct nouveau_channel {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ OUT_RING(struct nouveau_channel *, int);
void BEGIN_NVC0(struct nouveau_channel *chan, int op, int subc, int mthd,
                int size) {
  OUT_RING(chan, (op << 28) | (size << 16) | (subc << 13) | (mthd >> 2));
}


x86 assembly (clang, -O0):
<BEGIN_NVC0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x1c,%esi
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
or     %eax,%esi
mov    -0x10(%rbp),%eax
shl    $0xd,%eax
or     %eax,%esi
mov    -0x14(%rbp),%eax
sar    $0x2,%eax
or     %eax,%esi
call   1030 <OUT_RING@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BEGIN_NVC0>:
shl    $0x1c,%esi
shl    $0x10,%r8d
shl    $0xd,%edx
or     %edx,%esi
sar    $0x2,%ecx
or     %r8d,%ecx
or     %ecx,%esi
jmp    1030 <OUT_RING@plt>

LLVM IR (-O0):
%struct.nouveau_channel = type { i32 }
define void @BEGIN_NVC0(%struct.nouveau_channel* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.nouveau_channel*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.nouveau_channel* %0, %struct.nouveau_channel** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.nouveau_channel*, %struct.nouveau_channel** %6
%12 = load i32, i32* %7
%13 = shl i32 %12, 28
%14 = load i32, i32* %10
%15 = shl i32 %14, 16
%16 = or i32 %13, %15
%17 = load i32, i32* %8
%18 = shl i32 %17, 13
%19 = or i32 %16, %18
%20 = load i32, i32* %9
%21 = ashr i32 %20, 2
%22 = or i32 %19, %21
%23 = call i32 @OUT_RING(%struct.nouveau_channel* %11, i32 %22)
ret void
}

LLVM IR (-O2):
%struct.nouveau_channel = type { i32 }
define void @BEGIN_NVC0(%struct.nouveau_channel* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = shl i32 %1, 28
%7 = shl i32 %4, 16
%8 = shl i32 %2, 13
%9 = ashr i32 %3, 2
%10 = or i32 %8, %6
%11 = or i32 %10, %9
%12 = or i32 %11, %7
%13 = tail call i32 @OUT_RING(%struct.nouveau_channel* %0, i32 %12)
ret void
}
void sighandler(int sig) { ; }


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

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

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

LLVM IR (-O2):
define void @sighandler(i32 %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

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


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

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

LLVM IR (-O0):
define i64 @max_i32(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 @max_i32(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void g_node_find_child() {}


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

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

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

LLVM IR (-O2):
define void @g_node_find_child() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_handle_connect();
int main(void) {
  test_handle_connect();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_handle_connect()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_handle_connect()
ret i32 0
}
/* Variables and functions */
unsigned int __GNU_MP_VERSION;
unsigned int __GNU_MP_VERSION_MINOR;
unsigned int __GNU_MP_VERSION_PATCHLEVEL;
int /*<<< orphan*/ printf(char *, unsigned int const, unsigned int const,
                          unsigned int const);
int main(void) {
  const unsigned gmp_version = __GNU_MP_VERSION;
  const unsigned gmp_version_minor = __GNU_MP_VERSION_MINOR;
  const unsigned gmp_version_patchlevel = __GNU_MP_VERSION_PATCHLEVEL;
  printf("%d.%d.%d", gmp_version, gmp_version_minor, gmp_version_patchlevel);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
mov    0x2eae(%rip),%rax
mov    (%rax),%ecx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__GNU_MP_VERSION = global i32 0
@__GNU_MP_VERSION_MINOR = global i32 0
@__GNU_MP_VERSION_PATCHLEVEL = global i32 0
@.str = [9 x i8] c"%d.%d.%d\00"
define i32 @main() {
%1 = load i32, i32* @__GNU_MP_VERSION
%2 = load i32, i32* @__GNU_MP_VERSION_MINOR
%3 = load i32, i32* @__GNU_MP_VERSION_PATCHLEVEL
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
unsigned long _mm_extract_epi16(int /*<<< orphan*/, int);
unsigned long test_epi16(__m128i x) { return _mm_extract_epi16(x, 3); }


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

x86 assembly (clang, -O2):
<test_epi16>:
mov    $0x3,%esi
jmp    1030 <_mm_extract_epi16@plt>

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

LLVM IR (-O2):
define i64 @test_epi16(i32 %0) {
%2 = tail call i64 @_mm_extract_epi16(i32 %0, i32 3)
ret i64 %2
}
/* Variables and functions */
scalar_t__ bc_assert_cond(char *, int, char *, int);
int test_func_1(void *user_data) {
  if (bc_assert_cond("("
                     "1 == 1"
                     ")",
                     (1 == 1),
                     "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/avalentino/epr-api/"
                     "refs/heads/master/bccunit/src/bccunit_test.c",
                     5) != 0) {
    return 1;
  } else {
  };
  return (0);
}


x86 assembly (clang, -O0):
<test_func_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x1,%esi
lea    0xeda(%rip),%rdx
mov    $0x5,%ecx
call   1030 <bc_assert_cond@plt>
cmp    $0x0,%rax
je     114f <test_func_1+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    115b <test_func_1+0x4b>
jmp    1154 <test_func_1+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_func_1>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xeea(%rip),%rdx
mov    $0x1,%esi
mov    $0x5,%ecx
call   1030 <bc_assert_cond@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"(1 == 1)\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/avalentino/epr-api/refs/heads/master/bccunit/src/bccunit_test.c\00"
define i32 @test_func_1(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i64 @bc_assert_cond(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 5)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %9
7: ; preds = %1
br label %8
8: ; preds = %7
store i32 0, i32* %2
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [9 x i8] c"(1 == 1)\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/avalentino/epr-api/refs/heads/master/bccunit/src/bccunit_test.c\00"
define i32 @test_func_1(i8* nocapture readnone %0) {
%2 = tail call i64 @bc_assert_cond(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 5)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ nios_pkt_8x64_pack(int *, int, int, int, int /*<<< orphan*/);
void nios_pkt_8x64_resp_pack(uint8_t *buf, uint8_t target, bool write,
                             uint8_t addr, uint64_t data, bool success) {
  nios_pkt_8x64_pack(buf, target, write, addr, data);
  if (success) {
    buf[2] |= (1 << 1);
  }
}


x86 assembly (clang, -O0):
<nios_pkt_8x64_resp_pack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <nios_pkt_8x64_pack@plt>
cmpl   $0x0,-0x1c(%rbp)
je     115a <nios_pkt_8x64_resp_pack+0x4a>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
or     $0x2,%ecx
mov    %ecx,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nios_pkt_8x64_resp_pack>:
push   %rbp
push   %rbx
push   %rax
mov    %r9d,%ebp
mov    %rdi,%rbx
call   1030 <nios_pkt_8x64_pack@plt>
test   %ebp,%ebp
je     1126 <nios_pkt_8x64_resp_pack+0x16>
orb    $0x2,0x8(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @nios_pkt_8x64_resp_pack(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @nios_pkt_8x64_pack(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4)
%8 = icmp eq i32 %5, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = load i32, i32* %10
%12 = or i32 %11, 2
store i32 %12, i32* %10
br label %13
13: ; preds = %9, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((hotpatch(0))) void hp1(void) { printf("hello, world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sincos(double, double *, double *);
double f1(double x) {
  double s, c;
  sincos(x, &s, &c);
  return s + c;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <sincos@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <sincos@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define double @f1(double %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
%5 = bitcast double* %3 to i8*
%6 = call i32 @sincos(double %0, double* %2, double* %3)
%7 = load double, double* %2
%8 = load double, double* %3
%9 = fadd double %7, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ print_wireway();
int /*<<< orphan*/ restore_wireway(char *);
void test_restore_wireway() {
  restore_wireway("/chn/name1");
  restore_wireway("/chn/name2");
  print_wireway();
}


x86 assembly (clang, -O0):
<test_restore_wireway>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <restore_wireway@plt>
lea    0xed4(%rip),%rdi
call   1030 <restore_wireway@plt>
mov    $0x0,%al
call   1040 <print_wireway@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_restore_wireway>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <restore_wireway@plt>
lea    0xed7(%rip),%rdi
call   1030 <restore_wireway@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <print_wireway@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"/chn/name1\00"
@.str.1 = [11 x i8] c"/chn/name2\00"
define void @test_restore_wireway() {
%1 = call i32 @restore_wireway(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @restore_wireway(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @print_wireway()
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"/chn/name1\00"
@.str.1 = [11 x i8] c"/chn/name2\00"
define void @test_restore_wireway() {
%1 = tail call i32 @restore_wireway(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @restore_wireway(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @print_wireway()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_pin(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int, int);
void set_interrupt_on_pin(uint8_t address, uint8_t pin, uint8_t value) {
  set_pin(address, pin, value, 0x04, 0x05);
}


x86 assembly (clang, -O0):
<set_interrupt_on_pin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    $0x4,%ecx
mov    $0x5,%r8d
call   1030 <set_pin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_interrupt_on_pin>:
mov    $0x4,%ecx
mov    $0x5,%r8d
jmp    1030 <set_pin@plt>

LLVM IR (-O0):
define void @set_interrupt_on_pin(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 = load i32, i32* %6
%10 = call i32 @set_pin(i32 %7, i32 %8, i32 %9, i32 4, i32 5)
ret void
}

LLVM IR (-O2):
define void @set_interrupt_on_pin(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @set_pin(i32 %0, i32 %1, i32 %2, i32 4, i32 5)
ret void
}
int compute_argc(char **argv) {
  int argc = 0;
  while (*argv) {
    argv++;
    argc++;
  }
  return argc;
}


x86 assembly (clang, -O0):
<compute_argc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1137 <compute_argc+0x37>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <compute_argc+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_argc>:
cmpq   $0x0,(%rdi)
je     111d <compute_argc+0x1d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <compute_argc+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @compute_argc(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Type definitions */
struct feed_buf {
  int dummy;
};

/* Variables and functions */
char feed_esc_write_n1(struct feed_buf *const, unsigned int const, char);
char feed_esc_write_cuf(struct feed_buf *const p_buf,
                        unsigned int const i_count) {
  return feed_esc_write_n1(p_buf, i_count, 'C');
}


x86 assembly (clang, -O0):
<feed_esc_write_cuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x43,%edx
call   1030 <feed_esc_write_n1@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<feed_esc_write_cuf>:
mov    $0x43,%edx
jmp    1030 <feed_esc_write_n1@plt>

LLVM IR (-O0):
%struct.feed_buf = type { i32 }
define signext i8 @feed_esc_write_cuf(%struct.feed_buf* %0, i32 %1) {
%3 = alloca %struct.feed_buf*
%4 = alloca i32
store %struct.feed_buf* %0, %struct.feed_buf** %3
store i32 %1, i32* %4
%5 = load %struct.feed_buf*, %struct.feed_buf** %3
%6 = load i32, i32* %4
%7 = call signext i8 @feed_esc_write_n1(%struct.feed_buf* %5, i32 %6, i8 signext 67)
ret i8 %7
}

LLVM IR (-O2):
%struct.feed_buf = type { i32 }
define signext i8 @feed_esc_write_cuf(%struct.feed_buf* %0, i32 %1) {
%3 = tail call signext i8 @feed_esc_write_n1(%struct.feed_buf* %0, i32 %1, i8 signext 67)
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, long);
void print_header(char *routine_name, long int len) {
  printf("Cycles used by the measured routine %s with %ld items:\n",
         routine_name, len);
}


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

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

LLVM IR (-O0):
@.str = [56 x i8] c"Cycles used by the measured routine %s with %ld items:\0A\00"
define void @print_header(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"Cycles used by the measured routine %s with %ld items:\0A\00"
define void @print_header(i8* %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void info(char *line) { printf("%s%%%s : %s\n", "\e[30;1m", "\e[0m", line); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"%s%%%s : %s\0A\00"
@.str.1 = [8 x i8] c"\1B[30;1m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @info(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s%%%s : %s\0A\00"
@.str.1 = [8 x i8] c"\1B[30;1m\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @info(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_INT2_PIN() { set_io_bit(0x43, 2); }


x86 assembly (clang, -O0):
<TOSH_SET_INT2_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x43,%edi
mov    $0x2,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_INT2_PIN>:
mov    $0x43,%edi
mov    $0x2,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_INT2_PIN() {
%1 = call i32 @set_io_bit(i32 67, i32 2)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_INT2_PIN() {
%1 = tail call i32 @set_io_bit(i32 67, i32 2)
ret void
}
/* Variables and functions */
int fib(int);
int fib2(int n) { return (n < 2 ? n : fib(n - 1) + fib(n - 2)); }


x86 assembly (clang, -O0):
<fib2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1130 <fib2+0x20>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <fib2+0x43>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib2>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x2,%edi
jl     1132 <fib2+0x22>
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
mov    %eax,%ebp
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <fib@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib2(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @fib(i32 %4)
%6 = add nsw i32 %0, -2
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %7, %5
br label %9
9: ; preds = %1, %3
%10 = phi i32 [ %8, %3 ], [ %0, %1 ]
ret i32 %10
}
int strcmp(const char *s1, const char *s2) {
  while (*s1 && *s1 == *s2) {
    s1++;
    s2++;
  }
  return (int)*s1 - (int)*s2;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strcmp+0x47>
jmp    1164 <strcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <strcmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <strcmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <strcmp+0x10>
xor    %eax,%eax
movsbl %al,%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %20, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br label %18
18: ; preds = %10, %5
%19 = phi i1 [ false, %5 ], [ %17, %10 ]
br i1 %19, label %20, label %25
20: ; preds = %18
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %5
25: ; preds = %18
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %28, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = sext i8 %18 to i32
%20 = load i8, i8* %17
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
long getTime() {
  struct timespec t;
  clock_gettime(CLOCK_THREAD_CPUTIME_ID, &t);
  return ((long)t.tv_sec) * 1000 * 1000 * 1000 + ((long)t.tv_nsec);
}


x86 assembly (clang, -O0):
<getTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,-0x8(%rbp),%rax
imul   $0x3e8,%rax,%rax
imul   $0x3e8,%rax,%rax
add    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTime>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,0x10(%rsp),%rax
9a 3b
add    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define i64 @getTime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000
%7 = mul nsw i64 %6, 1000
%8 = mul nsw i64 %7, 1000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%10 = load i64, i64* %9
%11 = add nsw i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define i64 @getTime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = mul i64 %6, 1000000000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = add nsw i64 %7, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ write(int, char *, int);
int verify_inf_size(int value, int expected) {
  if (value > expected) {
    write(1, "Error: size too big", 19 * sizeof(char));
    exit(2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<verify_inf_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    115a <verify_inf_size+0x3a>
mov    $0x1,%edi
lea    0xeba(%rip),%rsi
mov    $0x13,%edx
call   1030 <write@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_inf_size>:
cmp    %esi,%edi
jg     1127 <verify_inf_size+0x7>
xor    %eax,%eax
ret
push   %rax
lea    0xed1(%rip),%rsi
mov    $0x1,%edi
mov    $0x13,%edx
call   1030 <write@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Error: size too big\00"
define i32 @verify_inf_size(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 %11
8: ; preds = %2
%9 = call i32 @write(i32 1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 19)
%10 = call i32 @exit(i32 2)
unreachable
11: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Error: size too big\00"
define i32 @verify_inf_size(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 19)
%6 = tail call i32 @exit(i32 2)
unreachable
7: ; preds = %2
ret i32 0
}
int test_imm_4Cint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x4C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_4Cint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 76
%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_4Cint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4980736
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void Mem_Copy(void *dest, const void *src, size_t n) { memcpy(dest, src, n); }


x86 assembly (clang, -O0):
<Mem_Copy>:
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 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mem_Copy>:
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @Mem_Copy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello world (standalone\n"); }


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

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

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

LLVM IR (-O2):
@str = [24 x i8] c"Hello world (standalone\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SDLinoLoop();
void loop() { SDLinoLoop(); }


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

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

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

LLVM IR (-O2):
define void @loop() {
%1 = tail call i32 (...) @SDLinoLoop()
ret void
}
/* Type definitions */
struct vec3 {
  int dummy;
};
struct mat4 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mat4_look_at(float *, float *, float *, float *);
__attribute__((always_)) struct mat4 *psmat4_look_at(struct mat4 *result,
                                                     struct vec3 *position,
                                                     struct vec3 *target,
                                                     struct vec3 *up_axis) {
  mat4_look_at((float *)result, (float *)position, (float *)target,
               (float *)up_axis);
  return result;
}


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

x86 assembly (clang, -O2):
<psmat4_look_at>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mat4_look_at@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.mat4 = type { i32 }
%struct.vec3 = type { i32 }
define %struct.mat4* @psmat4_look_at(%struct.mat4* %0, %struct.vec3* %1, %struct.vec3* %2, %struct.vec3* %3) {
%5 = alloca %struct.mat4*
%6 = alloca %struct.vec3*
%7 = alloca %struct.vec3*
%8 = alloca %struct.vec3*
store %struct.mat4* %0, %struct.mat4** %5
store %struct.vec3* %1, %struct.vec3** %6
store %struct.vec3* %2, %struct.vec3** %7
store %struct.vec3* %3, %struct.vec3** %8
%9 = load %struct.mat4*, %struct.mat4** %5
%10 = bitcast %struct.mat4* %9 to float*
%11 = load %struct.vec3*, %struct.vec3** %6
%12 = bitcast %struct.vec3* %11 to float*
%13 = load %struct.vec3*, %struct.vec3** %7
%14 = bitcast %struct.vec3* %13 to float*
%15 = load %struct.vec3*, %struct.vec3** %8
%16 = bitcast %struct.vec3* %15 to float*
%17 = call i32 @mat4_look_at(float* %10, float* %12, float* %14, float* %16)
%18 = load %struct.mat4*, %struct.mat4** %5
ret %struct.mat4* %18
}

LLVM IR (-O2):
%struct.mat4 = type { i32 }
%struct.vec3 = type { i32 }
define %struct.mat4* @psmat4_look_at(%struct.mat4* returned %0, %struct.vec3* %1, %struct.vec3* %2, %struct.vec3* %3) {
%5 = bitcast %struct.mat4* %0 to float*
%6 = bitcast %struct.vec3* %1 to float*
%7 = bitcast %struct.vec3* %2 to float*
%8 = bitcast %struct.vec3* %3 to float*
%9 = tail call i32 @mat4_look_at(float* %5, float* %6, float* %7, float* %8)
ret %struct.mat4* %0
}
unsigned xrop3_82_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = S & D;
  stk2 = T | stk3;
  stk1 = D ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_82_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_82_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
or     %edi,%ecx
xor    $0xff,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_82_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = and i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %5
%37 = load i32, i32* %6
%38 = and i32 %36, %37
%39 = or i32 %35, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @xrop3_82_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i32 %6, %3
%8 = xor i32 %7, 255
%9 = xor i32 %4, -1
%10 = and i32 %8, %9
%11 = or i32 %10, %3
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) { printf("Handler called for signal %d\n", sig); }


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

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

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

LLVM IR (-O2):
@.str = [30 x i8] c"Handler called for signal %d\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void FNoArgs() {}


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

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

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

LLVM IR (-O2):
define void @FNoArgs() {
ret void
}
int extfunc2() { return 3; }


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

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

LLVM IR (-O0):
define i32 @extfunc2() {
ret i32 3
}

LLVM IR (-O2):
define i32 @extfunc2() {
ret i32 3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t dsp_nibbles_to_samples(uint32_t nibbles) {
  uint32_t whole_frames = nibbles / 16;
  unsigned int remainder = nibbles % 16;
  if (remainder > 0)
    return whole_frames * 14 + remainder - 2;
  else
    return whole_frames * 14;
}


x86 assembly (clang, -O0):
<dsp_nibbles_to_samples>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jbe    113f <dsp_nibbles_to_samples+0x3f>
imul   $0xe,-0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <dsp_nibbles_to_samples+0x46>
imul   $0xe,-0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsp_nibbles_to_samples>:
lea    0xf(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%ecx
and    $0xfffffff0,%ecx
sub    %ecx,%edi
sar    $0x4,%eax
sub    %eax,%ecx
sub    %eax,%ecx
lea    -0x2(%rdi),%eax
test   %edi,%edi
cmove  %edi,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @dsp_nibbles_to_samples(i32 %0) {
%2 = sdiv i32 %0, 16
%3 = srem i32 %0, 16
%4 = icmp eq i32 %3, 0
%5 = mul nsw i32 %2, 14
%6 = add nsw i32 %3, -2
%7 = select i1 %4, i32 0, i32 %6
%8 = add nsw i32 %5, %7
ret i32 %8
}
void foo330(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo330(i32 %0) {
ret void
}