xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ unsetvar(char *);
int cmd_unsetvar(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "usage: unset name\n");
    return 0;
  }
  unsetvar(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_unsetvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     115a <cmd_unsetvar+0x3a>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    116e <cmd_unsetvar+0x4e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <unsetvar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_unsetvar>:
push   %rax
cmp    $0x2,%edi
jne    1131 <cmd_unsetvar+0x11>
mov    0x8(%rsi),%rdi
call   1030 <unsetvar@plt>
jmp    1146 <cmd_unsetvar+0x26>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"usage: unset name\0A\00"
define i32 @cmd_unsetvar(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @unsetvar(i8* %14)
store i32 0, i32* %3
br label %16
16: ; preds = %11, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"usage: unset name\0A\00"
define i32 @cmd_unsetvar(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %11
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @unsetvar(i8* %9)
br label %11
11: ; preds = %7, %4
ret i32 0
}
int Media_DVD_ForceFormat(int format) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Media_DVD_ForceFormat(i32 %0) {
ret i32 0
}
void XMaxRequestSize() {}


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

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

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

LLVM IR (-O2):
define void @XMaxRequestSize() {
ret void
}
void nseel_asm_shr_end(void) {}


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

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

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

LLVM IR (-O2):
define void @nseel_asm_shr_end() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isalpha(char);
int /*<<< orphan*/ strcpy(char *, char *);
int LineaValida(char *linea) {
  char CommentChar = '#';
  char line[200 + 2];
  strcpy(line, linea);
  if (line[0] == CommentChar) {
    return 0;
  }
  if (!isalpha(line[0])) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<LineaValida>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0x23,-0x11(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
movsbl -0xe0(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1162 <LineaValida+0x42>
movl   $0x0,-0x4(%rbp)
jmp    118a <LineaValida+0x6a>
movsbl -0xe0(%rbp),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    1183 <LineaValida+0x63>
movl   $0x0,-0x4(%rbp)
jmp    118a <LineaValida+0x6a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LineaValida>:
sub    $0xd8,%rsp
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    (%rsp),%cl
xor    %eax,%eax
cmp    $0x23,%cl
je     114d <LineaValida+0x2d>
movsbl %cl,%edi
call   1040 <isalpha@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
add    $0xd8,%rsp
ret

LLVM IR (-O0):
define i32 @LineaValida(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [202 x i8]
store i8* %0, i8** %3
store i8 35, i8* %4
%6 = getelementptr inbounds [202 x i8], [202 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [202 x i8], [202 x i8]* %5, i64 0, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %11, %13
br i1 %14, label %15, label %16
15: ; preds = %1
store i32 0, i32* %2
br label %23
16: ; preds = %1
%17 = getelementptr inbounds [202 x i8], [202 x i8]* %5, i64 0, i64 0
%18 = load i8, i8* %17
%19 = call i32 @isalpha(i8 signext %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16
store i32 0, i32* %2
br label %23
22: ; preds = %16
store i32 1, i32* %2
br label %23
23: ; preds = %22, %21, %15
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @LineaValida(i8* %0) {
%2 = alloca [202 x i8]
%3 = getelementptr inbounds [202 x i8], [202 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 35
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = call i32 @isalpha(i8 signext %5)
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %1
%12 = phi i32 [ 0, %1 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print2(int x) { printf("El numero es: %d\n", x); }


x86 assembly (clang, -O0):
<print2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print2>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"El numero es: %d\0A\00"
define void @print2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"El numero es: %d\0A\00"
define void @print2(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int boaAddAccessLimit(char *url, void *am, short secure, char *group) {
  return 0;
}


x86 assembly (clang, -O0):
<boaAddAccessLimit>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @boaAddAccessLimit(i8* nocapture readnone %0, i8* nocapture readnone %1, i16 signext %2, i8* nocapture readnone %3) {
ret i32 0
}
void _mpu_init(void) {}


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

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

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

LLVM IR (-O2):
define void @_mpu_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int *);
int main() {
  int *x;
  f(x);
  *x = 7;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rdi
call   1030 <f@plt>
mov    -0x8(%rbp),%rax
movl   $0x7,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <f@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32* undef)
unreachable
}
/* 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 *);
void fclose_t() {
  FILE *fp;
  fp = fopen("file.txt", "w");
  fprintf(fp, "%s", "This is tutorialspoint.com");
  fclose(fp);
}


x86 assembly (clang, -O0):
<fclose_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
lea    0xead(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclose_t>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [27 x i8] c"This is tutorialspoint.com\00"
define void @fclose_t() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%5 = load i32*, i32** %1
%6 = call i32 @fclose(i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.3 = [27 x i8] c"This is tutorialspoint.com\00"
define void @fclose_t() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i64 26, i64 1, i32* %1)
%3 = tail call i32 @fclose(i32* %1)
ret void
}
void zero_array(char *begin, const char const *end) {
  char *array = begin;
  for (array = begin; array < end; array++) {
    *array = 0;
  }
}


x86 assembly (clang, -O0):
<zero_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1142 <zero_array+0x42>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111c <zero_array+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_array>:
cmp    %rsi,%rdi
jae    1127 <zero_array+0x17>
push   %rax
mov    %rsi,%rdx
sub    %rdi,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @zero_array(i8* writeonly %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = ptrtoint i8* %1 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int getpagesize();
unsigned long page_align(unsigned long addr) {
  return ((addr + getpagesize() - 1) & ~(getpagesize() - 1));
}


x86 assembly (clang, -O0):
<page_align>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getpagesize@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
sub    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpagesize@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<page_align>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getpagesize@plt>
cltq
add    %rax,%rbx
add    $0xffffffffffffffff,%rbx
xor    %eax,%eax
call   1030 <getpagesize@plt>
neg    %eax
cltq
and    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @page_align(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 (...) @getpagesize()
%5 = sext i32 %4 to i64
%6 = add i64 %3, %5
%7 = sub i64 %6, 1
%8 = call i32 (...) @getpagesize()
%9 = sub nsw i32 %8, 1
%10 = xor i32 %9, -1
%11 = sext i32 %10 to i64
%12 = and i64 %7, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @page_align(i64 %0) {
%2 = tail call i32 (...) @getpagesize()
%3 = sext i32 %2 to i64
%4 = add i64 %0, -1
%5 = add i64 %4, %3
%6 = tail call i32 (...) @getpagesize()
%7 = sub i32 0, %6
%8 = sext i32 %7 to i64
%9 = and i64 %5, %8
ret i64 %9
}
int do_520() { return 520; }


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

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

LLVM IR (-O0):
define i32 @do_520() {
ret i32 520
}

LLVM IR (-O2):
define i32 @do_520() {
ret i32 520
}
/* Variables and functions */
int /*<<< orphan*/ CreatePath(char *);
int LoadFile(char *, void **);
int /*<<< orphan*/ SaveFile(char *, void *, int);
int /*<<< orphan*/ free(void *);
void CopyFile(char *from, char *to) {
  void *buffer;
  int length;
  length = LoadFile(from, &buffer);
  CreatePath(to);
  SaveFile(to, buffer, length);
  free(buffer);
}


x86 assembly (clang, -O0):
<CopyFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <LoadFile@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <CreatePath@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <SaveFile@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CopyFile>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rsp,%rsi
call   1060 <LoadFile@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <CreatePath@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1050 <SaveFile@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @CopyFile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @LoadFile(i8* %7, i8** %5)
store i32 %8, i32* %6
%9 = load i8*, i8** %4
%10 = call i32 @CreatePath(i8* %9)
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i32 @SaveFile(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %5
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
define void @CopyFile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @LoadFile(i8* %0, i8** %3)
%6 = call i32 @CreatePath(i8* %1)
%7 = load i8*, i8** %3
%8 = call i32 @SaveFile(i8* %1, i8* %7, i32 %5)
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
ret void
}
int CLAMP(int value, int Minim, int Maxim) {
  if (value < Minim)
    value = Minim;
  if (value > Maxim)
    value = Maxim;
  return value;
}


x86 assembly (clang, -O0):
<CLAMP>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    111f <CLAMP+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1131 <CLAMP+0x31>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CLAMP>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
cmp    %edx,%eax
cmovg  %edx,%eax
ret

LLVM IR (-O0):
define i32 @CLAMP(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32, i32* %5
store i32 %11, i32* %4
br label %12
12: ; preds = %10, %3
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i32, i32* %6
store i32 %17, i32* %4
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @CLAMP(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void print_load_error(char *filename) {
  fprintf(stderr, "error occured when loading file \"%s\". Terminating.\n",
          filename);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<print_load_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_load_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [52 x i8] c"error occured when loading file \22%s\22. Terminating.\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_load_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [52 x i8] c"error occured when loading file \22%s\22. Terminating.\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_load_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
scalar_t__ test_file();
int main(int argc, const char *argv[]) {
  int status = test_file() ? 0 : 1;
  fprintf(stdout, "File Test: %s\n", (status ? "failed" : "passed"));
  return status;
}


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    $0x0,%al
call   1030 <test_file@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%ecx
lea    0xeb2(%rip),%rdx
lea    0xea4(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe87(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <test_file@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rax
lea    0xecf(%rip),%rdx
cmove  %rax,%rdx
lea    0xeae(%rip),%rsi
call   1040 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [15 x i8] c"File Test: %s\0A\00"
@.str.1 = [7 x i8] c"failed\00"
@.str.2 = [7 x i8] c"passed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 (...) @test_file()
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
store i32 %10, i32* %6
%11 = load i32, i32* @stdout
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%16 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [15 x i8] c"File Test: %s\0A\00"
@.str.1 = [7 x i8] c"failed\00"
@.str.2 = [7 x i8] c"passed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @test_file()
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = load i32, i32* @stdout
%7 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 %5
}
int TestRunningInBrowser(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @TestRunningInBrowser() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int getW2Graph(int sizeGraph) {
  assert(sizeGraph <= 14);
  return sizeGraph * sizeGraph + 1;
}


x86 assembly (clang, -O0):
<getW2Graph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xe,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getW2Graph>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0xf,%ebx
setl   %dil
call   1030 <assert@plt>
imul   %ebx,%ebx
add    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getW2Graph(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 14
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 %7, %8
%10 = add nsw i32 %9, 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @getW2Graph(i32 %0) {
%2 = icmp slt i32 %0, 15
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = mul nsw i32 %0, %0
%6 = add nuw nsw i32 %5, 1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char const);
const char *CP_SkipChars(const char *ptr) {
  while ((*ptr != 0) && (!isspace(*ptr)))
    ++ptr;
  return ptr;
}


x86 assembly (clang, -O0):
<CP_SkipChars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1148 <CP_SkipChars+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1158 <CP_SkipChars+0x48>
jmp    1169 <CP_SkipChars+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <CP_SkipChars+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CP_SkipChars>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1138 <CP_SkipChars+0x28>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <CP_SkipChars+0x28>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <CP_SkipChars+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @CP_SkipChars(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %16, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i32 @isspace(i8 signext %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br label %14
14: ; preds = %8, %3
%15 = phi i1 [ false, %3 ], [ %13, %8 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %3
19: ; preds = %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @CP_SkipChars(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i32 @isspace(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int n;
  printf("Enter n\n");
  scanf("%d", &n);
  printf("Factorial of n : %d\n", fact(n));
  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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,%esi
lea    0xe97(%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    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <fact@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"Factorial of n : %d\0A\00"
@str = [8 x i8] c"Enter n\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @fact(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
struct Hero {
  int dummy;
};
struct Ability {
  int dummy;
};

/* Variables and functions */
float damage_RollAttack(struct Hero *);
float FenShen_damage(struct Ability *self, struct Hero *attacker,
                     struct Hero *target) {
  return damage_RollAttack(attacker) * (float)(1.0 - 0.62);
}


x86 assembly (clang, -O0):
<FenShen_damage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <damage_RollAttack@plt>
movss  0xecb(%rip),%xmm1
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FenShen_damage>:
push   %rax
mov    %rsi,%rdi
call   1030 <damage_RollAttack@plt>
mulss  0xedf(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.Ability = type { i32 }
%struct.Hero = type { i32 }
define float @FenShen_damage(%struct.Ability* %0, %struct.Hero* %1, %struct.Hero* %2) {
%4 = alloca %struct.Ability*
%5 = alloca %struct.Hero*
%6 = alloca %struct.Hero*
store %struct.Ability* %0, %struct.Ability** %4
store %struct.Hero* %1, %struct.Hero** %5
store %struct.Hero* %2, %struct.Hero** %6
%7 = load %struct.Hero*, %struct.Hero** %5
%8 = call float @damage_RollAttack(%struct.Hero* %7)
%9 = fmul float %8, 0x3FD851EB80000000
ret float %9
}

LLVM IR (-O2):
%struct.Ability = type { i32 }
%struct.Hero = type { i32 }
define float @FenShen_damage(%struct.Ability* nocapture readnone %0, %struct.Hero* %1, %struct.Hero* nocapture readnone %2) {
%4 = tail call float @damage_RollAttack(%struct.Hero* %1)
%5 = fmul float %4, 0x3FD851EB80000000
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ NewSymbol(char const *, int);
void CBMSystem(const char *Sys) {
  NewSymbol("__CBM__", 1);
  NewSymbol(Sys, 1);
}


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

x86 assembly (clang, -O2):
<CBMSystem>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <NewSymbol@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <NewSymbol@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"__CBM__\00"
define void @CBMSystem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @NewSymbol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = load i8*, i8** %2
%5 = call i32 @NewSymbol(i8* %4, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"__CBM__\00"
define void @CBMSystem(i8* %0) {
%2 = tail call i32 @NewSymbol(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 @NewSymbol(i8* %0, i32 1)
ret void
}
/* Variables and functions */
int round(double);
void round_w_d(double *source, int *dest) { *dest = round(*source); }


x86 assembly (clang, -O0):
<round_w_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <round@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_w_d>:
push   %rbx
mov    %rsi,%rbx
movsd  (%rdi),%xmm0
call   1030 <round@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @round_w_d(double* %0, i32* %1) {
%3 = alloca double*
%4 = alloca i32*
store double* %0, double** %3
store i32* %1, i32** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = call i32 @round(double %6)
%8 = load i32*, i32** %4
store i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @round_w_d(double* nocapture %0, i32* nocapture writeonly %1) {
%3 = load double, double* %0
%4 = tail call i32 @round(double %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *xmalloc(scalar_t__);
char *xstrdup(char *str) {
  char *newstr = xmalloc(strlen(str) + 1);
  strcpy(newstr, str);
  return newstr;
}


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

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

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

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int __gen_tempname(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                   int /*<<< orphan*/);
int mkstemp(char *template) { return __gen_tempname(template, 0, 0, 0); }


x86 assembly (clang, -O0):
<mkstemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <__gen_tempname@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkstemp>:
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <__gen_tempname@plt>

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

LLVM IR (-O2):
define i32 @mkstemp(i8* %0) {
%2 = tail call i32 @__gen_tempname(i8* %0, i32 0, i32 0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
int ft_putchar(char c) {
  write(1, &c, 1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edx
lea    -0x1(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putchar>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ft_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @ft_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
ret i32 0
}
/* Variables and functions */
int strlen(char *);
void stripNewLine(char *name) {
  int len;
  len = strlen(name);
  if (name[len - 1] == '\n')
    name[len - 1] = 0;
}


x86 assembly (clang, -O0):
<stripNewLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1153 <stripNewLine+0x43>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stripNewLine>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1127 <stripNewLine+0x17>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @stripNewLine(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %1
store i8 0, i8* %5
br label %9
9: ; preds = %8, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int x = 0;
  for (int i = 0; i != 10; i = i + 1) {
    x = x + i;
  }
  assert(x == 45);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
je     114e <main+0x3e>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
cmpl   $0x2d,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
store i32 %10, i32* %2
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 45
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
char *strnpbrk(char const *, size_t, char *);
size_t cmdSeparatorPos(const char *cmd, size_t len) {
  char *separator = strnpbrk(cmd, len, ":?");
  size_t result;
  if (separator == NULL) {
    result = len;
  } else {
    result = separator - cmd;
  }
  return result;
}


x86 assembly (clang, -O0):
<cmdSeparatorPos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xed1(%rip),%rdx
call   1030 <strnpbrk@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <cmdSeparatorPos+0x40>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    115f <cmdSeparatorPos+0x4f>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdSeparatorPos>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdx
call   1030 <strnpbrk@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
test   %rax,%rax
cmove  %r14,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c":?\00"
define i64 @cmdSeparatorPos(i8* %0, i64 %1) {
%3 = tail call i8* @strnpbrk(i8* %0, i64 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = select i1 %4, i64 %1, i64 %7
ret i64 %8
}
int foo(a, b)
int a;
char *b;
{ printf("do something useful"); }


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

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

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

LLVM IR (-O2):
@.str = [20 x i8] c"do something useful\00"
define i32 @foo(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int is_base64(char c) {
  if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
      (c >= '0' && c <= '9') || (c == '+') || (c == '/') || (c == '=')) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_base64>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1124 <is_base64+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    117f <is_base64+0x7f>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     113e <is_base64+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    117f <is_base64+0x7f>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1158 <is_base64+0x58>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    117f <is_base64+0x7f>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     117f <is_base64+0x7f>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
je     117f <is_base64+0x7f>
movsbl -0x5(%rbp),%eax
cmp    $0x3d,%eax
jne    118b <is_base64+0x8b>
movl   $0x1,-0x4(%rbp)
jmp    1192 <is_base64+0x92>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_base64>:
mov    %edi,%eax
and    $0xdf,%al
add    $0xbf,%al
cmp    $0x1a,%al
setb   %al
lea    -0x2f(%rdi),%ecx
cmp    $0xb,%cl
setb   %cl
or     %al,%cl
cmp    $0x3d,%dil
sete   %al
cmp    $0x2b,%dil
sete   %dl
or     %al,%dl
or     %cl,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @is_base64(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %39, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 122
br i1 %18, label %39, label %19
19: ; preds = %15, %11
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 57
br i1 %26, label %39, label %27
27: ; preds = %23, %19
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 43
br i1 %30, label %39, label %31
31: ; preds = %27
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 47
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i8, i8* %3
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 61
br i1 %38, label %39, label %40
39: ; preds = %35, %31, %27, %23, %15, %7
store i32 1, i32* %2
br label %41
40: ; preds = %35
store i32 0, i32* %2
br label %41
41: ; preds = %40, %39
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
define i32 @is_base64(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = add i8 %0, -47
%6 = icmp ult i8 %5, 11
%7 = or i1 %6, %4
%8 = icmp eq i8 %0, 61
%9 = icmp eq i8 %0, 43
%10 = or i1 %8, %9
%11 = or i1 %10, %7
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t get_MEM_MAX() { return 0xFFFF; }


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

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

LLVM IR (-O0):
define i32 @get_MEM_MAX() {
ret i32 65535
}

LLVM IR (-O2):
define i32 @get_MEM_MAX() {
ret i32 65535
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void clear() {
  puts("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
       "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
       "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
}


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

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

LLVM IR (-O0):
@.str = [99 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
define void @clear() {
%1 = call i32 @puts(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [99 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
define void @clear() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int vegas_spead_packet_seq_num(int heap_cntr, int heap_offset,
                                        int packets_per_heap) {
  return (heap_cntr * packets_per_heap) + (heap_offset / 8192);
}


x86 assembly (clang, -O0):
<vegas_spead_packet_seq_num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2000,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vegas_spead_packet_seq_num>:
imul   %edx,%edi
lea    0x1fff(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0xd,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @vegas_spead_packet_seq_num(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %5
%11 = sdiv i32 %10, 8192
%12 = add nsw i32 %9, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @vegas_spead_packet_seq_num(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %0
%5 = sdiv i32 %1, 8192
%6 = add nsw i32 %4, %5
ret i32 %6
}