xunge/DecIR huggingface dataset:
OP(ed, cf) { illegal_2(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ showfile(char *);
void subfunc1(void) { showfile("../demos/tui.c"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"../demos/tui.c\00"
define void @subfunc1() {
%1 = call i32 @showfile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"../demos/tui.c\00"
define void @subfunc1() {
%1 = tail call i32 @showfile(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
int foo(int j) {
  int i;
  int sum = 0;
  for (i = 1; i < j; i += i)
    sum += __builtin_abs(i);
  return sum;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1142 <foo+0x42>
mov    -0x8(%rbp),%eax
xor    %ecx,%ecx
sub    %eax,%ecx
cmp    $0x0,%eax
cmovl  %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <foo+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     111f <foo+0x1f>
mov    $0x1,%ecx
xor    %eax,%eax
xchg   %ax,%ax
mov    %ecx,%edx
neg    %edx
cmovs  %ecx,%edx
add    %edx,%eax
add    %ecx,%ecx
cmp    %edi,%ecx
jl     1110 <foo+0x10>
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 1, %1 ]
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
%7 = add nuw nsw i32 %4, %6
%8 = shl nsw i32 %5, 1
%9 = icmp slt i32 %8, %0
br i1 %9, label %3, label %10
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
void get_pid_task(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<get_pid_task>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pid_task>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.get_pid_task = [13 x i8] c"get_pid_task\00"
define void @get_pid_task() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.get_pid_task, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.get_pid_task = [13 x i8] c"get_pid_task\00"
define void @get_pid_task() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.get_pid_task, i64 0, i64 0))
ret void
}
void mark_block_dead(struct free_arena_header *ah) {}


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

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

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

LLVM IR (-O2):
%struct.free_arena_header = type opaque
define void @mark_block_dead(%struct.free_arena_header* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ chSysUnlock();
int /*<<< orphan*/ port_get_irq_status();
int /*<<< orphan*/ port_irq_enabled(int /*<<< orphan*/);
void chSysUnconditionalUnlock(void) {
  if (!port_irq_enabled(port_get_irq_status()))
    chSysUnlock();
}


x86 assembly (clang, -O0):
<chSysUnconditionalUnlock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <port_get_irq_status@plt>
mov    %eax,%edi
call   1050 <port_irq_enabled@plt>
cmp    $0x0,%eax
jne    1152 <chSysUnconditionalUnlock+0x22>
mov    $0x0,%al
call   1040 <chSysUnlock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<chSysUnconditionalUnlock>:
push   %rax
xor    %eax,%eax
call   1030 <port_get_irq_status@plt>
mov    %eax,%edi
call   1050 <port_irq_enabled@plt>
test   %eax,%eax
je     1145 <chSysUnconditionalUnlock+0x15>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <chSysUnlock@plt>

LLVM IR (-O0):
define void @chSysUnconditionalUnlock() {
%1 = call i32 (...) @port_get_irq_status()
%2 = call i32 @port_irq_enabled(i32 %1)
%3 = icmp ne i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call i32 (...) @chSysUnlock()
br label %6
6: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
define void @chSysUnconditionalUnlock() {
%1 = tail call i32 (...) @port_get_irq_status()
%2 = tail call i32 @port_irq_enabled(i32 %1)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @chSysUnlock()
br label %6
6: ; preds = %4, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int APDUGetTag(const uint8_t *p_apdu, int i_size) {
  if (i_size >= 3) {
    int i, t = 0;
    for (i = 0; i < 3; i++)
      t = (t << 8) | *p_apdu++;
    return t;
  }
  return 0x000000;
}


x86 assembly (clang, -O0):
<APDUGetTag>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jl     1160 <APDUGetTag+0x60>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1155 <APDUGetTag+0x55>
mov    -0x1c(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x4,%rdx
mov    %rdx,-0x10(%rbp)
or     (%rcx),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1123 <APDUGetTag+0x23>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <APDUGetTag+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<APDUGetTag>:
xor    %eax,%eax
cmp    $0x3,%esi
jl     1117 <APDUGetTag+0x17>
mov    (%rdi),%ecx
mov    0x4(%rdi),%eax
shl    $0x10,%ecx
shl    $0x8,%eax
or     %ecx,%eax
or     0x8(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @APDUGetTag(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 2
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %0
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %5
%9 = shl i32 %6, 16
%10 = shl i32 %8, 8
%11 = or i32 %9, %10
%12 = load i32, i32* %7
%13 = or i32 %12, %11
br label %14
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %13, %4 ]
ret i32 %15
}
void packi32(unsigned char *buf, int i) {
  *buf++ = i >> 24;
  *buf++ = i >> 16;
  *buf++ = i >> 8;
  *buf++ = i;
}


x86 assembly (clang, -O0):
<packi32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<packi32>:
bswap  %esi
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @packi32(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %3 to i8
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %4, i8* %0
%6 = lshr i32 %1, 16
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %7, i8* %5
%9 = lshr i32 %1, 8
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %10, i8* %8
%12 = trunc i32 %1 to i8
store i8 %12, i8* %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ListMnemonics(char *);
int main(int argc, char *argv[]) { ListMnemonics("7233"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"7233\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @ListMnemonics(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int calc_bytes_per_sample_f32(int channel_count) {
  return channel_count * sizeof(float);
}


x86 assembly (clang, -O0):
<calc_bytes_per_sample_f32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_bytes_per_sample_f32>:
lea    0x0(,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @calc_bytes_per_sample_f32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 4
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @calc_bytes_per_sample_f32(i32 %0) {
%2 = shl i32 %0, 2
ret i32 %2
}
/* Variables and functions */
int core1_safe(char const *);
int U_EMRPOLYBEZIERTO_safe(const char *record) { return (core1_safe(record)); }


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

x86 assembly (clang, -O2):
<U_EMRPOLYBEZIERTO_safe>:
jmp    1030 <core1_safe@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPOLYBEZIERTO_safe(i8* %0) {
%2 = tail call i32 @core1_safe(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ error(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int open_listener_socket() {
  int s = socket(PF_INET, SOCK_STREAM, 0);
  if (s == -1)
    error("Can't open a socket");
  return s;
}


x86 assembly (clang, -O0):
<open_listener_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    115a <open_listener_socket+0x3a>
lea    0xeab(%rip),%rdi
call   1030 <error@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_listener_socket>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    114d <open_listener_socket+0x2d>
lea    0xeb8(%rip),%rdi
call   1030 <error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [20 x i8] c"Can't open a socket\00"
define i32 @open_listener_socket() {
%1 = alloca i32
%2 = load i32, i32* @PF_INET
%3 = load i32, i32* @SOCK_STREAM
%4 = call i32 @socket(i32 %2, i32 %3, i32 0)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [20 x i8] c"Can't open a socket\00"
define i32 @open_listener_socket() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
ret i32 %3
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return b ? gcd(b, a % b) : a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114c <gcd+0x3c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,%rsi
call   1030 <gcd@plt>
mov    %rax,-0x18(%rbp)
jmp    1154 <gcd+0x44>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rdi,%rax
test   %rsi,%rsi
je     1135 <gcd+0x35>
mov    %rsi,%rdx
jmp    111d <gcd+0x1d>
nopl   (%rax)
xor    %edx,%edx
div    %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <gcd+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <gcd+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <gcd+0x15>
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %7, %4 ], [ %1, %2 ]
%6 = phi i64 [ %5, %4 ], [ %0, %2 ]
%7 = urem i64 %6, %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i64 [ %0, %2 ], [ %5, %4 ]
ret i64 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ n;

/* Variables and functions */
int CHAR_BIT;
int /*<<< orphan*/ putchar(char);
void print_binary(unsigned n) {
  unsigned i = 1U << (sizeof(n) * CHAR_BIT - 1);
  while (i != 0) {
    putchar('0' + !!(n & i));
    i >>= 1U;
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
movslq (%rax),%rax
shl    $0x2,%rax
sub    $0x1,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1171 <print_binary+0x61>
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <print_binary+0x29>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_binary>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    0x2ec2(%rip),%rax
mov    (%rax),%cl
shl    $0x2,%cl
add    $0xff,%cl
mov    $0x1,%ebx
shl    %cl,%ebx
mov    %ebx,%ebp
nop
mov    %ebx,%eax
and    %r14d,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
shr    %ebp
cmp    $0x1,%ebx
mov    %ebp,%ebx
ja     1130 <print_binary+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define void @print_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @CHAR_BIT
%5 = sext i32 %4 to i64
%6 = mul i64 4, %5
%7 = sub i64 %6, 1
%8 = trunc i64 %7 to i32
%9 = shl i32 1, %8
store i32 %9, i32* %3
br label %10
10: ; preds = %13, %1
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
%21 = add nsw i32 48, %20
%22 = trunc i32 %21 to i8
%23 = call i32 @putchar(i8 signext %22)
%24 = load i32, i32* %3
%25 = lshr i32 %24, 1
store i32 %25, i32* %3
br label %10
26: ; preds = %10
%27 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define void @print_binary(i32 %0) {
%2 = load i32, i32* @CHAR_BIT
%3 = shl i32 %2, 2
%4 = add i32 %3, -1
%5 = shl nuw i32 1, %4
br label %6
6: ; preds = %1, %6
%7 = phi i32 [ %5, %1 ], [ %12, %6 ]
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8 48, i8 49
%11 = tail call i32 @putchar(i8 signext %10)
%12 = lshr i32 %7, 1
%13 = icmp ult i32 %7, 2
br i1 %13, label %14, label %6
14: ; preds = %6
%15 = tail call i32 @putchar(i8 signext 10)
ret void
}
void log_fini(void) {}


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

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

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

LLVM IR (-O2):
define void @log_fini() {
ret void
}
/* Variables and functions */
scalar_t__ isspace(unsigned char const);
void skipWhitespace(const unsigned char **cp) {
  while (isspace(**cp)) {
    ++*cp;
  }
}


x86 assembly (clang, -O0):
<skipWhitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1148 <skipWhitespace+0x38>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    111c <skipWhitespace+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipWhitespace>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
movzbl (%rax),%edi
nopw   0x0(%rax,%rax,1)
call   1030 <isspace@plt>
test   %rax,%rax
je     113a <skipWhitespace+0x2a>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movzbl 0x1(%rax),%edi
jmp    1120 <skipWhitespace+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @skipWhitespace(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isspace(i8 zeroext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1, %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
%9 = load i8, i8* %8
%10 = tail call i64 @isspace(i8 zeroext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void incomplete_command(void) {
  fprintf(stderr, "Command line is not complete. Try option \"help\"\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<incomplete_command>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<incomplete_command>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [49 x i8] c"Command line is not complete. Try option \22help\22\0A\00"
define void @incomplete_command() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"Command line is not complete. Try option \22help\22\0A\00"
define void @incomplete_command() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
size_t strlen(const char *s) {
  size_t i = 0;
  while (s[i++] != 0)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1135 <strlen+0x35>
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %4, %2 ]
%4 = add i64 %3, 1
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void quadric_keyboard(unsigned char key, int x, int y) {
  switch (key) {
  case 27:
    exit(0);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<quadric_keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x1(%rbp),%al
sub    $0x1b,%al
jne    113b <quadric_keyboard+0x2b>
jmp    1134 <quadric_keyboard+0x24>
xor    %edi,%edi
call   1030 <exit@plt>
jmp    1140 <quadric_keyboard+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadric_keyboard>:
cmp    $0x1b,%dil
je     1117 <quadric_keyboard+0x7>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @quadric_keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %11 [
i32 27, label %9
]
9: ; preds = %3
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %3
br label %12
12: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @quadric_keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
ret void
}
/* Variables and functions */
int f(int);
int main() { return f(2) + f(2); }


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2,%edi
call   1030 <f@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1030 <f@plt>
add    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 2)
%2 = tail call i32 @f(i32 2)
%3 = add nsw i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
void munkle_print(unsigned char *st, unsigned char *bt) {
  int i;
  for (i = 8; i > (st - bt); i--) {
    printf("%02x", bt[i - 1]);
  }
}


x86 assembly (clang, -O0):
<munkle_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
cmp    %rcx,%rax
jle    116a <munkle_print+0x5a>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
lea    0xead(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <munkle_print+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<munkle_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
sub    %rsi,%r12
cmp    $0x7,%r12
jg     1157 <munkle_print+0x47>
mov    %rsi,%r14
mov    $0x8,%ebx
lea    0xecd(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl -0x1(%r14,%rbx,1),%esi
add    $0xffffffffffffffff,%rbx
mov    %r15,%rdi
call   1030 <printf@plt>
cmp    %rbx,%r12
jl     1140 <munkle_print+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @munkle_print(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub i64 %3, %4
%6 = icmp slt i64 %5, 8
br i1 %6, label %7, label %14
7: ; preds = %2, %7
%8 = phi i64 [ %9, %7 ], [ 8, %2 ]
%9 = add nsw i64 %8, -1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %11)
%13 = icmp slt i64 %5, %9
br i1 %13, label %7, label %14
14: ; preds = %7, %2
ret void
}
void c_pomp_atomic_exit_(struct ompregdescr *r) { (void)0; }


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

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

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

LLVM IR (-O2):
%struct.ompregdescr = type opaque
define void @c_pomp_atomic_exit_(%struct.ompregdescr* nocapture %0) {
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int strncmp(char const *, char *, int);
int32_t isStringEmpty(const char *str) {
  int32_t length = (int32_t)str;
  if (length == 9) {
    int32_t result =
        strncmp(str + sizeof(int32_t), "undefined", *(int32_t *)str);
    if (result == 0) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isStringEmpty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jne    1165 <isStringEmpty+0x55>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xebe(%rip),%rsi
call   1030 <strncmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1160 <isStringEmpty+0x50>
movl   $0x1,-0x4(%rbp)
jmp    116c <isStringEmpty+0x5c>
jmp    1165 <isStringEmpty+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isStringEmpty>:
cmp    $0x9,%edi
jne    1131 <isStringEmpty+0x21>
push   %rax
mov    (%rdi),%edx
add    $0x4,%rdi
lea    0xedd(%rip),%rsi
call   1030 <strncmp@plt>
test   %eax,%eax
lea    0x8(%rsp),%rsp
je     1134 <isStringEmpty+0x24>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"undefined\00"
define i32 @isStringEmpty(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i32
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 9
br i1 %9, label %10, label %21
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 4
%13 = load i8*, i8** %3
%14 = bitcast i8* %13 to i32*
%15 = load i32, i32* %14
%16 = call i32 @strncmp(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %15)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %10
store i32 1, i32* %2
br label %22
20: ; preds = %10
br label %21
21: ; preds = %20, %1
store i32 0, i32* %2
br label %22
22: ; preds = %21, %19
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@.str = [10 x i8] c"undefined\00"
define i32 @isStringEmpty(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = icmp eq i32 %3, 9
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 4
%7 = bitcast i8* %0 to i32*
%8 = load i32, i32* %7
%9 = tail call i32 @strncmp(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %5, %1
br label %12
12: ; preds = %5, %11
%13 = phi i32 [ 0, %11 ], [ 1, %5 ]
ret i32 %13
}
void glBindAttribLocation(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glBindAttribLocation() {
ret void
}
unsigned long align64(unsigned long offset, unsigned int alignment) {
  unsigned long mask = ~(alignment - 1);
  return (offset + (alignment - 1)) & mask;
}


x86 assembly (clang, -O0):
<align64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
xor    $0xffffffff,%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
and    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align64>:
lea    (%rsi,%rdi,1),%eax
add    $0xffffffff,%eax
mov    %esi,%ecx
neg    %ecx
and    %ecx,%eax
ret

LLVM IR (-O0):
define i64 @align64(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sub i32 %6, 1
%8 = xor i32 %7, -1
%9 = zext i32 %8 to i64
store i64 %9, i64* %5
%10 = load i64, i64* %3
%11 = load i32, i32* %4
%12 = sub i32 %11, 1
%13 = zext i32 %12 to i64
%14 = add i64 %10, %13
%15 = load i64, i64* %5
%16 = and i64 %14, %15
ret i64 %16
}

LLVM IR (-O2):
define i64 @align64(i64 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = sub i32 0, %1
%5 = zext i32 %4 to i64
%6 = zext i32 %3 to i64
%7 = add i64 %6, %0
%8 = and i64 %7, %5
ret i64 %8
}
int toupper(int ch) { return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch); }


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     112c <toupper+0x2c>
cmpl   $0x7a,-0x4(%rbp)
jg     112c <toupper+0x2c>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <toupper+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ console_putbytes(char *, int);
int putchar(int c) {
  char ch = c;
  console_putbytes(&ch, 1);
  return (unsigned char)ch;
}


x86 assembly (clang, -O0):
<putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
lea    -0x5(%rbp),%rdi
mov    $0x1,%esi
call   1030 <console_putbytes@plt>
movzbl -0x5(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putchar>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
call   1030 <console_putbytes@plt>
movzbl 0x7(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @putchar(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = call i32 @console_putbytes(i8* %3, i32 1)
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @putchar(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = call i32 @console_putbytes(i8* %2, i32 1)
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
ret i32 %6
}
const char *rcsid(const char *p) {
  return rcsid(
      p = "@(#)$File: readcdf.c,v 1.16 2009/05/01 22:36:58 christos Exp $");
}


x86 assembly (clang, -O0):
<rcsid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xed2(%rip),%rdi
call   1030 <rcsid@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [63 x i8] c"@(#)$File: readcdf.c,v 1.16 2009/05/01 22:36:58 christos Exp $\00"
define i8* @rcsid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = call i8* @rcsid(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}

LLVM IR (-O2):
define noalias i8* @rcsid(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
void INT_Excep_ICU_GROUP5(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_ICU_GROUP5() {
ret void
}
int mmin(int a, int b) { return (a < b) ? a : b; }


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

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

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

LLVM IR (-O2):
define i32 @mmin(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int data[5] = {5, 1, 3, 2, 4}, i, sum = 0, *pt;
  pt = data;
  for (i = 0; i < 5; i++) {
    sum = sum + *pt;
    pt++;
  }
  printf("合計=%d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1184 <main+0x74>
mov    -0x28(%rbp),%eax
mov    -0x30(%rbp),%rcx
add    (%rcx),%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1154 <main+0x44>
mov    -0x28(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"\E5\90\88\E8\A8\88=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 15)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void foo(int a, int b, int c) {
  if (a != 4)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x4,-0x4(%rbp)
je     1132 <foo+0x22>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x4,%edi
jne    1116 <foo+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @foo(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 = icmp ne i32 %7, 4
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 4
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %3
ret void
}
/* Variables and functions */
long rand_beebs();
long TestingRandom(long index, long total) { return rand_beebs(); }


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

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

LLVM IR (-O0):
define i64 @TestingRandom(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i64 (...) @rand_beebs()
ret i64 %5
}

LLVM IR (-O2):
define i64 @TestingRandom(i64 %0, i64 %1) {
%3 = tail call i64 (...) @rand_beebs()
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *pn_malloc(size_t size) {
  void *ret = malloc(size);
  if (!ret) {
    do {
      fprintf(stderr, "Out of memory.\n");
      exit(1);
    } while (0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<pn_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1178 <pn_malloc+0x48>
jmp    1159 <pn_malloc+0x29>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <pn_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define i8* @pn_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %14, label %8
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; No predecessors!
br label %14
14: ; preds = %13, %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define noalias i8* @pn_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int a = 2;
  int b = 2;
  int c = a + b;
  printf("%d + %d = %d\n", a, b, c);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"%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
store i32 2, i32* %2
store i32 2, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
ret i32 0
}

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