xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int MPI_Rsend(const void *buf, int count, int datatype, int dest, int tag,
              int comm) {
  printf("MPI Stub WARNING: Should not rsend message to self\n");
  return 0;
}


x86 assembly (clang, -O0):
<MPI_Rsend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [52 x i8] c"MPI Stub WARNING: Should not rsend message to self\0A\00"
define i32 @MPI_Rsend(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [51 x i8] c"MPI Stub WARNING: Should not rsend message to self\00"
define i32 @MPI_Rsend(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int ConvertCharToInt(const char input) { return input - '0'; }


x86 assembly (clang, -O0):
<ConvertCharToInt>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertCharToInt>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ConvertCharToInt(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @ConvertCharToInt(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
int write(int, void const *, size_t);
ssize_t io_write(int fd, const void *buffer, size_t len) {
  ssize_t w = write(fd, buffer, len);
  if (w == -1 && errno != EAGAIN)
    return -3;
  return w;
}


x86 assembly (clang, -O0):
<io_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1166 <io_write+0x56>
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
je     1166 <io_write+0x56>
movl   $0xfffffffd,-0x4(%rbp)
jmp    116c <io_write+0x5c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_write>:
push   %rax
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    1136 <io_write+0x26>
mov    0x2ebe(%rip),%rcx
mov    (%rcx),%rdx
mov    0x2ea4(%rip),%rsi
mov    $0xfffffffd,%ecx
cmp    (%rsi),%rdx
jne    1138 <io_write+0x28>
mov    %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
define i32 @io_write(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i64, i64* @errno
%8 = load i64, i64* @EAGAIN
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %6, %3
br label %11
11: ; preds = %6, %10
%12 = phi i32 [ %4, %10 ], [ -3, %6 ]
ret i32 %12
}
/* Type definitions */
typedef size_t int64_t;

/* Variables and functions */
size_t INT64_MAX;
void use_int64_max_Good() {
  char arr[10];
  int64_t x = INT64_MAX;
  int64_t y = INT64_MAX - 5;
  arr[x - y] = 0;
}


x86 assembly (clang, -O0):
<use_int64_max_Good>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ecf(%rip),%rax
mov    (%rax),%rax
sub    $0x5,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
movb   $0x0,-0xa(%rbp,%rax,1)
pop    %rbp
ret

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

LLVM IR (-O0):
@INT64_MAX = global i64 0
define void @use_int64_max_Good() {
%1 = alloca [10 x i8]
%2 = alloca i64
%3 = alloca i64
%4 = load i64, i64* @INT64_MAX
store i64 %4, i64* %2
%5 = load i64, i64* @INT64_MAX
%6 = sub i64 %5, 5
store i64 %6, i64* %3
%7 = load i64, i64* %2
%8 = load i64, i64* %3
%9 = sub i64 %7, %8
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %9
store i8 0, i8* %10
ret void
}

LLVM IR (-O2):
@INT64_MAX = global i64 0
define void @use_int64_max_Good() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  int x = 3, y;
  do {
    y = x--;
    if (!y) {
      printf("*");
      system("pause");
      continue;
    }
    printf("#");
  } while (1 <= x <= 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    116b <main+0x4b>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
call   1030 <system@plt>
jmp    1177 <main+0x57>
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x2,%eax
jle    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xfffffffd,%ebp
lea    0xed1(%rip),%rbx
test   %ebp,%ebp
jne    1159 <main+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
add    $0x1,%ebp
test   %ebp,%ebp
je     1140 <main+0x20>
mov    $0x23,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
test   %ebp,%ebp
jne    1159 <main+0x39>
jmp    1140 <main+0x20>

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

LLVM IR (-O2):
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
br label %1
1: ; preds = %10, %0
%2 = phi i32 [ 3, %0 ], [ %3, %10 ]
%3 = add nsw i32 %2, -1
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @putchar(i32 42)
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %1
%9 = tail call i32 @putchar(i32 35)
br label %10
10: ; preds = %8, %5
br label %1
}
void array_test1(int *a) {
  int tmp0 = a[0];
  int tmp1 = a[1];
  int tmp2 = a[2];
}


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

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

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

LLVM IR (-O2):
define void @array_test1(i32* nocapture %0) {
ret void
}
void XSetDashes() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
FILE *fifo_open_input_pipe(char *spool_filename, char *process) {
  char sys_string[1024];
  sprintf(sys_string, "cat %s | %s", spool_filename, process);
  return popen(sys_string, "r");
}


x86 assembly (clang, -O0):
<fifo_open_input_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeb7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <popen@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fifo_open_input_pipe>:
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <popen@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"cat %s | %s\00"
@.str.1 = [2 x i8] c"r\00"
define i32* @fifo_open_input_pipe(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = call i32* @popen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32* %11
}

LLVM IR (-O2):
@.str = [12 x i8] c"cat %s | %s\00"
@.str.1 = [2 x i8] c"r\00"
define noalias i32* @fifo_open_input_pipe(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i32* @popen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32* %6
}
int fun930() { return 930; }


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

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

LLVM IR (-O0):
define i32 @fun930() {
ret i32 930
}

LLVM IR (-O2):
define i32 @fun930() {
ret i32 930
}
int is_bufr(unsigned char *b) {
  if (b[0] == 'R' && b[1] == 'F' && b[2] == 'U' && b[3] == 'B')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_bufr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x52,%eax
jne    1157 <is_bufr+0x57>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x46,%eax
jne    1157 <is_bufr+0x57>
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
cmp    $0x55,%eax
jne    1157 <is_bufr+0x57>
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
cmp    $0x42,%eax
jne    1157 <is_bufr+0x57>
movl   $0x1,-0x4(%rbp)
jmp    115e <is_bufr+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_bufr>:
cmpb   $0x52,(%rdi)
jne    111c <is_bufr+0x1c>
cmpb   $0x46,0x1(%rdi)
jne    111c <is_bufr+0x1c>
cmpb   $0x55,0x2(%rdi)
jne    111c <is_bufr+0x1c>
mov    $0x1,%eax
cmpb   $0x42,0x3(%rdi)
je     111e <is_bufr+0x1e>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_bufr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 82
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 70
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 85
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 66
br i1 %15, label %17, label %16
16: ; preds = %12, %8, %4, %1
br label %17
17: ; preds = %12, %16
%18 = phi i32 [ 0, %16 ], [ 1, %12 ]
ret i32 %18
}
void av_dynamic_hdr_plus_create_side_data() {}


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

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

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

LLVM IR (-O2):
define void @av_dynamic_hdr_plus_create_side_data() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debugf(char *, char *);
int /*<<< orphan*/ destroy_shared_resources();
int /*<<< orphan*/ exit(int);
void exception(char *s) {
  debugf("%s\n", s);
  destroy_shared_resources();
  exit(1);
}


x86 assembly (clang, -O0):
<exception>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <debugf@plt>
mov    $0x0,%al
call   1030 <destroy_shared_resources@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<exception>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
call   1040 <debugf@plt>
xor    %eax,%eax
call   1030 <destroy_shared_resources@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @exception(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @debugf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @destroy_shared_resources()
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @exception(i8* %0) {
%2 = tail call i32 @debugf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @destroy_shared_resources()
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint32_t build_base(uint16_t base_0_15, uint8_t base_16_23,
                    uint8_t base_24_31) {
  return base_0_15 | (base_16_23 << 16) | (base_24_31 << 24);
}


x86 assembly (clang, -O0):
<build_base>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_base>:
mov    %edx,%eax
shl    $0x10,%esi
or     %edi,%esi
shl    $0x18,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @build_base(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = shl i32 %8, 16
%10 = or i32 %7, %9
%11 = load i32, i32* %6
%12 = shl i32 %11, 24
%13 = or i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @build_base(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 16
%5 = or i32 %4, %0
%6 = shl i32 %2, 24
%7 = or i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ callrts(char *);
zlt() { callrts("cclt"); }


x86 assembly (clang, -O0):
<zlt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <callrts@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"cclt\00"
define i32 @zlt() {
%1 = alloca i32
%2 = call i32 @callrts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [5 x i8] c"cclt\00"
define i32 @zlt() {
%1 = tail call i32 @callrts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ v;
typedef int uint8_t;
typedef int uint64_t;

/* Variables and functions */
void stor_64(void *p, uint64_t v) {
  uint8_t *p8 = p;
  size_t i;
  for (i = 0; i < sizeof(v); i++) {
    p8[i] = v & 0xff;
    v >>= 8;
  }
}


x86 assembly (clang, -O0):
<stor_64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x4,-0x20(%rbp)
jae    1154 <stor_64+0x54>
mov    -0xc(%rbp),%edx
and    $0xff,%edx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111b <stor_64+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stor_64>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rdi)
shr    $0x18,%eax
mov    %eax,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @stor_64(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = and i32 %1, 255
store i32 %4, i32* %3
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
%9 = lshr i32 %1, 16
%10 = and i32 %9, 255
%11 = getelementptr inbounds i8, i8* %0, i64 8
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
%13 = lshr i32 %1, 24
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
ret void
}
void fpu_init_native_exceptions(void) {}


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

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

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

LLVM IR (-O2):
define void @fpu_init_native_exceptions() {
ret void
}
void dos_format_void(void) {}


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

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

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

LLVM IR (-O2):
define void @dos_format_void() {
ret void
}
int test_imm_24uint16_reg(unsigned short val) {
  return ((val) & (-0x24 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_24uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffdc,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_24uint16_reg>:
test   $0xffdc,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_24uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -36
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
double signum_fun_double(double a) { return (a > 0) - (a < 0); }


x86 assembly (clang, -O0):
<signum_fun_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<signum_fun_double>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ret

LLVM IR (-O0):
define double @signum_fun_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = load double, double* %2
%7 = fcmp olt double %6, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = sub nsw i32 %5, %8
%10 = sitofp i32 %9 to double
ret double %10
}

LLVM IR (-O2):
define double @signum_fun_double(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = zext i1 %2 to i32
%4 = fcmp olt double %0, 0.000000e+00
%5 = sext i1 %4 to i32
%6 = add nsw i32 %5, %3
%7 = sitofp i32 %6 to double
ret double %7
}
void Restore(filename) char *filename;
{}


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

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

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

LLVM IR (-O2):
define void @Restore(i8* nocapture %0) {
ret void
}
void __attribute__((unused)) lace_check_memory(void) {}


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

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

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

LLVM IR (-O2):
define void @lace_check_memory() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int x(int);
int main(void) {
  if (x(0) != 2 || x(1) != 3 || x(2) != 5)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <x@plt>
cmp    $0x2,%eax
jne    1175 <main+0x45>
mov    $0x1,%edi
call   1040 <x@plt>
cmp    $0x3,%eax
jne    1175 <main+0x45>
mov    $0x2,%edi
call   1040 <x@plt>
cmp    $0x5,%eax
je     117c <main+0x4c>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <x@plt>
cmp    $0x2,%eax
jne    1162 <main+0x32>
mov    $0x1,%edi
call   1040 <x@plt>
cmp    $0x3,%eax
jne    1162 <main+0x32>
mov    $0x2,%edi
call   1040 <x@plt>
cmp    $0x5,%eax
jne    1162 <main+0x32>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @x(i32 0)
%3 = icmp ne i32 %2, 2
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = call i32 @x(i32 1)
%6 = icmp ne i32 %5, 3
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = call i32 @x(i32 2)
%9 = icmp ne i32 %8, 5
br i1 %9, label %10, label %12
10: ; preds = %7, %4, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %7
%13 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @x(i32 0)
%2 = icmp eq i32 %1, 2
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = tail call i32 @x(i32 1)
%5 = icmp eq i32 %4, 3
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @x(i32 2)
%8 = icmp eq i32 %7, 5
br i1 %8, label %11, label %9
9: ; preds = %6, %3, %0
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ RET();
int /*<<< orphan*/ hardwareTick();
int testFlag(int);
void RET_Z(void) {
  hardwareTick();
  if (testFlag(7) == 1) {
    RET();
  }
}


x86 assembly (clang, -O0):
<RET_Z>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <hardwareTick@plt>
mov    $0x7,%edi
call   1050 <testFlag@plt>
cmp    $0x1,%eax
jne    1155 <RET_Z+0x25>
mov    $0x0,%al
call   1030 <RET@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<RET_Z>:
push   %rax
xor    %eax,%eax
call   1040 <hardwareTick@plt>
mov    $0x7,%edi
call   1050 <testFlag@plt>
cmp    $0x1,%eax
jne    114f <RET_Z+0x1f>
xor    %eax,%eax
pop    %rcx
jmp    1030 <RET@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @RET_Z() {
%1 = call i32 (...) @hardwareTick()
%2 = call i32 @testFlag(i32 7)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @RET()
br label %6
6: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
define void @RET_Z() {
%1 = tail call i32 (...) @hardwareTick()
%2 = tail call i32 @testFlag(i32 7)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @RET()
br label %6
6: ; preds = %4, %0
ret void
}
void func(const char *arg) { return; }


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

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

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

LLVM IR (-O2):
define void @func(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void QEIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000020))) |= ui32IntFlags;
}


x86 assembly (clang, -O0):
<QEIIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x20(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIIntEnable>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
mov    -0x8(%rsp),%rcx
or     %rax,0x20(%rcx)
ret

LLVM IR (-O0):
define void @QEIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 32
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @QEIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 32
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}
/* Variables and functions */
scalar_t__ cJSON_malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *cJSON_strdup(const char *str) {
  size_t len;
  char *copy;
  len = strlen(str) + 1;
  if (!(copy = (char *)cJSON_malloc(len))) {
    return 0;
  }
  memcpy(copy, str, len);
  return copy;
}


x86 assembly (clang, -O0):
<cJSON_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <cJSON_malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1172 <cJSON_strdup+0x42>
movq   $0x0,-0x8(%rbp)
jmp    118b <cJSON_strdup+0x5b>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cJSON_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1040 <cJSON_malloc@plt>
test   %rax,%rax
je     1163 <cJSON_strdup+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
jmp    1165 <cJSON_strdup+0x35>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @cJSON_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i64 @cJSON_malloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i64 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = tail call i32 @memcpy(i8* %6, i8* %0, i64 %4)
br label %10
10: ; preds = %1, %8
%11 = phi i8* [ %6, %8 ], [ null, %1 ]
ret i8* %11
}
/* Variables and functions */
double cos(int);
short doubleToFixed(double);
short smallScaleCosine(int n) {
  return doubleToFixed((20.0 / 1024) * cos(2 * 3.1415926535 * 60000 * n / 345));
}


x86 assembly (clang, -O0):
<smallScaleCosine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xed8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xec4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xea4(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <doubleToFixed@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smallScaleCosine>:
push   %rax
cvtsi2sd %edi,%xmm0
mulsd  0xed3(%rip),%xmm0
divsd  0xed3(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
mulsd  0xeca(%rip),%xmm0
pop    %rax
jmp    1030 <doubleToFixed@plt>

LLVM IR (-O0):
define signext i16 @smallScaleCosine(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double 0x4117027C794317AD, %4
%6 = fdiv double %5, 3.450000e+02
%7 = fptosi double %6 to i32
%8 = call double @cos(i32 %7)
%9 = fmul double 0x3F94000000000000, %8
%10 = call signext i16 @doubleToFixed(double %9)
ret i16 %10
}

LLVM IR (-O2):
define signext i16 @smallScaleCosine(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 0x4117027C794317AD
%4 = fdiv double %3, 3.450000e+02
%5 = fptosi double %4 to i32
%6 = tail call double @cos(i32 %5)
%7 = fmul double %6, 0x3F94000000000000
%8 = tail call signext i16 @doubleToFixed(double %7)
ret i16 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "usage: webcomp prefix filelist >output.c\n    filelist is a file "
          "containing the pathnames of all web pages\n    prefix is a path "
          "prefix to remove from all the web page pathnames\n    output.c is "
          "the resulting C source file to compile and link.\n");
  exit(2);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [242 x i8] c"usage: webcomp prefix filelist >output.c\0A filelist is a file containing the pathnames of all web pages\0A prefix is a path prefix to remove from all the web page pathnames\0A output.c is the resulting C source file to compile and link.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([242 x i8], [242 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [242 x i8] c"usage: webcomp prefix filelist >output.c\0A filelist is a file containing the pathnames of all web pages\0A prefix is a path prefix to remove from all the web page pathnames\0A output.c is the resulting C source file to compile and link.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([242 x i8], [242 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 2)
unreachable
}
int tolower_fast(int c) {
  if ((c >= 'A') && (c <= 'Z'))
    c = c + ('a' - 'A');
  return c;
}


x86 assembly (clang, -O0):
<tolower_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     1124 <tolower_fast+0x24>
cmpl   $0x5a,-0x4(%rbp)
jg     1124 <tolower_fast+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @tolower_fast(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 32
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %5, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @tolower_fast(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
char *getenv(char const *);
const char *getenv_with_default(const char *key, const char *def) {
  const char *val;
  val = getenv(key);
  if (!val)
    return def;
  return val;
}


x86 assembly (clang, -O0):
<getenv_with_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1145 <getenv_with_default+0x35>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114d <getenv_with_default+0x3d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getenv_with_default>:
push   %rbx
mov    %rsi,%rbx
call   1030 <getenv@plt>
test   %rax,%rax
cmove  %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @getenv_with_default(i8* nocapture %0, i8* readnone %1) {
%3 = tail call i8* @getenv(i8* %0)
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* %1, i8* %3
ret i8* %5
}
char *GetBW(int BW) {
  switch (BW) {
  case 3:
    return "10M";
  case 0:
    return "20M";
  default:
    return "N/A";
  }
}


x86 assembly (clang, -O0):
<GetBW>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     113b <GetBW+0x3b>
jmp    111a <GetBW+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
jne    114b <GetBW+0x4b>
jmp    112b <GetBW+0x2b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <GetBW+0x56>
lea    0xec2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <GetBW+0x56>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetBW>:
test   %edi,%edi
lea    0xefb(%rip),%rax
lea    0xef8(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x3,%edi
lea    0xee2(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"10M\00"
@.str.1 = [4 x i8] c"20M\00"
@.str.2 = [4 x i8] c"N/A\00"
define i8* @GetBW(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 3, label %5
i32 0, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [4 x i8] c"10M\00"
@.str.1 = [4 x i8] c"20M\00"
@.str.2 = [4 x i8] c"N/A\00"
define i8* @GetBW(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 3
%5 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
int lastX(int order) {
  switch (order & 7) {
  case 0:
  case 4:
    return 0;
  case 1:
  case 2:
  case 3:
    return 1l << (order >> 1);
  default:
    return -(1l << (order >> 1));
  }
}


x86 assembly (clang, -O0):
<lastX>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
je     1140 <lastX+0x40>
jmp    111b <lastX+0x1b>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     114c <lastX+0x4c>
jmp    112f <lastX+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
jne    1166 <lastX+0x66>
jmp    1140 <lastX+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1183 <lastX+0x83>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %eax,-0x4(%rbp)
jmp    1183 <lastX+0x83>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lastX>:
mov    %edi,%ecx
and    $0x7,%ecx
lea    -0x1(%rcx),%eax
cmp    $0x3,%eax
jae    1116 <lastX+0x16>
shr    %edi
mov    $0x1,%eax
jmp    112a <lastX+0x2a>
xor    %eax,%eax
test   %ecx,%ecx
je     112f <lastX+0x2f>
cmp    $0x4,%ecx
je     112f <lastX+0x2f>
shr    %edi
mov    $0xffffffffffffffff,%rax
mov    %edi,%ecx
shl    %cl,%rax
ret

LLVM IR (-O0):
define i32 @lastX(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 7
switch i32 %5, label %13 [
i32 0, label %6
i32 4, label %6
i32 1, label %7
i32 2, label %7
i32 3, label %7
]
6: ; preds = %1, %1
store i32 0, i32* %2
br label %20
7: ; preds = %1, %1, %1
%8 = load i32, i32* %3
%9 = ashr i32 %8, 1
%10 = zext i32 %9 to i64
%11 = shl i64 1, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
br label %20
13: ; preds = %1
%14 = load i32, i32* %3
%15 = ashr i32 %14, 1
%16 = zext i32 %15 to i64
%17 = shl i64 1, %16
%18 = sub nsw i64 0, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %2
br label %20
20: ; preds = %13, %7, %6
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @lastX(i32 %0) {
%2 = and i32 %0, 7
switch i32 %2, label %8 [
i32 0, label %13
i32 4, label %13
i32 1, label %3
i32 2, label %3
i32 3, label %3
]
3: ; preds = %1, %1, %1
%4 = ashr i32 %0, 1
%5 = zext i32 %4 to i64
%6 = shl nuw i64 1, %5
%7 = trunc i64 %6 to i32
br label %13
8: ; preds = %1
%9 = ashr i32 %0, 1
%10 = zext i32 %9 to i64
%11 = shl nsw i64 -1, %10
%12 = trunc i64 %11 to i32
br label %13
13: ; preds = %1, %1, %8, %3
%14 = phi i32 [ %12, %8 ], [ %7, %3 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %14
}
/* Variables and functions */
int printf(char *, int);
int main() {
  int i = 43;
  printf("%d\n", printf("%d", printf("%d", i)));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeec(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2b,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 43)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hypre_OutOfMemory(int);
char *malloc(int);
char *realloc(char *, int);
char *hypre_ReAlloc(char *ptr, int size) {
  if (ptr == NULL) {
    ptr = malloc(size);
  } else {
    ptr = realloc(ptr, size);
  }
  if ((ptr == NULL) && (size > 0)) {
    hypre_OutOfMemory(size);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<hypre_ReAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115b <hypre_ReAlloc+0x2b>
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    116b <hypre_ReAlloc+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1188 <hypre_ReAlloc+0x58>
cmpl   $0x0,-0xc(%rbp)
jle    1188 <hypre_ReAlloc+0x58>
mov    -0xc(%rbp),%edi
call   1040 <hypre_OutOfMemory@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypre_ReAlloc>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
test   %rdi,%rdi
je     1144 <hypre_ReAlloc+0x14>
mov    %ebx,%esi
call   1050 <realloc@plt>
jmp    114b <hypre_ReAlloc+0x1b>
mov    %ebx,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
test   %ebx,%ebx
jle    115e <hypre_ReAlloc+0x2e>
test   %r14,%r14
jne    115e <hypre_ReAlloc+0x2e>
mov    %ebx,%edi
call   1040 <hypre_OutOfMemory@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @hypre_ReAlloc(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 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
br label %14
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i8* @realloc(i8* %11, i32 %12)
store i8* %13, i8** %3
br label %14
14: ; preds = %10, %7
%15 = load i8*, i8** %3
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %4
%22 = call i32 @hypre_OutOfMemory(i32 %21)
br label %23
23: ; preds = %20, %17, %14
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
define i8* @hypre_ReAlloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @malloc(i32 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i32 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
%10 = icmp eq i8* %9, null
%11 = icmp sgt i32 %1, 0
%12 = and i1 %11, %10
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @hypre_OutOfMemory(i32 %1)
br label %15
15: ; preds = %13, %8
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned char);
int /*<<< orphan*/ stdout;
void cutils_cout_unsigned_char_print(unsigned char character) {
  fprintf(stdout, "%u\n", character);
}


x86 assembly (clang, -O0):
<cutils_cout_unsigned_char_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
lea    0xed2(%rip),%rsi
movzbl -0x1(%rbp),%edx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutils_cout_unsigned_char_print>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%u\0A\00"
define void @cutils_cout_unsigned_char_print(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @stdout
%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 zeroext %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%u\0A\00"
define void @cutils_cout_unsigned_char_print(i8 zeroext %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
ret void
}