xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ args_initialize(int, char **);
scalar_t__ args_is_valid();
int /*<<< orphan*/ error_print();
int /*<<< orphan*/ help_print();
int main(int argc, char **argv) {
  args_initialize(argc, argv);
  if (args_is_valid()) {
    help_print();
  } else {
    error_print();
  }
  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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <args_initialize@plt>
mov    $0x0,%al
call   1030 <args_is_valid@plt>
cmp    $0x0,%rax
je     117f <main+0x3f>
mov    $0x0,%al
call   1060 <help_print@plt>
jmp    1186 <main+0x46>
mov    $0x0,%al
call   1050 <error_print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <args_initialize@plt>
xor    %eax,%eax
call   1030 <args_is_valid@plt>
test   %rax,%rax
je     115b <main+0x1b>
xor    %eax,%eax
call   1060 <help_print@plt>
jmp    1162 <main+0x22>
xor    %eax,%eax
call   1050 <error_print@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @args_initialize(i32 %6, i8** %7)
%9 = call i64 (...) @args_is_valid()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @help_print()
br label %15
13: ; preds = %2
%14 = call i32 (...) @error_print()
br label %15
15: ; preds = %13, %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @args_initialize(i32 %0, i8** %1)
%4 = tail call i64 (...) @args_is_valid()
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @help_print()
br label %10
8: ; preds = %2
%9 = tail call i32 (...) @error_print()
br label %10
10: ; preds = %8, %6
ret i32 0
}
/* Variables and functions */
size_t round_up(size_t n, size_t r) {
  return n > -r ? 0 : (n + (r - 1)) / r * r;
}


x86 assembly (clang, -O0):
<round_up>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
cmp    %rcx,%rax
jbe    112a <round_up+0x2a>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    114a <round_up+0x4a>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
add    %rcx,%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
imul   -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up>:
mov    %rsi,%rax
neg    %rax
cmp    %rdi,%rax
jae    1111 <round_up+0x11>
xor    %ecx,%ecx
mov    %rcx,%rax
ret
lea    (%rdi,%rsi,1),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     112f <round_up+0x2f>
mov    %rcx,%rax
xor    %edx,%edx
div    %rsi
jmp    1135 <round_up+0x35>
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
sub    %rdx,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @round_up(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub i64 0, %6
%8 = icmp ugt i64 %5, %7
br i1 %8, label %9, label %10
9: ; preds = %2
br label %19
10: ; preds = %2
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = sub i64 %12, 1
%14 = add i64 %11, %13
%15 = load i64, i64* %4
%16 = udiv i64 %14, %15
%17 = load i64, i64* %4
%18 = mul i64 %16, %17
br label %19
19: ; preds = %10, %9
%20 = phi i64 [ 0, %9 ], [ %18, %10 ]
ret i64 %20
}

LLVM IR (-O2):
define i64 @round_up(i64 %0, i64 %1) {
%3 = sub i64 0, %1
%4 = icmp ult i64 %3, %0
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = add i64 %0, -1
%7 = add i64 %6, %1
%8 = urem i64 %7, %1
%9 = sub i64 %7, %8
br label %10
10: ; preds = %2, %5
%11 = phi i64 [ %9, %5 ], [ 0, %2 ]
ret i64 %11
}
void write_word(unsigned char *addr, unsigned int value) {
  *(unsigned short *)addr = value;
}


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

x86 assembly (clang, -O2):
<write_word>:
mov    %si,(%rdi)
ret

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

