xunge/DecIR huggingface dataset:
char hex2dec(char nibble) {
  char val = 0;
  if (nibble > 'a') {
    val = nibble - 'a' + 10;
  } else if (nibble > 'A') {
    val = nibble - 'A' + 10;
  } else {
    val = nibble - '0';
  }
  return val;
}


x86 assembly (clang, -O0):
<hex2dec>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jle    112d <hex2dec+0x2d>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %al,-0x2(%rbp)
jmp    115b <hex2dec+0x5b>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jle    114c <hex2dec+0x4c>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x2(%rbp)
jmp    1156 <hex2dec+0x56>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x2(%rbp)
jmp    115b <hex2dec+0x5b>
movsbl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2dec>:
cmp    $0x42,%dil
mov    $0xc9,%eax
mov    $0xd0,%ecx
cmovge %eax,%ecx
cmp    $0x62,%dil
mov    $0xa9,%eax
cmovl  %ecx,%eax
add    %dil,%al
ret

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

LLVM IR (-O2):
define signext i8 @hex2dec(i8 signext %0) {
%2 = icmp sgt i8 %0, 97
%3 = icmp sgt i8 %0, 65
%4 = select i1 %3, i8 -55, i8 -48
%5 = select i1 %2, i8 -87, i8 %4
%6 = add i8 %5, %0
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ delay();
int /*<<< orphan*/ led_init(int);
int /*<<< orphan*/ led_show();
int /*<<< orphan*/ rcc_init();
int /*<<< orphan*/ serial_init();
int /*<<< orphan*/ serial_putc(char);
void startup(void) {
  int count = 0;
  rcc_init();
  serial_init();
  led_init(13);
  for (;;) {
    if ((++count % 16) == 0)
      led_show();
    serial_putc('a');
    serial_putc('A');
    delay();
  }
}


x86 assembly (clang, -O0):
<startup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rcc_init@plt>
mov    $0x0,%al
call   1080 <serial_init@plt>
mov    $0xd,%edi
call   1050 <led_init@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a8 <startup+0x48>
mov    $0x0,%al
call   1070 <led_show@plt>
mov    $0x61,%edi
call   1040 <serial_putc@plt>
mov    $0x41,%edi
call   1040 <serial_putc@plt>
mov    $0x0,%al
call   1060 <delay@plt>
jmp    1187 <startup+0x27>

x86 assembly (clang, -O2):
<startup>:
push   %rbx
xor    %eax,%eax
call   1030 <rcc_init@plt>
xor    %eax,%eax
call   1080 <serial_init@plt>
mov    $0xd,%edi
call   1050 <led_init@plt>
mov    $0x1,%ebx
jmp    119e <startup+0x3e>
mov    $0x61,%edi
call   1040 <serial_putc@plt>
mov    $0x41,%edi
call   1040 <serial_putc@plt>
xor    %eax,%eax
call   1060 <delay@plt>
add    $0x1,%ebx
test   $0xf,%bl
jne    1180 <startup+0x20>
xor    %eax,%eax
call   1070 <led_show@plt>
jmp    1180 <startup+0x20>

LLVM IR (-O0):
define void @startup() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @rcc_init()
%3 = call i32 (...) @serial_init()
%4 = call i32 @led_init(i32 13)
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1
%8 = srem i32 %7, 16
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 (...) @led_show()
br label %12
12: ; preds = %10, %5
%13 = call i32 @serial_putc(i8 signext 97)
%14 = call i32 @serial_putc(i8 signext 65)
%15 = call i32 (...) @delay()
br label %5
}

LLVM IR (-O2):
define void @startup() {
%1 = tail call i32 (...) @rcc_init()
%2 = tail call i32 (...) @serial_init()
%3 = tail call i32 @led_init(i32 13)
br label %4
4: ; preds = %11, %0
%5 = phi i32 [ 0, %0 ], [ %6, %11 ]
%6 = add nuw nsw i32 %5, 1
%7 = and i32 %6, 15
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 (...) @led_show()
br label %11
11: ; preds = %9, %4
%12 = tail call i32 @serial_putc(i8 signext 97)
%13 = tail call i32 @serial_putc(i8 signext 65)
%14 = tail call i32 (...) @delay()
br label %4
}
/* Variables and functions */
char *Z_Malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *Q_CopyString(const char *in) {
  char *out;
  out = Z_Malloc(strlen(in) + 1);
  strcpy(out, in);
  return out;
}


