xunge/DecIR huggingface dataset:
int dec_converter(int from[8]) {
  int pos, to;
  to = from[0] * 2;
  for (pos = 1; pos < 7; pos++) {
    to = (to + from[pos]) * 2;
  }
  to = to + from[7];
  return to;
}


x86 assembly (clang, -O0):
<dec_converter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    1147 <dec_converter+0x47>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
add    (%rcx,%rdx,4),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111b <dec_converter+0x1b>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
add    0x1c(%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec_converter>:
mov    (%rdi),%eax
add    %eax,%eax
add    0x4(%rdi),%eax
add    %eax,%eax
add    0x8(%rdi),%eax
add    %eax,%eax
add    0xc(%rdi),%eax
add    %eax,%eax
add    0x10(%rdi),%eax
add    %eax,%eax
add    0x14(%rdi),%eax
add    %eax,%eax
add    0x18(%rdi),%eax
add    %eax,%eax
add    0x1c(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @dec_converter(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl nsw i32 %2, 1
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = add nsw i32 %5, %3
%7 = shl nsw i32 %6, 1
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = add nsw i32 %9, %7
%11 = shl nsw i32 %10, 1
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = add nsw i32 %13, %11
%15 = shl nsw i32 %14, 1
%16 = getelementptr inbounds i32, i32* %0, i64 4
%17 = load i32, i32* %16
%18 = add nsw i32 %17, %15
%19 = shl nsw i32 %18, 1
%20 = getelementptr inbounds i32, i32* %0, i64 5
%21 = load i32, i32* %20
%22 = add nsw i32 %21, %19
%23 = shl nsw i32 %22, 1
%24 = getelementptr inbounds i32, i32* %0, i64 6
%25 = load i32, i32* %24
%26 = add nsw i32 %25, %23
%27 = shl nsw i32 %26, 1
%28 = getelementptr inbounds i32, i32* %0, i64 7
%29 = load i32, i32* %28
%30 = add nsw i32 %29, %27
ret i32 %30
}
/* Type definitions */
struct symbol_table_s {
  int dummy;
};
struct identifier_s {
  int dummy;
};

/* Variables and functions */
struct identifier_s *symbol_lookup(struct symbol_table_s *, char const *);
struct identifier_s *identifier_lookup(struct symbol_table_s *table,
                                       const char *name) {
  struct identifier_s *id = symbol_lookup(table, name);
  return id;
}


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

x86 assembly (clang, -O2):
<identifier_lookup>:
jmp    1030 <symbol_lookup@plt>

LLVM IR (-O0):
%struct.identifier_s = type { i32 }
%struct.symbol_table_s = type { i32 }
define %struct.identifier_s* @identifier_lookup(%struct.symbol_table_s* %0, i8* %1) {
%3 = alloca %struct.symbol_table_s*
%4 = alloca i8*
%5 = alloca %struct.identifier_s*
store %struct.symbol_table_s* %0, %struct.symbol_table_s** %3
store i8* %1, i8** %4
%6 = load %struct.symbol_table_s*, %struct.symbol_table_s** %3
%7 = load i8*, i8** %4
%8 = call %struct.identifier_s* @symbol_lookup(%struct.symbol_table_s* %6, i8* %7)
store %struct.identifier_s* %8, %struct.identifier_s** %5
%9 = load %struct.identifier_s*, %struct.identifier_s** %5
ret %struct.identifier_s* %9
}

LLVM IR (-O2):
%struct.identifier_s = type { i32 }
%struct.symbol_table_s = type { i32 }
define %struct.identifier_s* @identifier_lookup(%struct.symbol_table_s* %0, i8* %1) {
%3 = tail call %struct.identifier_s* @symbol_lookup(%struct.symbol_table_s* %0, i8* %1)
ret %struct.identifier_s* %3
}
/* Variables and functions */
int /*<<< orphan*/ strncmp(char *, char *, int);
int is_android(char *name) {
  if (!strncmp(name, "android", 7))
    return 1;
  if (!strncmp(name, "cm-", 3))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_android>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1146 <is_android+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1177 <is_android+0x67>
mov    -0x10(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1170 <is_android+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1177 <is_android+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_android>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1148 <is_android+0x38>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"android\00"
@.str.1 = [4 x i8] c"cm-\00"
define i32 @is_android(i8* %0) {
%2 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ clear_bit(unsigned long, void volatile *);
int /*<<< orphan*/ smp_mb();
void clear_bit_unlock(unsigned long nr, volatile void *addr) {
  smp_mb();
  clear_bit(nr, addr);
}


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

x86 assembly (clang, -O2):
<clear_bit_unlock>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <smp_mb@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <clear_bit@plt>

LLVM IR (-O0):
define void @clear_bit_unlock(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = call i32 (...) @smp_mb()
%6 = load i64, i64* %3
%7 = load i8*, i8** %4
%8 = call i32 @clear_bit(i64 %6, i8* %7)
ret void
}

LLVM IR (-O2):
define void @clear_bit_unlock(i64 %0, i8* %1) {
%3 = tail call i32 (...) @smp_mb()
%4 = tail call i32 @clear_bit(i64 %0, i8* %1)
ret void
}
float convert_adc_current(float adc_volts) { return adc_volts * 10. + 0.14; }


x86 assembly (clang, -O0):
<convert_adc_current>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_adc_current>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @convert_adc_current(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call double @llvm.fmuladd.f64(double %4, double 1.000000e+01, double 1.400000e-01)
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @convert_adc_current(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.000000e+01, double 1.400000e-01)
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
int main(int argc, char *argv[]) {
  int i;
  for (i = 0; i < argc; ++i) {
    printf("arg%02d: %s\n", i, argv[i]);
  }
  return 0;
}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @Swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
void lgtd_lifx_gateway_handle_power_state(
    struct lgtd_lifx_gateway *gw, const struct lgtd_lifx_packet_header *hdr,
    const struct lgtd_lifx_packet_power_state *pkt) {
  (void)gw;
  (void)hdr;
  (void)pkt;
}


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

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

LLVM IR (-O0):
%struct.lgtd_lifx_gateway = type opaque
%struct.lgtd_lifx_packet_header = type opaque
%struct.lgtd_lifx_packet_power_state = type opaque
define void @lgtd_lifx_gateway_handle_power_state(%struct.lgtd_lifx_gateway* %0, %struct.lgtd_lifx_packet_header* %1, %struct.lgtd_lifx_packet_power_state* %2) {
%4 = alloca %struct.lgtd_lifx_gateway*
%5 = alloca %struct.lgtd_lifx_packet_header*
%6 = alloca %struct.lgtd_lifx_packet_power_state*
store %struct.lgtd_lifx_gateway* %0, %struct.lgtd_lifx_gateway** %4
store %struct.lgtd_lifx_packet_header* %1, %struct.lgtd_lifx_packet_header** %5
store %struct.lgtd_lifx_packet_power_state* %2, %struct.lgtd_lifx_packet_power_state** %6
%7 = load %struct.lgtd_lifx_gateway*, %struct.lgtd_lifx_gateway** %4
%8 = load %struct.lgtd_lifx_packet_header*, %struct.lgtd_lifx_packet_header** %5
%9 = load %struct.lgtd_lifx_packet_power_state*, %struct.lgtd_lifx_packet_power_state** %6
ret void
}

LLVM IR (-O2):
%struct.lgtd_lifx_gateway = type opaque
%struct.lgtd_lifx_packet_header = type opaque
%struct.lgtd_lifx_packet_power_state = type opaque
define void @lgtd_lifx_gateway_handle_power_state(%struct.lgtd_lifx_gateway* nocapture %0, %struct.lgtd_lifx_packet_header* nocapture %1, %struct.lgtd_lifx_packet_power_state* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: %s [-t ldisc] [-hHlmn] [-s baudrate] ttyname\n",
                getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"usage: %s [-t ldisc] [-hHlmn] [-s baudrate] ttyname\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"usage: %s [-t ldisc] [-hHlmn] [-s baudrate] ttyname\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void roccat_disconnect(int minor) {}


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

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

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

LLVM IR (-O2):
define void @roccat_disconnect(i32 %0) {
ret void
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int x = 10, y = 20;
  printf("\n%d + %d = %d", x, y, add(x, y));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <add@plt>
lea    0xec9(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"\0A%d + %d = %d\00"
define i32 @main() {
%1 = tail call i32 @add(i32 10, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_cmpgt_pi8(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test_mm_cmpgt_pi8(__m64 a, __m64 b) { return _mm_cmpgt_pi8(a, b); }


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

x86 assembly (clang, -O2):
<test_mm_cmpgt_pi8>:
jmp    1030 <_mm_cmpgt_pi8@plt>

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

LLVM IR (-O2):
define i32 @test_mm_cmpgt_pi8(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_cmpgt_pi8(i32 %0, i32 %1)
ret i32 %3
}
void print_message(char *video_memory, char s[]) {
  int i;
  for (i = 0; s[i] != 0; i++) {
    *video_memory++ = s[i];
    *video_memory++ = 0x02;
  }
}


x86 assembly (clang, -O0):
<print_message>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <print_message+0x64>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x2,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <print_message+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_message>:
mov    (%rsi),%al
test   %al,%al
je     1125 <print_message+0x25>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rdi,%rcx,2)
movb   $0x2,0x1(%rdi,%rcx,2)
movzbl 0x1(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <print_message+0x10>
ret

LLVM IR (-O0):
define void @print_message(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 0, i32* %5
br label %6
6: ; preds = %24, %2
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %6
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
store i8 %19, i8* %20
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
store i8 2, i8* %22
br label %24
24: ; preds = %14
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %6
27: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @print_message(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %11, %5 ], [ 0, %2 ]
%7 = phi i8 [ %13, %5 ], [ %3, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %7, i8* %8
%10 = getelementptr inbounds i8, i8* %8, i64 2
store i8 2, i8* %9
%11 = add nuw nsw i64 %6, 1
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
ret void
}
x(int i __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define i32 @x(i32 %0) {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void timestamp() {
  time_t now;
  struct tm *t;
  now = time(0);
  t = localtime(&now);
  printf(" [%02d:%02d:%02d] ", t->tm_hour, t->tm_min, t->tm_sec);
}


x86 assembly (clang, -O0):
<timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestamp>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [19 x i8] c" [%02d:%02d:%02d] \00"
define void @timestamp() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32 0)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load %struct.tm*, %struct.tm** %2
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 1
%10 = load i32, i32* %9
%11 = load %struct.tm*, %struct.tm** %2
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 2
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [19 x i8] c" [%02d:%02d:%02d] \00"
define void @timestamp() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32 0)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8, i32 %10)
ret void
}
/* Variables and functions */
int SHUT_RDWR;
int bsd_syscall_shutdown(int, int);
int /*<<< orphan*/ close(int);
int uptcp_shutdown(int s, int how) {
  int res;
  res = bsd_syscall_shutdown(s, how);
  if (how == SHUT_RDWR)
    close(s);
  return res;
}


x86 assembly (clang, -O0):
<uptcp_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <bsd_syscall_shutdown@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
jne    1156 <uptcp_shutdown+0x36>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uptcp_shutdown>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <bsd_syscall_shutdown@plt>
mov    %eax,%r14d
mov    0x2eb9(%rip),%rax
cmp    %ebp,(%rax)
jne    1142 <uptcp_shutdown+0x22>
mov    %ebx,%edi
call   1040 <close@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@SHUT_RDWR = global i32 0
define i32 @uptcp_shutdown(i32 %0, i32 %1) {
%3 = tail call i32 @bsd_syscall_shutdown(i32 %0, i32 %1)
%4 = load i32, i32* @SHUT_RDWR
%5 = icmp eq i32 %4, %1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @close(i32 %0)
br label %8
8: ; preds = %6, %2
ret i32 %3
}
void showplayer(void) {}


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

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

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

LLVM IR (-O2):
define void @showplayer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void main() {
  int x, y;
  y = 1;
  x = -50;
  while (x < 0) {
    x = x + y;
    y++;
  }
  assert(y > 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
movl   $0xffffffce,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1147 <main+0x37>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @assert(i32 1)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int first_error;
};
typedef TYPE_1__ XExtCodes;

/* Variables and functions */
void set_XExtCodes_first_error(void *_p, int _v) {
  ((XExtCodes *)_p)->first_error = (int)_v;
}


x86 assembly (clang, -O0):
<set_XExtCodes_first_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XExtCodes_first_error(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XExtCodes_first_error(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
char *addBinary(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char const *argv[]) {
  char *a = "1111";
  char *b = "0100";
  printf("%s\n", addBinary(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <addBinary@plt>
mov    %rax,%rsi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"1111\00"
@.str.1 = [5 x i8] c"0100\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @addBinary(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ kill_all_children();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
void sigterm_handler() {
  kill_all_children();
  signal(SIGTERM, SIG_DFL);
  kill(getpid(), SIGTERM);
}


x86 assembly (clang, -O0):
<sigterm_handler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <kill_all_children@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigterm_handler>:
push   %rbx
xor    %eax,%eax
call   1060 <kill_all_children@plt>
mov    0x2e99(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    (%rbx),%esi
mov    %eax,%edi
pop    %rbx
jmp    1050 <kill@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
@SIG_DFL = global i32 0
define void @sigterm_handler() {
%1 = call i32 (...) @kill_all_children()
%2 = load i32, i32* @SIGTERM
%3 = load i32, i32* @SIG_DFL
%4 = call i32 @signal(i32 %2, i32 %3)
%5 = call i32 (...) @getpid()
%6 = load i32, i32* @SIGTERM
%7 = call i32 @kill(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@SIG_DFL = global i32 0
define void @sigterm_handler() {
%1 = tail call i32 (...) @kill_all_children()
%2 = load i32, i32* @SIGTERM
%3 = load i32, i32* @SIG_DFL
%4 = tail call i32 @signal(i32 %2, i32 %3)
%5 = tail call i32 (...) @getpid()
%6 = load i32, i32* @SIGTERM
%7 = tail call i32 @kill(i32 %5, i32 %6)
ret void
}
void g_get_user_cache_dir() {}


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

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

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

LLVM IR (-O2):
define void @g_get_user_cache_dir() {
ret void
}
int capture_charpointer(const char *carg, void *pvar) {
  char **ppchar = pvar;
  *ppchar = (void *)carg;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @capture_charpointer(i8* %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i8**
store i8* %0, i8** %3
ret i32 0
}
int mpi_get_total_blocks(int n) { return (n * (n + 1)) / 2; }


x86 assembly (clang, -O0):
<mpi_get_total_blocks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpi_get_total_blocks>:
lea    0x1(%rdi),%ecx
imul   %edi,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @mpi_get_total_blocks(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = sdiv i32 %3, 2
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void __u32_cpy(void *a, void *b) { *(uint32_t *)a = *(uint32_t *)b; }


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

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

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

LLVM IR (-O2):
define void @__u32_cpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void vlsi_write_sci(uint8_t reg, uint16_t val) {}


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

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

LLVM IR (-O0):
define void @vlsi_write_sci(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @vlsi_write_sci(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *stderr;
FILE *_open_file(char *path) { return stderr; }


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

x86 assembly (clang, -O2):
<_open_file>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
@stderr = global i32* null
define i32* @_open_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32*, i32** @stderr
ret i32* %3
}

LLVM IR (-O2):
@stderr = global i32* null
define i32* @_open_file(i8* nocapture readnone %0) {
%2 = load i32*, i32** @stderr
ret i32* %2
}
/* Variables and functions */
int count_monitors();
int two_monitors(void) { return count_monitors() == 2; }


x86 assembly (clang, -O0):
<two_monitors>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <count_monitors@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<two_monitors>:
push   %rax
xor    %eax,%eax
call   1030 <count_monitors@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @two_monitors() {
%1 = call i32 (...) @count_monitors()
%2 = icmp eq i32 %1, 2
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @two_monitors() {
%1 = tail call i32 (...) @count_monitors()
%2 = icmp eq i32 %1, 2
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void modInitFunc1(void) {
  printf("modInitFunc1\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<modInitFunc1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<modInitFunc1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"modInitFunc1\0A\00"
@stdout = global i32 0
define void @modInitFunc1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [13 x i8] c"modInitFunc1\00"
define void @modInitFunc1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
unsigned int exynos_get_ch_seq(unsigned char *frm) { return frm[9]; }


x86 assembly (clang, -O0):
<exynos_get_ch_seq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x9(%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exynos_get_ch_seq>:
movzbl 0x9(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @exynos_get_ch_seq(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 9
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @exynos_get_ch_seq(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 9
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
void setreuseaddr(int fd) {
  int opt = 1;
  if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(&opt)) < 0) {
    perror("setsockopt");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<setreuseaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    1186 <setreuseaddr+0x56>
lea    0xe89(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setreuseaddr>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%esi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x8,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     1162 <setreuseaddr+0x32>
pop    %rax
ret
lea    0xe97(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [11 x i8] c"setsockopt\00"
define void @setreuseaddr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_REUSEADDR
%7 = call i64 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 8)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [11 x i8] c"setsockopt\00"
define void @setreuseaddr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i64 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 8)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
ret void
}
/* Variables and functions */
int atoi(char *);
int _wilddog_atoi(char *str) {
  if (NULL == str)
    return 0;
  return atoi(str);
}


x86 assembly (clang, -O0):
<_wilddog_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1134 <_wilddog_atoi+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1140 <_wilddog_atoi+0x30>
mov    -0x10(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_wilddog_atoi>:
test   %rdi,%rdi
je     111a <_wilddog_atoi+0xa>
jmp    1030 <atoi@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @_wilddog_atoi(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @atoi(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
void glmMultVectorByScalar2d(double v[2], double a) {
  v[0] *= a;
  v[1] *= a;
}


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

x86 assembly (clang, -O2):
<glmMultVectorByScalar2d>:
movupd (%rdi),%xmm1
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movupd %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @glmMultVectorByScalar2d(double* %0, double %1) {
%3 = alloca double*
%4 = alloca double
store double* %0, double** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = fmul double %8, %5
store double %9, double* %7
%10 = load double, double* %4
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = fmul double %13, %10
store double %14, double* %12
ret void
}

LLVM IR (-O2):
define void @glmMultVectorByScalar2d(double* nocapture %0, double %1) {
%3 = bitcast double* %0 to <2 x double>*
%4 = load <2 x double>, <2 x double>* %3
%5 = insertelement <2 x double> poison, double %1, i64 0
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%7 = fmul <2 x double> %4, %6
%8 = bitcast double* %0 to <2 x double>*
store <2 x double> %7, <2 x double>* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_qml_comments() {
  test_parser_verify_parse(test_parser_sourcefile("qml", " //comment"), "qml",
                           "", "//comment", 0);
}


x86 assembly (clang, -O0):
<test_qml_comments>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xeb7(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_qml_comments>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_parser_sourcefile@plt>
lea    0xec5(%rip),%rdx
lea    0xec0(%rip),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"qml\00"
@.str.1 = [11 x i8] c" //comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c"//comment\00"
define void @test_qml_comments() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"qml\00"
@.str.1 = [11 x i8] c" //comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c"//comment\00"
define void @test_qml_comments() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}