xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ addscore(int, int);
void scorebonus(int n) { addscore(n, 1000); }


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

x86 assembly (clang, -O2):
<scorebonus>:
mov    $0x3e8,%esi
jmp    1030 <addscore@plt>

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

LLVM IR (-O2):
define void @scorebonus(i32 %0) {
%2 = tail call i32 @addscore(i32 %0, i32 1000)
ret void
}
void ft_strclr(char *s) {
  int i;
  i = 0;
  while (*(s + (i++)))
    *(s + i) = '\0';
}


x86 assembly (clang, -O0):
<ft_strclr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     113c <ft_strclr+0x3c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    110f <ft_strclr+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strclr>:
cmpb   $0x0,(%rdi)
je     1109 <ft_strclr+0x9>
movb   $0x0,0x1(%rdi)
ret

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

LLVM IR (-O2):
define void @ft_strclr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 0, i8* %5
br label %6
6: ; preds = %4, %1
ret void
}
unsigned int _uint(unsigned int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @_uint(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ draw_hand(int *, int *);
int /*<<< orphan*/ init_deck(int *);
int is_four_suits(int *);
int test_one_hand() {
  int deck[52];
  int hand[4];
  init_deck(deck);
  draw_hand(deck, hand);
  return is_four_suits(hand);
}


x86 assembly (clang, -O0):
<test_one_hand>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    -0xd0(%rbp),%rdi
call   1030 <init_deck@plt>
lea    -0xd0(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <draw_hand@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <is_four_suits@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_one_hand>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <init_deck@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <draw_hand@plt>
mov    %r14,%rdi
call   1050 <is_four_suits@plt>
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @test_one_hand() {
%1 = alloca [52 x i32]
%2 = alloca [4 x i32]
%3 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 0
%4 = call i32 @init_deck(i32* %3)
%5 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%7 = call i32 @draw_hand(i32* %5, i32* %6)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%9 = call i32 @is_four_suits(i32* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_one_hand() {
%1 = alloca [52 x i32]
%2 = alloca [4 x i32]
%3 = bitcast [52 x i32]* %1 to i8*
%4 = bitcast [4 x i32]* %2 to i8*
%5 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 0
%6 = call i32 @init_deck(i32* %5)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%8 = call i32 @draw_hand(i32* %5, i32* %7)
%9 = call i32 @is_four_suits(i32* %7)
ret i32 %9
}
void cm17a_close_device(fd) { close(fd); }


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

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

LLVM IR (-O0):
define void @cm17a_close_device(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %3)
ret void
}

LLVM IR (-O2):
define void @cm17a_close_device(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *calloc(int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  time_t begin, end;
  long i;
  char *c = calloc(1000000000, sizeof(char));
  c[0] = 0;
  while (1) {
    begin = time(NULL);
    for (i = 0; i < 1000000000; i++) {
      c[i] = 0;
    }
    end = time(NULL);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3b9aca00,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x3b9aca00,-0x18(%rbp)
3b
jge    1188 <main+0x68>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115d <main+0x3d>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
jmp    1149 <main+0x29>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1030 <time@plt>
xor    %edi,%edi
call   1030 <time@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i8* @calloc(i32 1000000000, i32 1)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 0, i8* %8
br label %9
9: ; preds = %0, %21
%10 = call i32 @time(i32* null)
store i32 %10, i32* %2
store i64 0, i64* %4
br label %11
11: ; preds = %18, %9
%12 = load i64, i64* %4
%13 = icmp slt i64 %12, 1000000000
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i8*, i8** %5
%16 = load i64, i64* %4
%17 = getelementptr inbounds i8, i8* %15, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %14
%19 = load i64, i64* %4
%20 = add nsw i64 %19, 1
store i64 %20, i64* %4
br label %11
21: ; preds = %11
%22 = call i32 @time(i32* null)
store i32 %22, i32* %3
br label %9
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @time(i32* null)
br label %1
}
/* Type definitions */
typedef scalar_t__ const uint16_t;

/* Variables and functions */
const uint16_t *find_uint16_t(const uint16_t *it, const uint16_t *end,
                              uint16_t val) {
  while (it != end) {
    if (*it == val)
      return it;
    ++it;
  }
  return 0;
}


x86 assembly (clang, -O0):
<find_uint16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     114d <find_uint16_t+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
jne    113c <find_uint16_t+0x3c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1155 <find_uint16_t+0x55>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <find_uint16_t+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_uint16_t>:
cmp    %rsi,%rdi
je     111e <find_uint16_t+0x1e>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %rdx,(%rax)
je     1120 <find_uint16_t+0x20>
add    $0x8,%rax
cmp    %rsi,%rax
jne    1110 <find_uint16_t+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64* @find_uint16_t(i64* %0, i64* readnone %1, i64 %2) {
%4 = icmp eq i64* %0, %1
br i1 %4, label %12, label %5
5: ; preds = %3, %9
%6 = phi i64* [ %10, %9 ], [ %0, %3 ]
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, %2
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = getelementptr inbounds i64, i64* %6, i64 1
%11 = icmp eq i64* %10, %1
br i1 %11, label %12, label %5
12: ; preds = %5, %9, %3
%13 = phi i64* [ null, %3 ], [ null, %9 ], [ %6, %5 ]
ret i64* %13
}
/* Variables and functions */
int amsp_coord_rect2spheric(double *, double const *);
int amsp_coord_rect2ecliptic(double out[3], double const r[3]) {
  return amsp_coord_rect2spheric(out, r);
}


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

x86 assembly (clang, -O2):
<amsp_coord_rect2ecliptic>:
jmp    1030 <amsp_coord_rect2spheric@plt>

LLVM IR (-O0):
define i32 @amsp_coord_rect2ecliptic(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 = call i32 @amsp_coord_rect2spheric(double* %5, double* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @amsp_coord_rect2ecliptic(double* %0, double* %1) {
%3 = tail call i32 @amsp_coord_rect2spheric(double* %0, double* %1)
ret i32 %3
}
long long load64_reverse_2(long long *p) { return __builtin_bswap64(p[1]); }


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

x86 assembly (clang, -O2):
<load64_reverse_2>:
mov    0x8(%rdi),%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @load64_reverse_2(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 1
%5 = load i64, i64* %4
%6 = call i64 @llvm.bswap.i64(i64 %5)
ret i64 %6
}

LLVM IR (-O2):
define i64 @load64_reverse_2(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 1
%3 = load i64, i64* %2
%4 = tail call i64 @llvm.bswap.i64(i64 %3)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void nospace(void) {
  (void)fprintf(stderr, "mrcp: out of memory.\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"mrcp: out of memory.\0A\00"
define void @nospace() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"mrcp: out of memory.\0A\00"
define void @nospace() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char const *stbi_failure_reason();
const char *image_error(void) { return stbi_failure_reason(); }


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

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

LLVM IR (-O0):
define i8* @image_error() {
%1 = call i8* (...) @stbi_failure_reason()
ret i8* %1
}

LLVM IR (-O2):
define i8* @image_error() {
%1 = tail call i8* (...) @stbi_failure_reason()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ nondet_log_destroy();
void nondet_destroy() { nondet_log_destroy(); }


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

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

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

LLVM IR (-O2):
define void @nondet_destroy() {
%1 = tail call i32 (...) @nondet_log_destroy()
ret void
}
void slip_send_packet(char *p, int len) {
  (192);
  while (len--) {
    switch (*p) {
    case 192:
      (219);
      (220);
      break;
    case 219:
      (219);
      (221);
      break;
    default:
      (*p);
    }
    p++;
  }
  (192);
}


x86 assembly (clang, -O0):
<slip_send_packet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1167 <slip_send_packet+0x67>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x10(%rbp)
sub    $0xc0,%eax
je     114c <slip_send_packet+0x4c>
jmp    1139 <slip_send_packet+0x39>
mov    -0x10(%rbp),%eax
sub    $0xdb,%eax
je     1151 <slip_send_packet+0x51>
jmp    1156 <slip_send_packet+0x56>
jmp    1156 <slip_send_packet+0x56>
jmp    1156 <slip_send_packet+0x56>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110b <slip_send_packet+0xb>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @slip_send_packet(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %18, %2
%6 = load i32, i32* %4
%7 = add nsw i32 %6, -1
store i32 %7, i32* %4
%8 = icmp ne i32 %6, 0
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %15 [
i32 192, label %13
i32 219, label %14
]
13: ; preds = %9
br label %18
14: ; preds = %9
br label %18
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
br label %18
18: ; preds = %15, %14, %13
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %5
21: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @slip_send_packet(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_sandbox_android_untrusted_app();
int /*<<< orphan*/ use_temporary_dir();
int main() {
  use_temporary_dir();
  do_sandbox_android_untrusted_app();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <use_temporary_dir@plt>
mov    $0x0,%al
call   1040 <do_sandbox_android_untrusted_app@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @use_temporary_dir()
%2 = call i32 (...) @do_sandbox_android_untrusted_app()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @use_temporary_dir()
%2 = tail call i32 (...) @do_sandbox_android_untrusted_app()
ret i32 0
}
long dec2bin(int decimal) {
  long binary = 0, i = 1;
  while (decimal != 0) {
    binary += i * (decimal % 2);
    decimal /= 2;
    i *= 10;
  }
  return binary;
}


x86 assembly (clang, -O0):
<dec2bin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1163 <dec2bin+0x63>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
movslq %edx,%rcx
imul   %rcx,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
imul   $0xa,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <dec2bin+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec2bin>:
test   %edi,%edi
je     113f <dec2bin+0x3f>
mov    $0x1,%ecx
xor    %eax,%eax
mov    %edi,%edx
nopl   (%rax)
shr    $0x1f,%edx
add    %edi,%edx
mov    %edx,%r8d
and    $0xfffffffe,%r8d
mov    %edi,%esi
sub    %r8d,%esi
movslq %esi,%rsi
imul   %rcx,%rsi
add    %rsi,%rax
sar    %edx
add    %rcx,%rcx
lea    (%rcx,%rcx,4),%rcx
add    $0x1,%edi
cmp    $0x2,%edi
mov    %edx,%edi
ja     1110 <dec2bin+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @dec2bin(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %15, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %12, %3 ], [ 1, %1 ]
%5 = phi i64 [ %10, %3 ], [ 0, %1 ]
%6 = phi i32 [ %11, %3 ], [ %0, %1 ]
%7 = srem i32 %6, 2
%8 = sext i32 %7 to i64
%9 = mul nsw i64 %4, %8
%10 = add nsw i64 %9, %5
%11 = sdiv i32 %6, 2
%12 = mul nsw i64 %4, 10
%13 = add i32 %6, 1
%14 = icmp ult i32 %13, 3
br i1 %14, label %15, label %3
15: ; preds = %3, %1
%16 = phi i64 [ 0, %1 ], [ %10, %3 ]
ret i64 %16
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void json_error(const char *err) { fprintf(stderr, "%s\n", err); }


x86 assembly (clang, -O0):
<json_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @json_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @json_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct stemmer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct stemmer *);
extern void free_stemmer(struct stemmer *z) { free(z); }


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

x86 assembly (clang, -O2):
<free_stemmer>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.stemmer = type { i32 }
define void @free_stemmer(%struct.stemmer* nocapture %0) {
%2 = tail call i32 @free(%struct.stemmer* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *xmalloc(size_t);
char *xstrdup(const char *str) {
  size_t n = strlen(str) + 1;
  char *copy = xmalloc(n);
  memcpy(copy, str, n);
  return copy;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1040 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = call i8* @xmalloc(i64 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = load i64, i64* %3
%14 = call i32 @memcpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @xmalloc(i64 %4)
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
ret i8* %5
}
/* Type definitions */
struct String {
  int dummy;
};

/* Variables and functions */
struct String *PRStringConstructorCStr(char *);
struct String *PRStringConstructorVoid() {
  ;
  return PRStringConstructorCStr("");
}


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

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

LLVM IR (-O0):
%struct.String = type { i32 }
@.str = [1 x i8] zeroinitializer
define %struct.String* @PRStringConstructorVoid() {
%1 = call %struct.String* @PRStringConstructorCStr(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret %struct.String* %1
}

LLVM IR (-O2):
%struct.String = type { i32 }
@.str = [1 x i8] zeroinitializer
define %struct.String* @PRStringConstructorVoid() {
%1 = tail call %struct.String* @PRStringConstructorCStr(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret %struct.String* %1
}
void diff_2d(double *out, double *a, double *b) {
  *(out++) = *(a++) + *(b++);
  *(out) = *(a) + *(b);
}


x86 assembly (clang, -O0):
<diff_2d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff_2d>:
movsd  (%rsi),%xmm0
addsd  (%rdx),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rsi),%xmm0
addsd  0x8(%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @diff_2d(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %5
%8 = getelementptr inbounds double, double* %7, i32 1
store double* %8, double** %5
%9 = load double, double* %7
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i32 1
store double* %11, double** %6
%12 = load double, double* %10
%13 = fadd double %9, %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i32 1
store double* %15, double** %4
store double %13, double* %14
%16 = load double*, double** %5
%17 = load double, double* %16
%18 = load double*, double** %6
%19 = load double, double* %18
%20 = fadd double %17, %19
%21 = load double*, double** %4
store double %20, double* %21
ret void
}

LLVM IR (-O2):
define void @diff_2d(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %1
%6 = getelementptr inbounds double, double* %2, i64 1
%7 = load double, double* %2
%8 = fadd double %5, %7
%9 = getelementptr inbounds double, double* %0, i64 1
store double %8, double* %0
%10 = load double, double* %4
%11 = load double, double* %6
%12 = fadd double %10, %11
store double %12, double* %9
ret void
}
/* Variables and functions */
unsigned char mmio_read(int);
unsigned char uart_getc() {
  while (mmio_read((0x20201000 + 0x18)) & (1 << 4)) {
  }
  return mmio_read((0x20201000 + 0x00));
}


x86 assembly (clang, -O0):
<uart_getc>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <uart_getc+0x9>
mov    $0x20201018,%edi
call   1030 <mmio_read@plt>
movzbl %al,%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1137 <uart_getc+0x27>
jmp    1119 <uart_getc+0x9>
mov    $0x20201000,%edi
call   1030 <mmio_read@plt>
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_getc>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20201018,%edi
call   1030 <mmio_read@plt>
test   $0x10,%al
jne    1120 <uart_getc+0x10>
mov    $0x20201000,%edi
pop    %rax
jmp    1030 <mmio_read@plt>

LLVM IR (-O0):
define zeroext i8 @uart_getc() {
br label %1
1: ; preds = %6, %0
%2 = call zeroext i8 @mmio_read(i32 538972184)
%3 = zext i8 %2 to i32
%4 = and i32 %3, 16
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %1
7: ; preds = %1
%8 = call zeroext i8 @mmio_read(i32 538972160)
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @uart_getc() {
br label %1
1: ; preds = %1, %0
%2 = tail call zeroext i8 @mmio_read(i32 538972184)
%3 = and i8 %2, 16
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
%6 = tail call zeroext i8 @mmio_read(i32 538972160)
ret i8 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t HibernateLowBatGet(void) {
  return ((*((volatile uint32_t *)(0x400FC010))) & (0x00006000 | 0x000000A0));
}


x86 assembly (clang, -O0):
<HibernateLowBatGet>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fc010,%eax
mov    (%rax),%eax
and    $0x60a0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateLowBatGet>:
mov    $0x60a0,%eax
and    0x400fc010,%eax
ret

LLVM IR (-O0):
define i32 @HibernateLowBatGet() {
%1 = load volatile i32, i32* inttoptr (i64 1074774032 to i32*)
%2 = and i32 %1, 24736
ret i32 %2
}

LLVM IR (-O2):
define i32 @HibernateLowBatGet() {
%1 = load volatile i32, i32* inttoptr (i64 1074774032 to i32*)
%2 = and i32 %1, 24736
ret i32 %2
}
/* Variables and functions */
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
char gchar() { return (fgetc(stdin)); }


x86 assembly (clang, -O0):
<gchar>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gchar>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fgetc@plt>

LLVM IR (-O0):
@stdin = global i32 0
define signext i8 @gchar() {
%1 = load i32, i32* @stdin
%2 = call signext i8 @fgetc(i32 %1)
ret i8 %2
}

LLVM IR (-O2):
@stdin = global i32 0
define signext i8 @gchar() {
%1 = load i32, i32* @stdin
%2 = tail call signext i8 @fgetc(i32 %1)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ getbyte();
scalar_t__ handle_byte(int /*<<< orphan*/);
int /*<<< orphan*/ sendack();
void tether_loop() {
  sendack();
  while (handle_byte(getbyte()) == 0)
    ;
}


x86 assembly (clang, -O0):
<tether_loop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sendack@plt>
mov    $0x0,%al
call   1040 <getbyte@plt>
mov    %eax,%edi
call   1050 <handle_byte@plt>
cmp    $0x0,%rax
jne    1158 <tether_loop+0x28>
jmp    113b <tether_loop+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tether_loop>:
push   %rax
xor    %eax,%eax
call   1030 <sendack@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getbyte@plt>
mov    %eax,%edi
call   1050 <handle_byte@plt>
test   %rax,%rax
je     1140 <tether_loop+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @tether_loop() {
%1 = call i32 (...) @sendack()
br label %2
2: ; preds = %6, %0
%3 = call i32 (...) @getbyte()
%4 = call i64 @handle_byte(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @tether_loop() {
%1 = tail call i32 (...) @sendack()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @getbyte()
%4 = tail call i64 @handle_byte(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stdout;
void move_cursor_left(int count) {
  char buffer[10];
  memset(buffer, 0, sizeof(buffer));
  sprintf(buffer, "\033[%dD", count);
  fputs(buffer, stdout);
}


x86 assembly (clang, -O0):
<move_cursor_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    -0xe(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea7(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0xe(%rbp),%rdi
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_cursor_left>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0xe(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    0xeac(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1030 <fputs@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%dD\00"
@stdout = global i32 0
define void @move_cursor_left(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 10)
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dD\00"
@stdout = global i32 0
define void @move_cursor_left(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 10)
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = load i32, i32* @stdout
%7 = call i32 @fputs(i8* %3, i32 %6)
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, int);
int wait(int /*<<< orphan*/);
void sigchild(int sig) {
  pid_t pid = wait(0);
  assert(pid != -1);
  printf("Server reaped child %d\n", pid);
}


x86 assembly (clang, -O0):
<sigchild>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1050 <wait@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigchild>:
push   %rbx
xor    %edi,%edi
call   1050 <wait@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   1040 <assert@plt>
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Server reaped child %d\0A\00"
define void @sigchild(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @wait(i32 0)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Server reaped child %d\0A\00"
define void @sigchild(i32 %0) {
%2 = tail call i32 @wait(i32 0)
%3 = icmp ne i32 %2, -1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Const_member() { printf("constmember is under construction"); }


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"constmember is under construction\00"
define void @Const_member() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"constmember is under construction\00"
define void @Const_member() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int creat(const char *pathname, mode_t mode) {
  _exit(-1);
  return -1;
}


x86 assembly (clang, -O0):
<creat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<creat>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @creat(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @_exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define i32 @creat(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @_exit(i32 -1)
unreachable
}
int test_imm_80uint16_mem(unsigned short *val) {
  return ((*val) & (0x80 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_80uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0x80,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_80uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 128
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
void fputc_t() {
  FILE *fp;
  int ch;
  fp = fopen("file.txt", "w+");
  for (ch = 33; ch <= 100; ch++) {
    fputc(ch, fp);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<fputc_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
movl   $0x21,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jg     117a <fputc_t+0x4a>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <fputc@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <fputc_t+0x26>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputc_t>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    $0x21,%ebp
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
jne    1150 <fputc_t+0x20>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [3 x i8] c"w+\00"
define void @fputc_t() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
store i32 33, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 100
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32*, i32** %1
%10 = call i32 @fputc(i32 %8, i32* %9)
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i32*, i32** %1
%16 = call i32 @fclose(i32* %15)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [3 x i8] c"w+\00"
define void @fputc_t() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 33, %0 ], [ %5, %2 ]
%4 = tail call i32 @fputc(i32 %3, i32* %1)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 101
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @fclose(i32* %1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool errata_31(void) {
  if (*(uint32_t *)0x10000130ul == 0xAul) {
    if (*(uint32_t *)0x10000134ul == 0x0ul) {
      return true;
    }
    if (*(uint32_t *)0x10000134ul == 0x1ul) {
      return true;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<errata_31>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000130,%eax
movslq (%rax),%rax
cmp    $0xa,%rax
jne    1157 <errata_31+0x57>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x0,%rax
jne    1134 <errata_31+0x34>
movl   $0x1,-0x4(%rbp)
jmp    115e <errata_31+0x5e>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x1,%rax
jne    1152 <errata_31+0x52>
movl   $0x1,-0x4(%rbp)
jmp    115e <errata_31+0x5e>
jmp    1157 <errata_31+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @errata_31() {
%1 = alloca i32
%2 = load i32, i32* inttoptr (i64 268435760 to i32*)
%3 = sext i32 %2 to i64
%4 = icmp eq i64 %3, 10
br i1 %4, label %5, label %16
5: ; preds = %0
%6 = load i32, i32* inttoptr (i64 268435764 to i32*)
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %1
br label %17
10: ; preds = %5
%11 = load i32, i32* inttoptr (i64 268435764 to i32*)
%12 = sext i32 %11 to i64
%13 = icmp eq i64 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %1
br label %17
15: ; preds = %10
br label %16
16: ; preds = %15, %0
store i32 1, i32* %1
br label %17
17: ; preds = %16, %14, %9
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @errata_31() {
ret i32 1
}
/* Variables and functions */
int f179(int *);
int f180(int *p) { return f179(p); }


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

x86 assembly (clang, -O2):
<f180>:
jmp    1030 <f179@plt>

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

LLVM IR (-O2):
define i32 @f180(i32* %0) {
%2 = tail call i32 @f179(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ delay();
int main() {
  int i = 0;
  volatile unsigned long *gpkcon0 = (volatile unsigned long *)0x7F008800;
  volatile unsigned long *gpkdat = (volatile unsigned long *)0x7F008808;
  *gpkcon0 = 0x11110000;
  i = 0x10;
  while (1) {
    *gpkdat = i;
    i++;
    if (i == 0x100)
      i = 0x10;
    delay();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x7f008800,%eax
mov    %rax,-0x10(%rbp)
mov    $0x7f008808,%eax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x11110000,(%rax)
movl   $0x10,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jne    1172 <main+0x62>
movl   $0x10,-0x8(%rbp)
mov    $0x0,%al
call   1030 <delay@plt>
jmp    114a <main+0x3a>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movq   $0x11110000,0x7f008800
mov    $0x10,%ebp
mov    $0x10,%ebx
nopl   0x0(%rax)
movslq %ebx,%rbx
mov    %rbx,0x7f008808
7f
add    $0x1,%ebx
cmp    $0x100,%ebx
cmove  %ebp,%ebx
xor    %eax,%eax
call   1030 <delay@plt>
jmp    1130 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i64*
store i32 0, i32* %1
store i32 0, i32* %2
store i64* inttoptr (i64 2130741248 to i64*), i64** %3
store i64* inttoptr (i64 2130741256 to i64*), i64** %4
%5 = load i64*, i64** %3
store volatile i64 286326784, i64* %5
store i32 16, i32* %2
br label %6
6: ; preds = %0, %15
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = load i64*, i64** %4
store volatile i64 %8, i64* %9
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 256
br i1 %13, label %14, label %15
14: ; preds = %6
store i32 16, i32* %2
br label %15
15: ; preds = %14, %6
%16 = call i32 (...) @delay()
br label %6
}

LLVM IR (-O2):
define i32 @main() {
store volatile i64 286326784, i64* inttoptr (i64 2130741248 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 16, %0 ], [ %6, %1 ]
%3 = sext i32 %2 to i64
store volatile i64 %3, i64* inttoptr (i64 2130741256 to i64*)
%4 = add nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
%6 = select i1 %5, i32 16, i32 %4
%7 = tail call i32 (...) @delay()
br label %1
}
extern unsigned short ip_compute_csum(unsigned char *buff, int len) {
  return ~from32to16(do_csum(buff, len));
}


x86 assembly (clang, -O0):
<ip_compute_csum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1030 <do_csum@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <from32to16@plt>
xor    $0xffffffff,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_compute_csum>:
push   %rax
xor    %eax,%eax
call   1030 <do_csum@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1040 <from32to16@plt>
not    %eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i16 @ip_compute_csum(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @do_csum to i32 (i8*, i32, ...)*)(i8* %5, i32 %6)
%8 = call i32 (i32, ...) bitcast (i32 (...)* @from32to16 to i32 (i32, ...)*)(i32 %7)
%9 = xor i32 %8, -1
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @ip_compute_csum(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @do_csum to i32 (i8*, i32, ...)*)(i8* %0, i32 %1)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @from32to16 to i32 (i32, ...)*)(i32 %3)
%5 = trunc i32 %4 to i16
%6 = xor i16 %5, -1
ret i16 %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ testWondrous();
int main(int argc, char *argv[]) {
  testWondrous();
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testWondrous()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
XStoreBytes() {}


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

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

LLVM IR (-O0):
define i32 @XStoreBytes() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XStoreBytes() {
ret i32 undef
}