x86 assembly (clang, -O0):
<Q_CopyString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <Z_Malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_CopyString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <Z_Malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @Q_CopyString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @Z_Malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @Q_CopyString(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @Z_Malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ Cleanup();
int /*<<< orphan*/ exit(int);
void Fatal(void) {
  Cleanup();
  exit(1);
}


x86 assembly (clang, -O0):
<Fatal>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Cleanup@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Fatal>:
push   %rax
xor    %eax,%eax
call   1030 <Cleanup@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @Fatal() {
%1 = call i32 (...) @Cleanup()
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @Fatal() {
%1 = tail call i32 (...) @Cleanup()
%2 = tail call i32 @exit(i32 1)
unreachable
}
unsigned int four2int(unsigned char *p) {
  return p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
}


x86 assembly (clang, -O0):
<four2int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @four2int(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void smpte_fec_set_pt_recovery(uint8_t *p_fec, uint8_t pt_recovery) {
  p_fec[4] |= pt_recovery & 0x7f;
}


x86 assembly (clang, -O0):
<smpte_fec_set_pt_recovery>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0x7f,%ecx
mov    -0x8(%rbp),%rax
or     0x10(%rax),%ecx
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_fec_set_pt_recovery>:
and    $0x7f,%esi
or     %esi,0x10(%rdi)
ret

LLVM IR (-O0):
define void @smpte_fec_set_pt_recovery(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 127
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 4
%9 = load i32, i32* %8
%10 = or i32 %9, %6
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @smpte_fec_set_pt_recovery(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 127
%4 = getelementptr inbounds i32, i32* %0, i64 4
%5 = load i32, i32* %4
%6 = or i32 %5, %3
store i32 %6, i32* %4
ret void
}
/* Variables and functions */
char getchar();
char read_opt() {
  char c = getchar();
  if (c != '\n') {
    while (getchar() != '\n')
      ;
  }
  return c;
}


x86 assembly (clang, -O0):
<read_opt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     1151 <read_opt+0x41>
jmp    1134 <read_opt+0x24>
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     114c <read_opt+0x3c>
jmp    1134 <read_opt+0x24>
jmp    1151 <read_opt+0x41>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_opt>:
push   %rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebx
cmp    $0xa,%al
je     112b <read_opt+0x1b>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <read_opt+0x10>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define signext i8 @read_opt() {
%1 = tail call signext i8 (...) @getchar()
%2 = icmp eq i8 %1, 10
br i1 %2, label %6, label %3
3: ; preds = %0, %3
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %6, label %3
6: ; preds = %3, %0
ret i8 %1
}
__attribute__((noipa)) void init(char *d, const char *s) {
  __builtin_strcpy(d, s);
}


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

x86 assembly (clang, -O2):
<init>:
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define void @init(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @strcpy(i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
define void @init(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret void
}
void BN_GF2m_mod_solve_quad_arr(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_GF2m_mod_solve_quad_arr() {
ret void
}
void foo804(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo804(i32 %0) {
ret void
}
/* Variables and functions */
int strcoll(char *, char *);
int qdirentcoll(char **d1, char **d2) { return strcoll(*d1, *d2); }


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

x86 assembly (clang, -O2):
<qdirentcoll>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcoll@plt>

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

LLVM IR (-O2):
define i32 @qdirentcoll(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcoll(i8* %3, i8* %4)
ret i32 %5
}
void handle_WINCH(sig) int sig;
{}


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

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

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

LLVM IR (-O2):
define void @handle_WINCH(i32 %0) {
ret void
}
double Dmul(double x, double y) { return x * y; }


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

x86 assembly (clang, -O2):
<Dmul>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @Dmul(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @Dmul(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ generate_gold_codes();
int /*<<< orphan*/ generate_gold_codes_32_cycles();
void gold_code_startup(void) {
  generate_gold_codes();
  generate_gold_codes_32_cycles();
}


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

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

LLVM IR (-O0):
define void @gold_code_startup() {
%1 = call i32 (...) @generate_gold_codes()
%2 = call i32 (...) @generate_gold_codes_32_cycles()
ret void
}

LLVM IR (-O2):
define void @gold_code_startup() {
%1 = tail call i32 (...) @generate_gold_codes()
%2 = tail call i32 (...) @generate_gold_codes_32_cycles()
ret void
}
/* Variables and functions */
float log1pf(double);
float testf(float __x) { return log1pf(1.0); }


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

x86 assembly (clang, -O2):
<testf>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <log1pf@plt>

LLVM IR (-O0):
define float @testf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = call float @log1pf(double 1.000000e+00)
ret float %3
}

LLVM IR (-O2):
define float @testf(float %0) {
%2 = tail call float @log1pf(double 1.000000e+00)
ret float %2
}
int main() {
  int a = 5;
  int *pa1 = &a;
  int *pa2 = &a;
  pa1 = pa1 + 2;
  pa1 = pa1 - 1;
  pa1 = pa1 - 1;
  return *pa1 == *pa2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
store i32 5, i32* %2
store i32* %2, i32** %3
store i32* %2, i32** %4
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 2
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 -1
store i32* %8, i32** %3
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 -1
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = icmp eq i32 %12, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ fenv_t;

/* Variables and functions */
int /*<<< orphan*/ fesetenv(int /*<<< orphan*/ *);
void uninitvar_fesetenv(void) {
  fenv_t *envp;
  (void)fesetenv(envp);
}


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

x86 assembly (clang, -O2):
<uninitvar_fesetenv>:
jmp    1030 <fesetenv@plt>

LLVM IR (-O0):
define void @uninitvar_fesetenv() {
%1 = alloca i32*
%2 = load i32*, i32** %1
%3 = call i32 @fesetenv(i32* %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_fesetenv() {
%1 = tail call i32 @fesetenv(i32* undef)
ret void
}
int main(argc, argv, envp)
int argc;
char *argv[], **envp;
{
  int i;
  unsigned long myparms[10];
  asm("    .global "
      "fast_tracepoint_loc"
      "\n"
      "fast_tracepoint_loc"
      ":\n"
      "    call "
      "x86_trace_dummy"
      "\n");
  begin();
  for (i = 0; i < sizeof(myparms) / sizeof(myparms[0]); i++)
    myparms[i] = i;
  gdb_c_test(&myparms[0]);
  end();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca [10 x i64]
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = call i32 (...) @begin()
store i32 0, i32* %8
br label %11
11: ; preds = %21, %3
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = icmp ult i64 %13, 10
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i64], [10 x i64]* %9, i64 0, i64 %19
store i64 %17, i64* %20
br label %21
21: ; preds = %15
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %11
24: ; preds = %11
%25 = getelementptr inbounds [10 x i64], [10 x i64]* %9, i64 0, i64 0
%26 = call i32 (i64*, ...) bitcast (i32 (...)* @gdb_c_test to i32 (i64*, ...)*)(i64* %25)
%27 = call i32 (...) @end()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [10 x i64]
%5 = bitcast [10 x i64]* %4 to i8*
tail call void asm sideeffect " .global fast_tracepoint_loc\0Afast_tracepoint_loc:\0A call x86_trace_dummy\0A", "~{dirflag},~{fpsr},~{flags}"()
%6 = tail call i32 (...) @begin()
%7 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 0
%8 = bitcast [10 x i64]* %4 to <2 x i64>*
store <2 x i64> <i64 0, i64 1>, <2 x i64>* %8
%9 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 2
%10 = bitcast i64* %9 to <2 x i64>*
store <2 x i64> <i64 2, i64 3>, <2 x i64>* %10
%11 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 4
%12 = bitcast i64* %11 to <2 x i64>*
store <2 x i64> <i64 4, i64 5>, <2 x i64>* %12
%13 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 6
%14 = bitcast i64* %13 to <2 x i64>*
store <2 x i64> <i64 6, i64 7>, <2 x i64>* %14
%15 = getelementptr inbounds [10 x i64], [10 x i64]* %4, i64 0, i64 8
%16 = bitcast i64* %15 to <2 x i64>*
store <2 x i64> <i64 8, i64 9>, <2 x i64>* %16
%17 = call i32 (i64*, ...) bitcast (i32 (...)* @gdb_c_test to i32 (i64*, ...)*)(i64* %7)
%18 = call i32 (...) @end()
ret i32 0
}
int just_copy_half(int *array, int count) {
  int i;
  int another_array[count];
  for (i = 0; i < count; i++) {
    another_array[i] = array[i];
  }
  return 0;
}


x86 assembly (clang, -O0):
<just_copy_half>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116d <just_copy_half+0x6d>
mov    -0x28(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <just_copy_half+0x3d>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @just_copy_half(i32* nocapture readnone %0, i32 %1) {
ret i32 0
}
int read_audio(int line, char *buf, int bytes) { return (-1); }


x86 assembly (clang, -O0):
<read_audio>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @read_audio(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 -1
}

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

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *mp_encode_strl(char *, int);
char *mp_encode_str(char *data, const char *str, uint32_t len) {
  data = mp_encode_strl(data, len);
  memcpy(data, str, len);
  return data + len;
}


x86 assembly (clang, -O0):
<mp_encode_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <mp_encode_strl@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_encode_str>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edx,%esi
call   1040 <mp_encode_strl@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
movslq %ebx,%rax
add    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @mp_encode_str(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %6
%9 = call i8* @mp_encode_strl(i8* %7, i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
ret i8* %17
}

LLVM IR (-O2):
define i8* @mp_encode_str(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @mp_encode_strl(i8* %0, i32 %2)
%5 = tail call i32 @memcpy(i8* %4, i8* %1, i32 %2)
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
ret i8* %7
}
delay(void) {
  volatile int i = 10;
  while (i--)
    ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1124 <delay+0x24>
jmp    110b <delay+0xb>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
movl   $0xa,-0x4(%rsp)
nopl   0x0(%rax,%rax,1)
subl   $0x1,-0x4(%rsp)
jae    1110 <delay+0x10>
ret

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

LLVM IR (-O2):
define i32 @delay() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 10, i32* %1
br label %3
3: ; preds = %3, %0
%4 = load volatile i32, i32* %1
%5 = add nsw i32 %4, -1
store volatile i32 %5, i32* %1
%6 = icmp eq i32 %4, 0
br i1 %6, label %7, label %3
7: ; preds = %3
ret i32 undef
}
void SdaOut(void) {}


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

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

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

LLVM IR (-O2):
define void @SdaOut() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_ret_subcall(char *that) { printf("should be print before\n"); }


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"should be print before\0A\00"
define void @test_ret_subcall(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"should be print before\00"
define void @test_ret_subcall(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int *malloc(int);
int *f3() {
  static int *p = 0;
  p = malloc(12);
  return p;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,0x2f0b(%rip)
mov    0x2f04(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
push   %rax
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,0x2f0e(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@f3.p = internal global i32* null
define i32* @f3() {
%1 = call i32* @malloc(i32 12)
store i32* %1, i32** @f3.p
%2 = load i32*, i32** @f3.p
ret i32* %2
}

LLVM IR (-O2):
@f3.p = internal unnamed_addr global i32* null
define i32* @f3() {
%1 = tail call i32* @malloc(i32 12)
store i32* %1, i32** @f3.p
ret i32* %1
}
int helper(int e, int p) {
  int res = 1;
  e = e % 1337;
  while (p > 0) {
    if (p % 2 == 1) {
      res = ((res * e) % 1337);
    }
    p >>= 1;
    e = ((e * e) % 1337);
  }
  return res;
}


x86 assembly (clang, -O0):
<helper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x539,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    116f <helper+0x6f>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    114f <helper+0x4f>
mov    -0xc(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    $0x539,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    $0x539,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    111f <helper+0x1f>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<helper>:
mov    $0x1,%eax
test   %esi,%esi
jg     111e <helper+0x1e>
ret
nopw   0x0(%rax,%rax,1)
mov    %esi,%ecx
shr    %ecx
imul   %edi,%edi
cmp    $0x1,%esi
mov    %ecx,%esi
jbe    1109 <helper+0x9>
movslq %edi,%rdi
imul   $0x6208cecb,%rdi,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x29,%rcx
add    %edx,%ecx
imul   $0x539,%ecx,%ecx
sub    %ecx,%edi
test   $0x1,%sil
je     1110 <helper+0x10>
imul   %edi,%eax
cltq
imul   $0x6208cecb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x29,%rcx
add    %edx,%ecx
imul   $0x539,%ecx,%ecx
sub    %ecx,%eax
jmp    1110 <helper+0x10>

LLVM IR (-O0):
define i32 @helper(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
%6 = load i32, i32* %3
%7 = srem i32 %6, 1337
store i32 %7, i32* %3
br label %8
8: ; preds = %20, %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %4
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = mul nsw i32 %16, %17
%19 = srem i32 %18, 1337
store i32 %19, i32* %5
br label %20
20: ; preds = %15, %11
%21 = load i32, i32* %4
%22 = ashr i32 %21, 1
store i32 %22, i32* %4
%23 = load i32, i32* %3
%24 = load i32, i32* %3
%25 = mul nsw i32 %23, %24
%26 = srem i32 %25, 1337
store i32 %26, i32* %3
br label %8
27: ; preds = %8
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
define i32 @helper(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %19
4: ; preds = %2, %14
%5 = phi i32 [ %17, %14 ], [ %0, %2 ]
%6 = phi i32 [ %15, %14 ], [ 1, %2 ]
%7 = phi i32 [ %16, %14 ], [ %1, %2 ]
%8 = srem i32 %5, 1337
%9 = and i32 %7, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %4
%12 = mul nsw i32 %6, %8
%13 = srem i32 %12, 1337
br label %14
14: ; preds = %11, %4
%15 = phi i32 [ %13, %11 ], [ %6, %4 ]
%16 = lshr i32 %7, 1
%17 = mul nsw i32 %8, %8
%18 = icmp ult i32 %7, 2
br i1 %18, label %19, label %4
19: ; preds = %14, %2
%20 = phi i32 [ 1, %2 ], [ %15, %14 ]
ret i32 %20
}
void posix_class_neg2NP_ASCII() {}


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

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

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

LLVM IR (-O2):
define void @posix_class_neg2NP_ASCII() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main() {
  printf("Hello\n");
  sleep(5);
  printf("Don't run random binaries!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Hello\0A\00"
@.str.1 = [28 x i8] c"Don't run random binaries!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @sleep(i32 5)
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
@str.2 = [27 x i8] c"Don't run random binaries!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @sleep(i32 5)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void mono_cross_helpers_run(void) {}


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

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

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

LLVM IR (-O2):
define void @mono_cross_helpers_run() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int *, int /*<<< orphan*/);
int /*<<< orphan*/ waitpid_err(int /*<<< orphan*/ const, int);
void reap_sync(pid_t pid) {
  int status;
  const pid_t cpid = waitpid(pid, &status, 0);
  waitpid_err(cpid, status);
}


x86 assembly (clang, -O0):
<reap_sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <waitpid_err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reap_sync>:
push   %rax
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
mov    0x4(%rsp),%esi
mov    %eax,%edi
call   1030 <waitpid_err@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @reap_sync(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @waitpid(i32 %5, i32* %3, i32 0)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = call i32 @waitpid_err(i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @reap_sync(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @waitpid(i32 %0, i32* %2, i32 0)
%5 = load i32, i32* %2
%6 = call i32 @waitpid_err(i32 %4, i32 %5)
ret void
}
/* Type definitions */
typedef int uint16_t;
typedef int /*<<< orphan*/ in;

/* Variables and functions */
uint16_t TO_LE16(uint16_t in) {
  uint16_t out = 0;
  unsigned char *pout = (unsigned char *)&out;
  int i;
  for (i = 0; i < sizeof(in); ++i, in >>= 8)
    pout[i] = in & 0xff;
  return out;
}


x86 assembly (clang, -O0):
<TO_LE16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x4,%rax
jae    1157 <TO_LE16+0x57>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    111d <TO_LE16+0x1d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @TO_LE16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%6 = bitcast i32* %3 to i8*
store i8* %6, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %19, %1
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = icmp ult i64 %9, 4
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i32, i32* %2
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 %14, i8* %18
br label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
%22 = load i32, i32* %2
%23 = ashr i32 %22, 8
store i32 %23, i32* %2
br label %7
24: ; preds = %7
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @TO_LE16(i32 %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isascii(int);
void t_isascii_0x7a() {
  Assert_real((isascii(122)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              615, ("isascii should be 1 for z"));
}


x86 assembly (clang, -O0):
<t_isascii_0x7a>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7a,%edi
call   1030 <isascii@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x267,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x7a>:
lea    0xee9(%rip),%rsi
lea    0xf8a(%rip),%rcx
mov    $0x1,%edi
mov    $0x267,%edx
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for z\00"
define void @t_isascii_0x7a() {
%1 = call i32 @isascii(i32 122)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 615, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for z\00"
define void @t_isascii_0x7a() {
%1 = tail call i32 @Assert_real(i32 1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 615, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void my_C110_kernel_hal_dummy_function(void) {}


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

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

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

LLVM IR (-O2):
define void @my_C110_kernel_hal_dummy_function() {
ret void
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int _NSIG;
int __rt_sigaction(int, struct sigaction const *, struct sigaction *, int);
int __libc_sigaction(int signum, const struct sigaction *act,
                     struct sigaction *oldact) {
  return __rt_sigaction(signum, act, oldact, _NSIG / 8);
}


x86 assembly (clang, -O0):
<__libc_sigaction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
call   1030 <__rt_sigaction@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_sigaction>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x3,%ecx
jmp    1030 <__rt_sigaction@plt>

LLVM IR (-O0):
%struct.sigaction = type { i32 }
@_NSIG = global i32 0
define i32 @__libc_sigaction(i32 %0, %struct.sigaction* %1, %struct.sigaction* %2) {
%4 = alloca i32
%5 = alloca %struct.sigaction*
%6 = alloca %struct.sigaction*
store i32 %0, i32* %4
store %struct.sigaction* %1, %struct.sigaction** %5
store %struct.sigaction* %2, %struct.sigaction** %6
%7 = load i32, i32* %4
%8 = load %struct.sigaction*, %struct.sigaction** %5
%9 = load %struct.sigaction*, %struct.sigaction** %6
%10 = load i32, i32* @_NSIG
%11 = sdiv i32 %10, 8
%12 = call i32 @__rt_sigaction(i32 %7, %struct.sigaction* %8, %struct.sigaction* %9, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
@_NSIG = global i32 0
define i32 @__libc_sigaction(i32 %0, %struct.sigaction* %1, %struct.sigaction* %2) {
%4 = load i32, i32* @_NSIG
%5 = sdiv i32 %4, 8
%6 = tail call i32 @__rt_sigaction(i32 %0, %struct.sigaction* %1, %struct.sigaction* %2, i32 %5)
ret i32 %6
}
void RTFileCopy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTFileCopy() {
ret void
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ killtree(scalar_t__);
scalar_t__ pid_get_parent(scalar_t__);
void killtree_pid_fs_scan(pid_t pid, void *data) {
  pid_t parent_pid = *(pid_t *)data;
  if (pid_get_parent(pid) != parent_pid)
    return;
  killtree(pid);
}


x86 assembly (clang, -O0):
<killtree_pid_fs_scan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pid_get_parent@plt>
cmp    -0x18(%rbp),%rax
je     1153 <killtree_pid_fs_scan+0x33>
jmp    115c <killtree_pid_fs_scan+0x3c>
mov    -0x8(%rbp),%rdi
call   1040 <killtree@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<killtree_pid_fs_scan>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rsi),%r14
call   1030 <pid_get_parent@plt>
cmp    %r14,%rax
jne    1143 <killtree_pid_fs_scan+0x23>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <killtree@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @killtree_pid_fs_scan(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i64*
%8 = load i64, i64* %7
store i64 %8, i64* %5
%9 = load i64, i64* %3
%10 = call i64 @pid_get_parent(i64 %9)
%11 = load i64, i64* %5
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
br label %17
14: ; preds = %2
%15 = load i64, i64* %3
%16 = call i32 @killtree(i64 %15)
br label %17
17: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
define void @killtree_pid_fs_scan(i64 %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i64*
%4 = load i64, i64* %3
%5 = tail call i64 @pid_get_parent(i64 %0)
%6 = icmp eq i64 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @killtree(i64 %0)
br label %9
9: ; preds = %2, %7
ret void
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int compare(const void *a, const void *b) {
  uint64_t x = *(uint64_t *)a;
  uint64_t y = *(uint64_t *)b;
  if (x < y)
    return -1;
  if (x == y)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113c <compare+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <compare+0x5d>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1156 <compare+0x56>
movl   $0x0,-0x4(%rbp)
jmp    115d <compare+0x5d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setne  %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i64*
%10 = load i64, i64* %9
store i64 %10, i64* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i64*
%13 = load i64, i64* %12
store i64 %13, i64* %7
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load i64, i64* %6
%20 = load i64, i64* %7
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %3
br label %24
23: ; preds = %18
store i32 1, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp slt i64 %4, %6
%8 = icmp ne i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pdie(char *);
void *alloc(int size) {
  void *this;
  if ((this = malloc(size)) == NULL)
    pdie("Out of memory");
  memset(this, 0, size);
  return this;
}


x86 assembly (clang, -O0):
<alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    115d <alloc+0x2d>
lea    0xea8(%rip),%rdi
call   1030 <pdie@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114e <alloc+0x1e>
lea    0xeb7(%rip),%rdi
call   1030 <pdie@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
define i8* @alloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @pdie(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
%11 = load i32, i32* %2
%12 = call i32 @memset(i8* %10, i32 0, i32 %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
define i8* @alloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @pdie(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @memset(i8* %2, i32 0, i32 %0)
ret i8* %2
}