xunge/DecIR huggingface dataset:
/* Variables and functions */
int find_nth_term(int, int, int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main() {
  int n, a, b, c;
  scanf("%d %d %d %d", &n, &a, &b, &c);
  int ans = find_nth_term(n, a, b, c);
  printf("%d", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <find_nth_term@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
call   1030 <find_nth_term@plt>
lea    0xe99(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @find_nth_term(i32 %10, i32 %11, i32 %12, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int strncasecmp(char const *, char const *, int /*<<< orphan*/);
int _stricmp(const char *s1, const char *s2) {
  return strncasecmp(s1, s2, strlen(s1));
}


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

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

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

LLVM IR (-O2):
define i32 @_stricmp(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strncasecmp(i8* %0, i8* %1, i32 %3)
ret i32 %4
}
void XSyncIntsToValue() {}


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

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

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

LLVM IR (-O2):
define void @XSyncIntsToValue() {
ret void
}
/* Variables and functions */
scalar_t__ isgraph(int);
int FwdLockConv_IsMimeHeaderNameChar(int ch) {
  return isgraph(ch) && ch != ':';
}


x86 assembly (clang, -O0):
<FwdLockConv_IsMimeHeaderNameChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isgraph@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
je     113f <FwdLockConv_IsMimeHeaderNameChar+0x2f>
cmpl   $0x3a,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FwdLockConv_IsMimeHeaderNameChar>:
push   %rbx
mov    %edi,%ebx
call   1030 <isgraph@plt>
test   %rax,%rax
setne  %al
cmp    $0x3a,%ebx
setne  %cl
and    %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @FwdLockConv_IsMimeHeaderNameChar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isgraph(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 58
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @FwdLockConv_IsMimeHeaderNameChar(i32 %0) {
%2 = tail call i64 @isgraph(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp ne i32 %0, 58
%5 = and i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int a(int);
int b(int /*<<< orphan*/);
int /*<<< orphan*/ c(int);
int d(int i) { return a(i) + b(c(i)); }


x86 assembly (clang, -O0):
<d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <a@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <c@plt>
mov    %eax,%edi
call   1030 <b@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1050 <a@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <c@plt>
mov    %eax,%edi
call   1030 <b@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @d(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @a(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @c(i32 %5)
%7 = call i32 @b(i32 %6)
%8 = add nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @d(i32 %0) {
%2 = tail call i32 @a(i32 %0)
%3 = tail call i32 @c(i32 %0)
%4 = tail call i32 @b(i32 %3)
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dump_info(unsigned int *, int, char *);
void prefetch_abort_handler(unsigned int *context) {
  dump_info(context, 4, "Prefetch Abort");
}


x86 assembly (clang, -O0):
<prefetch_abort_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
lea    0xed4(%rip),%rdx
call   1030 <dump_info@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefetch_abort_handler>:
lea    0xee9(%rip),%rdx
mov    $0x4,%esi
jmp    1030 <dump_info@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Prefetch Abort\00"
define void @prefetch_abort_handler(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @dump_info(i32* %3, i32 4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Prefetch Abort\00"
define void @prefetch_abort_handler(i32* %0) {
%2 = tail call i32 @dump_info(i32* %0, i32 4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int *);
int test9(int X) {
  int Arr[100] = {X};
  bar(Arr);
}


x86 assembly (clang, -O0):
<test9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1a0(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test9>:
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
mov    $0x190,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %ebx,(%rsp)
mov    %r14,%rdi
call   1030 <bar@plt>
add    $0x198,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @test9(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
store i32 %0, i32* %3
%5 = bitcast [100 x i32]* %4 to i8*
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%7 = load i32, i32* %3
store i32 %7, i32* %6
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%9 = call i32 @bar(i32* %8)
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @test9(i32 %0) {
%2 = alloca [100 x i32]
%3 = bitcast [100 x i32]* %2 to i8*
%4 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
store i32 %0, i32* %4
%5 = call i32 @bar(i32* %4)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ yylex();
void main() {
  int val, total = 0, n = 0;
  while ((val = yylex() > 0)) {
    switch (val) {
    case 300:
      ++total;
      break;
    }
  }
  total++;
  printf("ave = %d\n", total);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <yylex@plt>
cmp    $0x0,%rax
setg   %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x4(%rbp)
test   $0x1,%al
jne    115c <main+0x3c>
jmp    117d <main+0x5d>
mov    -0x4(%rbp),%eax
sub    $0x12c,%eax
jne    1178 <main+0x58>
jmp    116f <main+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <yylex@plt>
test   %rax,%rax
jg     1130 <main+0x10>
lea    0xebd(%rip),%rdi
mov    $0x1,%esi
pop    %rax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"ave = %d\0A\00"
define void @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @yylex()
%3 = icmp sgt i64 %2, 0
br i1 %3, label %1, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help_dialog() {
  printf("\n  Usage:\n    bfi -n[i][o]\n    bfi -[i][o] filename.bf\n\n");
}


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

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

LLVM IR (-O0):
@.str = [57 x i8] c"\0A Usage:\0A bfi -n[i][o]\0A bfi -[i][o] filename.bf\0A\0A\00"
define void @help_dialog() {
%1 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [56 x i8] c"\0A Usage:\0A bfi -n[i][o]\0A bfi -[i][o] filename.bf\0A\00"
define void @help_dialog() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
ret void
}
int test1(int x) {
  static int thestatic;
  thestatic = x;
  return thestatic + x;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,0x2f14(%rip)
mov    0x2f0e(%rip),%eax
add    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
lea    (%rdi,%rdi,1),%eax
ret

LLVM IR (-O0):
@test1.thestatic = internal global i32 0
define i32 @test1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store i32 %3, i32* @test1.thestatic
%4 = load i32, i32* @test1.thestatic
%5 = load i32, i32* %2
%6 = add nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @test1(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
void foo_1_2_2_1_2_2_2_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_1_2_2_2_2_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void display_result(char **grid, size_t size) {
  for (int i = 0; i < size; i++)
    printf("%s\n", grid[i]);
}


x86 assembly (clang, -O0):
<display_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115b <display_result+0x4b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <display_result+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_result>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1145 <display_result+0x35>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <display_result+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @display_result(i8** nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8*, i8** %0, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %4, label %5
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t make_vga_char(char c, uint8_t color) {
  uint16_t c16 = c;
  uint16_t color16 = color;
  return c16 | color16 << 8;
}


x86 assembly (clang, -O0):
<make_vga_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_vga_char>:
mov    %esi,%eax
shl    $0x8,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @make_vga_char(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
store i32 %8, i32* %5
%9 = load i32, i32* %4
store i32 %9, i32* %6
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = shl i32 %11, 8
%13 = or i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @make_vga_char(i8 signext %0, i32 %1) {
%3 = sext i8 %0 to i32
%4 = shl i32 %1, 8
%5 = or i32 %4, %3
ret i32 %5
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void main() {
  int32_t a;
  a = 1 | 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
int test_and_set_bit(int nr, volatile unsigned long *addr) {
  unsigned long index = nr / 32;
  unsigned long *tmp = (unsigned long *)&((addr)[index]);
  unsigned char bit = 32 - (nr % 32) - 1;
  *tmp = *tmp | (1 << bit);
  return 1;
}


x86 assembly (clang, -O0):
<test_and_set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    $0x20,%eax
sub    %edx,%eax
sub    $0x1,%eax
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
movzbl -0x21(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    -0x30(%rbp),%rcx
cltq
or     %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_and_set_bit>:
mov    %edi,%ecx
lea    0x1f(%rcx),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x5,%eax
cltq
mov    $0x80000000,%edx
shr    %cl,%edx
movslq %edx,%rcx
or     %rcx,(%rsi,%rax,8)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @test_and_set_bit(i32 %0, i64* nocapture %1) {
%3 = sdiv i32 %0, 32
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i64, i64* %1, i64 %4
%6 = load i64, i64* %5
%7 = and i32 %0, 31
%8 = lshr i32 -2147483648, %7
%9 = sext i32 %8 to i64
%10 = or i64 %6, %9
store i64 %10, i64* %5
ret i32 1
}
double geom_J2_cyl_rpz(double x[], int dir) {
  if (dir == 0)
    return x[0];
  else if (dir == 1)
    return 1.0;
  return 0.0;
}


x86 assembly (clang, -O0):
<geom_J2_cyl_rpz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1127 <geom_J2_cyl_rpz+0x27>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1150 <geom_J2_cyl_rpz+0x50>
cmpl   $0x1,-0x14(%rbp)
jne    1143 <geom_J2_cyl_rpz+0x43>
movsd  0xec7(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1150 <geom_J2_cyl_rpz+0x50>
jmp    1148 <geom_J2_cyl_rpz+0x48>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_J2_cyl_rpz>:
cmp    $0x1,%esi
je     110e <geom_J2_cyl_rpz+0xe>
test   %esi,%esi
jne    1117 <geom_J2_cyl_rpz+0x17>
movsd  (%rdi),%xmm0
ret
movsd  0xeea(%rip),%xmm0
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @geom_J2_cyl_rpz(double* %0, i32 %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
store double %11, double* %3
br label %18
12: ; preds = %2
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %12
store double 1.000000e+00, double* %3
br label %18
16: ; preds = %12
br label %17
17: ; preds = %16
store double 0.000000e+00, double* %3
br label %18
18: ; preds = %17, %15, %8
%19 = load double, double* %3
ret double %19
}

LLVM IR (-O2):
define double @geom_J2_cyl_rpz(double* nocapture %0, i32 %1) {
switch i32 %1, label %5 [
i32 0, label %3
i32 1, label %6
]
3: ; preds = %2
%4 = load double, double* %0
br label %6
5: ; preds = %2
br label %6
6: ; preds = %2, %5, %3
%7 = phi double [ %4, %3 ], [ 0.000000e+00, %5 ], [ 1.000000e+00, %2 ]
ret double %7
}
int wrpkru(unsigned int pkru) {
  unsigned int eax = pkru;
  unsigned int ecx = 0;
  unsigned int edx = 0;
  asm volatile(".byte 0x0f,0x01,0xef\n\t" : : "a"(eax), "c"(ecx), "d"(edx));
  return 0;
}


x86 assembly (clang, -O0):
<wrpkru>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
wrpkru
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrpkru>:
mov    %edi,%eax
xor    %ecx,%ecx
xor    %edx,%edx
wrpkru
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @wrpkru(i32 %0) {
tail call void asm sideeffect ".byte 0x0f,0x01,0xef\0A\09", "{ax},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 0, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHelp() {
  printf("\n\t\tTextInASCII\n\n DESCRIPTION:\n     Prints your string in the "
         "form of an ASCII art.\n \n example:\n     textinascii NAME\n     "
         "textinascii \"GREEN PEPPER\"\n     textinascii -v VERTICAL\n \n "
         "OPTIONS:\n     -v    Vertical printing.\n     -h    Help menu.\n\n");
}


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

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

LLVM IR (-O0):
@.str = [244 x i8] c"\0A\09\09TextInASCII\0A\0A DESCRIPTION:\0A Prints your string in the form of an ASCII art.\0A \0A example:\0A textinascii NAME\0A textinascii \22GREEN PEPPER\22\0A textinascii -v VERTICAL\0A \0A OPTIONS:\0A -v Vertical printing.\0A -h Help menu.\0A\0A\00"
define void @printHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([244 x i8], [244 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [243 x i8] c"\0A\09\09TextInASCII\0A\0A DESCRIPTION:\0A Prints your string in the form of an ASCII art.\0A \0A example:\0A textinascii NAME\0A textinascii \22GREEN PEPPER\22\0A textinascii -v VERTICAL\0A \0A OPTIONS:\0A -v Vertical printing.\0A -h Help menu.\0A\00"
define void @printHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([243 x i8], [243 x i8]* @str, i64 0, i64 0))
ret void
}
int __attribute__((__no__)) syscall(int id, ...) {
  int ret;
  int *args = &id;
  asm volatile("int $0x80"
               : "=a"(ret)
               : "a"(args[0]), "b"(args[1]), "c"(args[2]), "d"(args[3]));
  return ret;
}


x86 assembly (clang, -O0):
<syscall>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    (%rdx),%eax
mov    0x4(%rdx),%ebx
mov    0x8(%rdx),%ecx
mov    0xc(%rdx),%edx
int    $0x80
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall>:
mov    %edi,%eax
int    $0x80
ret

LLVM IR (-O0):
define i32 @syscall(i32 %0, ...) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
store i32* %2, i32** %4
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32, i32* %12
%14 = load i32*, i32** %4
%15 = getelementptr inbounds i32, i32* %14, i64 3
%16 = load i32, i32* %15
%17 = call i32 asm sideeffect "int $$0x80", "={ax},{ax},{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %7, i32 %10, i32 %13, i32 %16)
store i32 %17, i32* %3
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @syscall(i32 %0, ...) {
%2 = tail call i32 asm sideeffect "int $$0x80", "={ax},{ax},{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 poison, i32 poison, i32 poison)
ret i32 %2
}
unsigned cpu_uint16_make_uint8(unsigned v0, unsigned v1) {
  return v0 | v1 << 8;
}


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

x86 assembly (clang, -O2):
<cpu_uint16_make_uint8>:
mov    %esi,%eax
shl    $0x8,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @cpu_uint16_make_uint8(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 %6, 8
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @cpu_uint16_make_uint8(i32 %0, i32 %1) {
%3 = shl i32 %1, 8
%4 = or i32 %3, %0
ret i32 %4
}
int main() {
  int y = 0;
  int *m = malloc(sizeof(int));
  int *x = m[0] + &y;
  printf("x = %d\n", *x == 0xDEADBEEF ? 99 : 88);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rcx
lea    -0x8(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    $0x58,%esi
mov    $0x63,%eax
cmp    $0xdeadbeef,%ecx
cmove  %eax,%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"x = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i8* @malloc(i64 4)
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %2, i64 %10
store i32* %11, i32** %4
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, -559038737
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 99, i32 88
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"x = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 88)
ret i32 0
}
void arithmetic_init_div(void) { int x = 1 / 1; }


x86 assembly (clang, -O0):
<arithmetic_init_div>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @arithmetic_init_div() {
ret void
}
short int yb(short int *y) {
  short int xx = *y & 255;
  return xx + y[1];
}


x86 assembly (clang, -O0):
<yb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
and    $0xff,%eax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
mov    -0x8(%rbp),%rcx
movswl 0x2(%rcx),%ecx
add    %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<yb>:
movzbl (%rdi),%eax
add    0x2(%rdi),%ax
ret

LLVM IR (-O0):
define signext i16 @yb(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
store i16* %0, i16** %2
%4 = load i16*, i16** %2
%5 = load i16, i16* %4
%6 = sext i16 %5 to i32
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i16
store i16 %8, i16* %3
%9 = load i16, i16* %3
%10 = sext i16 %9 to i32
%11 = load i16*, i16** %2
%12 = getelementptr inbounds i16, i16* %11, i64 1
%13 = load i16, i16* %12
%14 = sext i16 %13 to i32
%15 = add nsw i32 %10, %14
%16 = trunc i32 %15 to i16
ret i16 %16
}

LLVM IR (-O2):
define signext i16 @yb(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 255
%4 = getelementptr inbounds i16, i16* %0, i64 1
%5 = load i16, i16* %4
%6 = add i16 %3, %5
ret i16 %6
}
/* Variables and functions */
int ejtag_switch(int, int /*<<< orphan*/);
int mips_ejtag_portread() { return ejtag_switch(0x3002, 0); }


x86 assembly (clang, -O0):
<mips_ejtag_portread>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3002,%edi
xor    %esi,%esi
call   1030 <ejtag_switch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mips_ejtag_portread>:
mov    $0x3002,%edi
xor    %esi,%esi
jmp    1030 <ejtag_switch@plt>

LLVM IR (-O0):
define i32 @mips_ejtag_portread() {
%1 = call i32 @ejtag_switch(i32 12290, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @mips_ejtag_portread() {
%1 = tail call i32 @ejtag_switch(i32 12290, i32 0)
ret i32 %1
}
char dummy_alert_check_fn(void) { return 0; }


x86 assembly (clang, -O0):
<dummy_alert_check_fn>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @dummy_alert_check_fn() {
ret i8 0
}

LLVM IR (-O2):
define signext i8 @dummy_alert_check_fn() {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test1() { printf("test1: target called - failure\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"test1: target called - failure\0A\00"
define void @test1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"test1: target called - failure\00"
define void @test1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
void swap(int *values, int i, int j) {
  int tmp = values[i];
  values[i] = values[j];
  values[j] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
bool nrf52_errata_158(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf52_errata_158() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf52_errata_158() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _puts(char *);
int main(void) {
  unsigned char *vram = (unsigned char *)0xa0000;
  _puts("Hello!\n");
  _puts("Key or Mouse\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa0000,%eax
mov    %rax,-0x10(%rbp)
lea    0xed1(%rip),%rdi
call   1030 <_puts@plt>
lea    0xecd(%rip),%rdi
call   1030 <_puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"Hello!\0A\00"
@.str.1 = [14 x i8] c"Key or Mouse\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* inttoptr (i64 655360 to i8*), i8** %2
%3 = call i32 @_puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @_puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"Hello!\0A\00"
@.str.1 = [14 x i8] c"Key or Mouse\0A\00"
define i32 @main() {
%1 = tail call i32 @_puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @_puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_243() {
  Assert_real((isqrt(243) == 15),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              1220, ("Integer square root of 243 should be 15"));
}


x86 assembly (clang, -O0):
<t_sqrt_243>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf3,%edi
call   1030 <isqrt@plt>
cmp    $0xf,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x4c4,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_243>:
push   %rax
mov    $0xf3,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xf,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x4c4,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 243 should be 15\00"
define void @t_sqrt_243() {
%1 = call i32 @isqrt(i32 243)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1220, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 243 should be 15\00"
define void @t_sqrt_243() {
%1 = tail call i32 @isqrt(i32 243)
%2 = icmp eq i32 %1, 15
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1220, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int writejpeg(const char *name, int xres, int yres, unsigned char *imgdata) {
  return 2;
}


x86 assembly (clang, -O0):
<writejpeg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    $0x2,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @writejpeg(i8* nocapture readnone %0, i32 %1, i32 %2, i8* nocapture readnone %3) {
ret i32 2
}
void ble_rsp_connection_channel_map_set(
    const struct ble_msg_connection_channel_map_set_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_connection_channel_map_set_rsp_t = type opaque
define void @ble_rsp_connection_channel_map_set(%struct.ble_msg_connection_channel_map_set_rsp_t* nocapture %0) {
ret void
}
/* Type definitions */
struct termios {
  int /*<<< orphan*/ c_ispeed;
};
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
speed_t cfgetispeed(const struct termios *tp) { return tp->c_ispeed; }


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

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

LLVM IR (-O0):
%struct.termios = type { i32 }
define i32 @cfgetispeed(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load %struct.termios*, %struct.termios** %2
%4 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @cfgetispeed(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int assert_dec_len(int, char *, size_t, char *, size_t);
size_t strlen(char *);
int assert_dec(int flags, char *src, char *dst) {
  size_t srclen = strlen(src);
  size_t dstlen = strlen(dst);
  return assert_dec_len(flags, src, srclen, dst, dstlen);
}


x86 assembly (clang, -O0):
<assert_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <assert_dec_len@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_dec>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r15d
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %rax,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <assert_dec_len@plt>

LLVM IR (-O0):
define i32 @assert_dec(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
store i64 %10, i64* %7
%11 = load i8*, i8** %6
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %8
%13 = load i32, i32* %4
%14 = load i8*, i8** %5
%15 = load i64, i64* %7
%16 = load i8*, i8** %6
%17 = load i64, i64* %8
%18 = call i32 @assert_dec_len(i32 %13, i8* %14, i64 %15, i8* %16, i64 %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @assert_dec(i32 %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%6 = tail call i32 @assert_dec_len(i32 %0, i8* %1, i64 %4, i8* %2, i64 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("yo2\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"yo2\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
main() {
  int x = 2, y = 3;
  printf("%d %d\n", x, y, x);
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 2, i32 3, i32 2)
ret i32 0
}
/* Variables and functions */
float clamp(int /*<<< orphan*/, double, double);
int /*<<< orphan*/ impulse(double, float);
float flareType1(float input) { return clamp(impulse(8.0, input), 0.0, 1.0); }


x86 assembly (clang, -O0):
<flareType1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
movsd  0xece(%rip),%xmm0
call   1030 <impulse@plt>
mov    %eax,%edi
xorps  %xmm0,%xmm0
movsd  0xeb4(%rip),%xmm1
call   1040 <clamp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flareType1>:
push   %rax
movaps %xmm0,%xmm1
movsd  0xed4(%rip),%xmm0
call   1030 <impulse@plt>
movsd  0xecf(%rip),%xmm1
xorps  %xmm0,%xmm0
mov    %eax,%edi
pop    %rax
jmp    1040 <clamp@plt>

LLVM IR (-O0):
define float @flareType1(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @impulse(double 8.000000e+00, float %3)
%5 = call float @clamp(i32 %4, double 0.000000e+00, double 1.000000e+00)
ret float %5
}

LLVM IR (-O2):
define float @flareType1(float %0) {
%2 = tail call i32 @impulse(double 8.000000e+00, float %0)
%3 = tail call float @clamp(i32 %2, double 0.000000e+00, double 1.000000e+00)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ zlicense_mac_check(char *, char *);
int main(int argc, char **argv) {
  zlicense_mac_check("a", "a");
  return (0);
}


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)
lea    0xed3(%rip),%rsi
mov    %rsi,%rdi
call   1030 <zlicense_mac_check@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
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 @zlicense_mac_check(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @zlicense_mac_check(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void VErrorF(const char *f, va_list args) { vfprintf(stderr, f, args); }


x86 assembly (clang, -O0):
<VErrorF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vfprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VErrorF>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @VErrorF(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vfprintf(i32 %5, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @VErrorF(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @vfprintf(i32 %3, i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_cond_t;
typedef int /*<<< orphan*/ cnd_t;

/* Variables and functions */
int __private_cond_signal(int /*<<< orphan*/ *, int);
int cnd_signal(cnd_t *c) {
  return __private_cond_signal((pthread_cond_t *)c, 1);
}


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

x86 assembly (clang, -O2):
<cnd_signal>:
mov    $0x1,%esi
jmp    1030 <__private_cond_signal@plt>

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

LLVM IR (-O2):
define i32 @cnd_signal(i32* %0) {
%2 = tail call i32 @__private_cond_signal(i32* %0, i32 1)
ret i32 %2
}