LLVM IR (-O2):
define void @write_word(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i16
%4 = bitcast i8* %0 to i16*
store i16 %3, i16* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main(void) {
  for (int i = 0; i < 100; i++) {
    foo(i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1146 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <foo@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <foo@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @foo(i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i32 @foo(i32 %3)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 100
br i1 %6, label %1, label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverseString(char *);
int main(int argc, const char *argv[]) {
  char a[] = "ABCDE";
  reverseString(a);
  printf("%s\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x16(%rbp),%rdi
call   1040 <reverseString@plt>
lea    -0x16(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x45,0xc(%rsp)
movl   $0x44434241,0x8(%rsp)
44
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <reverseString@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.a = [6 x i8] c"ABCDE\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%5 = call i32 @reverseString(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strlen(unsigned char *);
int /*<<< orphan*/ tp_serial_flush_input(int);
int /*<<< orphan*/ tp_serial_read(int, unsigned char *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, unsigned char *, int /*<<< orphan*/);
void tp_serial_send_cmd(int fd, unsigned char *cmd) {
  unsigned char junk[15];
  tp_serial_flush_input(fd);
  write(fd, cmd, strlen(cmd));
  tp_serial_read(fd, junk, strlen(cmd));
}


x86 assembly (clang, -O0):
<tp_serial_send_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <tp_serial_flush_input@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x1f(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1030 <tp_serial_read@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tp_serial_send_cmd>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
call   1060 <tp_serial_flush_input@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x9(%rsp),%rsi
mov    %ebp,%edi
mov    %eax,%edx
call   1030 <tp_serial_read@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @tp_serial_send_cmd(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [15 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @tp_serial_flush_input(i32 %6)
%8 = load i32, i32* %3
%9 = load i8*, i8** %4
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @write(i32 %8, i8* %9, i32 %11)
%13 = load i32, i32* %3
%14 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%15 = load i8*, i8** %4
%16 = call i32 @strlen(i8* %15)
%17 = call i32 @tp_serial_read(i32 %13, i8* %14, i32 %16)
ret void
}

LLVM IR (-O2):
define void @tp_serial_send_cmd(i32 %0, i8* %1) {
%3 = alloca [15 x i8]
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @tp_serial_flush_input(i32 %0)
%6 = tail call i32 @strlen(i8* %1)
%7 = tail call i32 @write(i32 %0, i8* %1, i32 %6)
%8 = tail call i32 @strlen(i8* %1)
%9 = call i32 @tp_serial_read(i32 %0, i8* %4, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int send_command(char command) {
  puts("send_command ");
  return 0;
}


x86 assembly (clang, -O0):
<send_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"send_command \00"
define i32 @send_command(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"send_command \00"
define i32 @send_command(i8 signext %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  scanf("%d", &num);
  for (int i = 1; i <= num; i++) {
    printf("%d ", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116f <main+0x4f>
mov    -0xc(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1163 <main+0x43>
xor    %ebx,%ebx
lea    0xebe(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    0x4(%rsp),%ebx
jl     1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %7, %0
ret i32 0
7: ; preds = %0, %7
%8 = phi i32 [ %10, %7 ], [ 1, %0 ]
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = add nuw nsw i32 %8, 1
%11 = load i32, i32* %1
%12 = icmp slt i32 %8, %11
br i1 %12, label %7, label %6
}
/* Variables and functions */
int /*<<< orphan*/ displayAlpha(int /*<<< orphan*/, double *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void showAlpha(double *alpha) {
  displayAlpha(stdout, alpha);
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<showAlpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <displayAlpha@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showAlpha>:
push   %rbx
mov    %rdi,%rsi
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
call   1030 <displayAlpha@plt>
mov    (%rbx),%edi
lea    0xec5(%rip),%rsi
pop    %rbx
jmp    1040 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @showAlpha(double* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @displayAlpha(i32 %2, double* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
int scheduler() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @scheduler() {
ret i32 0
}
int f(int a, int b) { return a + b; }


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

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

LLVM IR (-O0):
define i32 @f(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
int configSetAttributeInt(attribute, value)
char *attribute;
int value;
{
  char temp[50];
  sprintf(temp, "%d", value);
  return (configSetAttribute(attribute, temp));
}


x86 assembly (clang, -O0):
<configSetAttributeInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1030 <configSetAttribute@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<configSetAttributeInt>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xecd(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <configSetAttribute@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @configSetAttributeInt(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [50 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%11 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @configSetAttribute to i32 (i8*, i8*, ...)*)(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @configSetAttributeInt(i8* %0, i32 %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @configSetAttribute to i32 (i8*, i8*, ...)*)(i8* %0, i8* %4)
ret i32 %6
}
/* Variables and functions */
size_t getArrayLength(void *context) { return 3; }


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

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

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

LLVM IR (-O2):
define i64 @getArrayLength(i8* nocapture readnone %0) {
ret i64 3
}
int HelpItem150(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem150() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void usage(void) { die("i386_reloc [--abs | --text] vmlinux\n"); }


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"i386_reloc [--abs | --text] vmlinux\0A\00"
define void @usage() {
%1 = call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"i386_reloc [--abs | --text] vmlinux\0A\00"
define void @usage() {
%1 = tail call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct section {
  int dummy;
};
struct pair {
  int dummy;
};

/* Variables and functions */
struct pair *pair_last(int /*<<< orphan*/);
int /*<<< orphan*/ section_get(struct section *, char *);
struct pair *section_get_last(struct section *section, char *key) {
  return pair_last(section_get(section, key));
}


x86 assembly (clang, -O0):
<section_get_last>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <section_get@plt>
mov    %eax,%edi
call   1040 <pair_last@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<section_get_last>:
push   %rax
call   1030 <section_get@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <pair_last@plt>

LLVM IR (-O0):
%struct.pair = type { i32 }
%struct.section = type { i32 }
define %struct.pair* @section_get_last(%struct.section* %0, i8* %1) {
%3 = alloca %struct.section*
%4 = alloca i8*
store %struct.section* %0, %struct.section** %3
store i8* %1, i8** %4
%5 = load %struct.section*, %struct.section** %3
%6 = load i8*, i8** %4
%7 = call i32 @section_get(%struct.section* %5, i8* %6)
%8 = call %struct.pair* @pair_last(i32 %7)
ret %struct.pair* %8
}

LLVM IR (-O2):
%struct.pair = type { i32 }
%struct.section = type { i32 }
define %struct.pair* @section_get_last(%struct.section* %0, i8* %1) {
%3 = tail call i32 @section_get(%struct.section* %0, i8* %1)
%4 = tail call %struct.pair* @pair_last(i32 %3)
ret %struct.pair* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int file_write(char *filename, char *data) {
  FILE *fp;
  fp = fopen(filename, "w");
  if (fp == NULL)
    return 1;
  fprintf(fp, "%s", (char *)data);
  fclose(fp);
  return 1;
}


x86 assembly (clang, -O0):
<file_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    116b <file_write+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    118f <file_write+0x5f>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_write>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     115e <file_write+0x2e>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @file_write(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %18
12: ; preds = %2
%13 = load i32*, i32** %6
%14 = load i8*, i8** %5
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32*, i32** %6
%17 = call i32 @fclose(i32* %16)
store i32 1, i32* %3
br label %18
18: ; preds = %12, %11
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
define i32 @file_write(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @fputs(i8* %1, i32* %3)
%7 = tail call i32 @fclose(i32* %3)
br label %8
8: ; preds = %2, %5
ret i32 1
}
/* Variables and functions */
int sys_main(int, char **);
int main(int argc, char **argv) { return (sys_main(argc, argv)); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <sys_main@plt>

LLVM IR (-O0):
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @sys_main(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @sys_main(i32 %0, i8** %1)
ret i32 %3
}
unsigned char rev_bits_in_byte(unsigned char x) {
  int rev = (x >> 4) | ((x & 0xf) << 4);
  rev = ((rev & 0xcc) >> 2) | ((rev & 0x33) << 2);
  rev = ((rev & 0xaa) >> 1) | ((rev & 0x55) << 1);
  return (unsigned char)rev;
}


x86 assembly (clang, -O0):
<rev_bits_in_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
movzbl -0x1(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xcc,%eax
sar    $0x2,%eax
mov    -0x8(%rbp),%ecx
and    $0x33,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xaa,%eax
sar    $0x1,%eax
mov    -0x8(%rbp),%ecx
and    $0x55,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_bits_in_byte>:
rol    $0x4,%dil
mov    %edi,%eax
and    $0x33,%al
shl    $0x2,%al
shr    $0x2,%dil
and    $0x33,%dil
or     %dil,%al
mov    %eax,%ecx
and    $0x55,%cl
add    %cl,%cl
shr    %al
and    $0x55,%al
or     %cl,%al
ret

LLVM IR (-O0):
define zeroext i8 @rev_bits_in_byte(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = ashr i32 %5, 4
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = and i32 %8, 15
%10 = shl i32 %9, 4
%11 = or i32 %6, %10
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = and i32 %12, 204
%14 = ashr i32 %13, 2
%15 = load i32, i32* %3
%16 = and i32 %15, 51
%17 = shl i32 %16, 2
%18 = or i32 %14, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = and i32 %19, 170
%21 = ashr i32 %20, 1
%22 = load i32, i32* %3
%23 = and i32 %22, 85
%24 = shl i32 %23, 1
%25 = or i32 %21, %24
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = trunc i32 %26 to i8
ret i8 %27
}

LLVM IR (-O2):
define zeroext i8 @rev_bits_in_byte(i8 zeroext %0) {
%2 = tail call i8 @llvm.bitreverse.i8(i8 %0)
ret i8 %2
}
/* Variables and functions */
unsigned int elf_hash(char *);
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, char *argv[], char *envp[]) {
  unsigned int o0_1;
  o0_1 = elf_hash("main");
  printf("elf_hash(\"main\") is %x\n", o0_1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xebf(%rip),%rdi
call   1040 <elf_hash@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"main\00"
@.str.1 = [24 x i8] c"elf_hash(\22main\22) is %x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @elf_hash(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
void RFCClockDisable(void) {
  (*((volatile unsigned long *)(0x60040000 + 0x00000000))) = 0x0;
}


x86 assembly (clang, -O0):
<RFCClockDisable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x60040000,%eax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RFCClockDisable>:
movq   $0x0,0x60040000
ret

LLVM IR (-O0):
define void @RFCClockDisable() {
store volatile i64 0, i64* inttoptr (i64 1610874880 to i64*)
ret void
}

LLVM IR (-O2):
define void @RFCClockDisable() {
store volatile i64 0, i64* inttoptr (i64 1610874880 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert_ptr_equal_(char *, int, int *, int *);
void test_ptr_equal_fail() {
  int x = 1, y = 2;
  int *p1 = &x, *p2 = &y;
  assert_ptr_equal_("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/hughbien/assertive/refs/"
                    "heads/master/test/fail_test.c",
                    48, (p1), (p2));
}


x86 assembly (clang, -O0):
<test_ptr_equal_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xebb(%rip),%rdi
mov    $0x30,%esi
call   1030 <assert_ptr_equal_@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ptr_equal_fail>:
push   %rax
movl   $0x1,0x4(%rsp)
movl   $0x2,(%rsp)
lea    0xed9(%rip),%rdi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    $0x30,%esi
call   1030 <assert_ptr_equal_@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hughbien/assertive/refs/heads/master/test/fail_test.c\00"
define void @test_ptr_equal_fail() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32 1, i32* %1
store i32 2, i32* %2
store i32* %1, i32** %3
store i32* %2, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i32 @assert_ptr_equal_(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 48, i32* %5, i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hughbien/assertive/refs/heads/master/test/fail_test.c\00"
define void @test_ptr_equal_fail() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%5 = call i32 @assert_ptr_equal_(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 48, i32* %1, i32* %2)
ret void
}
/* Type definitions */
struct mpool {
  int dummy;
};

/* Variables and functions */
void *mpool_strndup(struct mpool *, char const *, size_t);
size_t strlen(char const *);
void *mpool_strdup(struct mpool *pool, const char *str) {
  size_t len;
  if (!str)
    return NULL;
  len = strlen(str);
  return mpool_strndup(pool, str, len);
}


x86 assembly (clang, -O0):
<mpool_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <mpool_strdup+0x28>
movq   $0x0,-0x8(%rbp)
jmp    116a <mpool_strdup+0x4a>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <mpool_strndup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpool_strdup>:
test   %rsi,%rsi
je     114c <mpool_strdup+0x2c>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <mpool_strndup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.mpool = type { i32 }
define i8* @mpool_strdup(%struct.mpool* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca %struct.mpool*
%5 = alloca i8*
%6 = alloca i64
store %struct.mpool* %0, %struct.mpool** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %2
store i8* null, i8** %3
br label %17
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %6
%13 = load %struct.mpool*, %struct.mpool** %4
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = call i8* @mpool_strndup(%struct.mpool* %13, i8* %14, i64 %15)
store i8* %16, i8** %3
br label %17
17: ; preds = %10, %9
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
%struct.mpool = type { i32 }
define i8* @mpool_strdup(%struct.mpool* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i64 @strlen(i8* %1)
%6 = tail call i8* @mpool_strndup(%struct.mpool* %0, i8* %1, i64 %5)
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ null, %2 ]
ret i8* %8
}
int main() {
  int x;
  x = 50;
  do
    x = x - 1;
  while (x);
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1112 <main+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int fb_is_primary_device(struct fb_info *info) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.fb_info = type opaque
define i32 @fb_is_primary_device(%struct.fb_info* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("dmesg -c");
  system("> /var/log/syslog");
  system("clear");
  system("clear");
  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 <system@plt>
lea    0xed7(%rip),%rdi
call   1030 <system@plt>
lea    0xedd(%rip),%rdi
call   1030 <system@plt>
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <system@plt>
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
lea    0xeeb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"dmesg -c\00"
@.str.1 = [18 x i8] c"> /var/log/syslog\00"
@.str.2 = [6 x i8] c"clear\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"dmesg -c\00"
@.str.1 = [18 x i8] c"> /var/log/syslog\00"
@.str.2 = [6 x i8] c"clear\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
int test_imm_E4int8_reg(signed char val) {
  return ((val) & (0xE4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E4int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xe4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E4int8_reg>:
test   $0xe4,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E4int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 228
%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_E4int8_reg(i8 signext %0) {
%2 = and i8 %0, -28
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ declare_arrayN(int, int, int, int);
int **declare_int(int first, int second) {
  return (int **)declare_arrayN(2, sizeof(int), first, second);
}


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

x86 assembly (clang, -O2):
<declare_int>:
mov    %esi,%ecx
mov    %edi,%edx
mov    $0x2,%edi
mov    $0x4,%esi
jmp    1030 <declare_arrayN@plt>

LLVM IR (-O0):
define i32** @declare_int(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i64 @declare_arrayN(i32 2, i32 4, i32 %5, i32 %6)
%8 = inttoptr i64 %7 to i32**
ret i32** %8
}

LLVM IR (-O2):
define i32** @declare_int(i32 %0, i32 %1) {
%3 = tail call i64 @declare_arrayN(i32 2, i32 4, i32 %0, i32 %1)
%4 = inttoptr i64 %3 to i32**
ret i32** %4
}
void TimerM$AlarmControl$setControlAsCompare(void) {
  MSP430TimerM$ControlB3$setControlAsCompare();
}


x86 assembly (clang, -O0):
<TimerM$AlarmControl$setControlAsCompare>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <MSP430TimerM$ControlB3$setControlAsCompare@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerM$AlarmControl$setControlAsCompare>:
xor    %eax,%eax
jmp    1030 <MSP430TimerM$ControlB3$setControlAsCompare@plt>

LLVM IR (-O0):
define void @"TimerM$AlarmControl$setControlAsCompare"() {
%1 = call i32 (...) @"MSP430TimerM$ControlB3$setControlAsCompare"()
ret void
}

LLVM IR (-O2):
define void @"TimerM$AlarmControl$setControlAsCompare"() {
%1 = tail call i32 (...) @"MSP430TimerM$ControlB3$setControlAsCompare"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ eerror(char *);
scalar_t__ unlink(char const *);
int deletepid(const char *filename) {
  if (unlink(filename) < 0) {
    eerror("Failed to delete file");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<deletepid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
jge    1157 <deletepid+0x37>
lea    0xeba(%rip),%rdi
call   1040 <eerror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <deletepid+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deletepid>:
push   %rax
call   1030 <unlink@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1132 <deletepid+0x12>
pop    %rcx
ret
lea    0xec7(%rip),%rdi
call   1040 <eerror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Failed to delete file\00"
define i32 @deletepid(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @unlink(i8* %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @eerror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %7
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@.str = [22 x i8] c"Failed to delete file\00"
define i32 @deletepid(i8* nocapture %0) {
%2 = tail call i64 @unlink(i8* %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @eerror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void const *, size_t);
void gg_append(char *dst, size_t *pos, const void *src, size_t len) {
  if (dst != NULL)
    memcpy(&dst[*pos], src, len);
  *pos += len;
}


x86 assembly (clang, -O0):
<gg_append>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <gg_append+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
add    (%rax),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gg_append>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rsi,%rbx
test   %rdi,%rdi
je     112d <gg_append+0x1d>
add    (%rbx),%rdi
mov    %rdx,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
add    %r14,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @gg_append(i8* %0, i64* nocapture %1, i8* %2, i64 %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = load i64, i64* %1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @memcpy(i8* %8, i8* %2, i64 %3)
br label %10
10: ; preds = %6, %4
%11 = load i64, i64* %1
%12 = add i64 %11, %3
store i64 %12, i64* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ stress_mlock_region(void **, void **);
void stress_mlock_executable(void) {
  extern void *__start_mlocked_text;
  extern void *__stop_mlocked_text;
  stress_mlock_region(&__start_mlocked_text, &__stop_mlocked_text);
}


x86 assembly (clang, -O0):
<stress_mlock_executable>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rdi
mov    0x2eae(%rip),%rsi
call   1030 <stress_mlock_region@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_mlock_executable>:
mov    0x2ed1(%rip),%rdi
mov    0x2eb2(%rip),%rsi
jmp    1030 <stress_mlock_region@plt>

LLVM IR (-O0):
@__start_mlocked_text = external global i8*
@__stop_mlocked_text = external global i8*
define void @stress_mlock_executable() {
%1 = call i32 @stress_mlock_region(i8** @__start_mlocked_text, i8** @__stop_mlocked_text)
ret void
}

LLVM IR (-O2):
@__start_mlocked_text = external global i8*
@__stop_mlocked_text = external global i8*
define void @stress_mlock_executable() {
%1 = tail call i32 @stress_mlock_region(i8** @__start_mlocked_text, i8** @__stop_mlocked_text)
ret void
}
Jsetcursor(c) register c;
{
  outportb(0x3d4, 0xe);
  outportb(0x3d5, c >> 8);
  outportb(0x3d4, 0xf);
  outportb(0x3d5, c);
}


x86 assembly (clang, -O0):
<Jsetcursor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x3d4,%edi
mov    $0xe,%esi
mov    $0x0,%al
call   1030 <outportb@plt>
mov    -0x8(%rbp),%esi
sar    $0x8,%esi
mov    $0x3d5,%edi
mov    $0x0,%al
call   1030 <outportb@plt>
mov    $0x3d4,%edi
mov    $0xf,%esi
mov    $0x0,%al
call   1030 <outportb@plt>
mov    -0x8(%rbp),%esi
mov    $0x3d5,%edi
mov    $0x0,%al
call   1030 <outportb@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Jsetcursor>:
push   %rbx
mov    %edi,%ebx
mov    $0x3d4,%edi
mov    $0xe,%esi
xor    %eax,%eax
call   1030 <outportb@plt>
mov    %ebx,%esi
sar    $0x8,%esi
mov    $0x3d5,%edi
xor    %eax,%eax
call   1030 <outportb@plt>
mov    $0x3d4,%edi
mov    $0xf,%esi
xor    %eax,%eax
call   1030 <outportb@plt>
mov    $0x3d5,%edi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <outportb@plt>

LLVM IR (-O0):
define i32 @Jsetcursor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 980, i32 14)
%5 = load i32, i32* %3
%6 = ashr i32 %5, 8
%7 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 981, i32 %6)
%8 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 980, i32 15)
%9 = load i32, i32* %3
%10 = call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 981, i32 %9)
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @Jsetcursor(i32 %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 980, i32 14)
%3 = ashr i32 %0, 8
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 981, i32 %3)
%5 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 980, i32 15)
%6 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @outportb to i32 (i32, i32, ...)*)(i32 981, i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void local_step(char *buf) { printf(buf); }


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

x86 assembly (clang, -O2):
<local_step>:
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
define void @local_step(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) %0)
ret void
}