xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ ispent(long);
int /*<<< orphan*/ printf(char *, int, long);
int main(void) {
  int i = 143;
  long answer = 0;
  while (1) {
    i++;
    answer = i * (2 * i - 1);
    if (ispent(answer)) {
      printf("Problem 45 - Answer: %d -> %lu\n", i, answer);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x8f,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ispent@plt>
cmp    $0x0,%rax
je     1187 <main+0x67>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
jmp    118c <main+0x6c>
jmp    113e <main+0x1e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x90,%r14d
mov    $0x11f,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rbx
imul   %r14,%rbx
mov    %rbx,%rdi
call   1030 <ispent@plt>
add    $0x1,%r14
add    $0x2,%r15
test   %rax,%rax
je     1140 <main+0x20>
add    $0xffffffff,%r14d
lea    0xe99(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [32 x i8] c"Problem 45 - Answer: %d -> %lu\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ %3, %1 ], [ 143, %0 ]
%3 = add nuw nsw i64 %2, 1
%4 = shl nuw nsw i64 %3, 1
%5 = add nsw i64 %4, -1
%6 = mul nsw i64 %5, %3
%7 = tail call i64 @ispent(i64 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %1, label %9
9: ; preds = %1
%10 = trunc i64 %3 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %10, i64 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_8() {
  Assert_real((isqrt(8) == 2),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              45, ("Integer square root of 8 should be 2"));
}


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

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

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

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [37 x i8] c"Integer square root of 8 should be 2\00"
define void @t_sqrt_8() {
%1 = tail call i32 @isqrt(i32 8)
%2 = icmp eq i32 %1, 2
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int match(char const *, char *);
int is_root(const char *rawString) {
  char *regexString = "[0-9]{2} \\.[ ]?$";
  return match(rawString, regexString);
}


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

x86 assembly (clang, -O2):
<is_root>:
lea    0xee9(%rip),%rsi
jmp    1030 <match@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"[0-9]{2} \\.[ ]?$\00"
define i32 @is_root(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %3
%6 = call i32 @match(i8* %4, i8* %5)
ret i32 %6
}

LLVM IR (-O2):
@.str = [17 x i8] c"[0-9]{2} \\.[ ]?$\00"
define i32 @is_root(i8* %0) {
%2 = tail call i32 @match(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
void *xlocate_elem(struct list *, void *, int /*<<< orphan*/,
                   int /*<<< orphan*/);
void *locate_elem(struct list *l, void *elem) {
  return (xlocate_elem(l, elem, 0, 0));
}


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

x86 assembly (clang, -O2):
<locate_elem>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <xlocate_elem@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
define i8* @locate_elem(%struct.list* %0, i8* %1) {
%3 = alloca %struct.list*
%4 = alloca i8*
store %struct.list* %0, %struct.list** %3
store i8* %1, i8** %4
%5 = load %struct.list*, %struct.list** %3
%6 = load i8*, i8** %4
%7 = call i8* @xlocate_elem(%struct.list* %5, i8* %6, i32 0, i32 0)
ret i8* %7
}

LLVM IR (-O2):
%struct.list = type { i32 }
define i8* @locate_elem(%struct.list* %0, i8* %1) {
%3 = tail call i8* @xlocate_elem(%struct.list* %0, i8* %1, i32 0, i32 0)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ERROR(char *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
FILE *bbobOpenFile(char *fileName) {
  FILE *fileId;
  fileId = fopen(fileName, "a");
  if (fileId == NULL)
    ERROR("Could not open %s", fileName);
  return fileId;
}


x86 assembly (clang, -O0):
<bbobOpenFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115b <bbobOpenFile+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1030 <ERROR@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbobOpenFile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <bbobOpenFile+0x2a>
lea    0xec0(%rip),%rdi
mov    %r14,%rsi
call   1030 <ERROR@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [18 x i8] c"Could not open %s\00"
define i32* @bbobOpenFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @ERROR(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load i32*, i32** %3
ret i32* %12
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [18 x i8] c"Could not open %s\00"
define noalias i32* @bbobOpenFile(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @ERROR(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
ret i32* %2
}
int ocurrencias(char *str, char *buff) { return 3; }


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

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

LLVM IR (-O0):
define i32 @ocurrencias(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 3
}

LLVM IR (-O2):
define i32 @ocurrencias(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 3
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_date(char *buffer) {
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  strftime(buffer, 80, "%m%d%H%M%Y.%S", timeinfo);
}


x86 assembly (clang, -O0):
<get_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <time@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x50,%esi
lea    0xe9a(%rip),%rdx
call   1050 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_date>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
lea    0xead(%rip),%rdx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [14 x i8] c"%m%d%H%M%Y.%S\00"
define void @get_date(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.tm*
store i8* %0, i8** %2
%5 = call i32 @time(i32* %3)
%6 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %6, %struct.tm** %4
%7 = load i8*, i8** %2
%8 = load %struct.tm*, %struct.tm** %4
%9 = call i32 @strftime(i8* %7, i32 80, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [14 x i8] c"%m%d%H%M%Y.%S\00"
define void @get_date(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @localtime(i32* %2)
%6 = call i32 @strftime(i8* %0, i32 80, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t str_hash(const char *s) {
  char c;
  uint32_t h = 5381;
  while ((c = *s++))
    h = ((h << 5) + h) ^ c;
  return h;
}


x86 assembly (clang, -O0):
<str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x9(%rbp)
cmp    $0x0,%al
je     1142 <str_hash+0x42>
mov    -0x10(%rbp),%eax
shl    $0x5,%eax
add    -0x10(%rbp),%eax
movsbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    110f <str_hash+0xf>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <str_hash+0x28>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %eax,%edx
shl    $0x5,%edx
add    %eax,%edx
movsbl %cl,%eax
xor    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i32 @str_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = mul i32 %6, 33
%10 = sext i8 %5 to i32
%11 = xor i32 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 5381, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Type definitions */
typedef int x;
typedef int uint64_t;

/* Variables and functions */
void fp64_parsefin(uint64_t x, bool *ps, int *pe, uint64_t *pf) {
  bool sx = ((x) >> 63 & 1);
  int ex = ((x) >> 52 & 0x7ff);
  uint64_t fx = ((x)&0xfffffffffffffLL);
  *ps = sx;
  if (!ex) {
    *pe = 1;
    *pf = fx;
  } else {
    *pe = ex;
    *pf = 0x10000000000000LL + fx;
  }
}


x86 assembly (clang, -O0):
<fp64_parsefin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3f,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x34,%ecx
sar    %cl,%eax
and    $0x7ff,%eax
mov    %eax,-0x28(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xfffffffffffff,%rcx
and    %rcx,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x28(%rbp)
jne    1174 <fp64_parsefin+0x74>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1196 <fp64_parsefin+0x96>
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movslq -0x2c(%rbp),%rax
movabs $0x10000000000000,%rcx
add    %rcx,%rax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp64_parsefin>:
movl   $0x1,(%rdx)
mov    %edi,(%rcx)
ret

LLVM IR (-O0):
define void @fp64_parsefin(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%12 = load i32, i32* %5
%13 = ashr i32 %12, 63
%14 = and i32 %13, 1
store i32 %14, i32* %9
%15 = load i32, i32* %5
%16 = ashr i32 %15, 52
%17 = and i32 %16, 2047
store i32 %17, i32* %10
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = and i64 %19, 4503599627370495
%21 = trunc i64 %20 to i32
store i32 %21, i32* %11
%22 = load i32, i32* %9
%23 = load i32*, i32** %6
store i32 %22, i32* %23
%24 = load i32, i32* %10
%25 = icmp ne i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %4
%27 = load i32*, i32** %7
store i32 1, i32* %27
%28 = load i32, i32* %11
%29 = load i32*, i32** %8
store i32 %28, i32* %29
br label %38
30: ; preds = %4
%31 = load i32, i32* %10
%32 = load i32*, i32** %7
store i32 %31, i32* %32
%33 = load i32, i32* %11
%34 = sext i32 %33 to i64
%35 = add nsw i64 4503599627370496, %34
%36 = trunc i64 %35 to i32
%37 = load i32*, i32** %8
store i32 %36, i32* %37
br label %38
38: ; preds = %30, %26
ret void
}

LLVM IR (-O2):
define void @fp64_parsefin(i32 %0, i32* nocapture readnone %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
store i32 1, i32* %2
store i32 %0, i32* %3
ret void
}
long close(long fd) {
  long ret = 0;
  asm("movq $6,%%rax  \n\t"
      "movq %1,%%rbx  \n\t"
      "int $0x80  \n\t"
      "movq %%rax,%0 \n\t"
      : "=m"(ret)
      : "m"(fd));
  return ret;
}


x86 assembly (clang, -O0):
<close>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x6,%rax
mov    -0x8(%rbp),%rbx
int    $0x80
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<close>:
mov    %rdi,-0x8(%rsp)
movq   $0x0,-0x10(%rsp)
mov    $0x6,%rax
mov    -0x8(%rsp),%rbx
int    $0x80
mov    %rax,-0x10(%rsp)
mov    -0x10(%rsp),%rax
ret

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

LLVM IR (-O2):
define i64 @close(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = load i64, i64* %3
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ retrieve_and_write(int, int);
int /*<<< orphan*/ scanf(char *, int *);
void test_solution_retrieval(int n) {
  int k;
  printf("Give k : ");
  scanf("%d", &k);
  retrieve_and_write(n, k);
}


x86 assembly (clang, -O0):
<test_solution_retrieval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <retrieve_and_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_solution_retrieval>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %ebx,%edi
call   1040 <retrieve_and_write@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"Give k : \00"
@.str.1 = [3 x i8] c"%d\00"
define void @test_solution_retrieval(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @retrieve_and_write(i32 %0, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sel4bench_private_switch_user_pmc(int);
int /*<<< orphan*/ sel4bench_private_write_intenc(int);
void sel4bench_private_init(void *data) {
  sel4bench_private_switch_user_pmc(1);
  sel4bench_private_write_intenc(-1);
}


x86 assembly (clang, -O0):
<sel4bench_private_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <sel4bench_private_switch_user_pmc@plt>
mov    $0xffffffff,%edi
call   1040 <sel4bench_private_write_intenc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sel4bench_private_init>:
push   %rax
mov    $0x1,%edi
call   1030 <sel4bench_private_switch_user_pmc@plt>
mov    $0xffffffff,%edi
pop    %rax
jmp    1040 <sel4bench_private_write_intenc@plt>

LLVM IR (-O0):
define void @sel4bench_private_init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sel4bench_private_switch_user_pmc(i32 1)
%4 = call i32 @sel4bench_private_write_intenc(i32 -1)
ret void
}

LLVM IR (-O2):
define void @sel4bench_private_init(i8* nocapture readnone %0) {
%2 = tail call i32 @sel4bench_private_switch_user_pmc(i32 1)
%3 = tail call i32 @sel4bench_private_write_intenc(i32 -1)
ret void
}
void print_use(void) { return; }


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

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

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

LLVM IR (-O2):
define void @print_use() {
ret void
}
int execute_lchown() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_lchown() {
ret i32 0
}
foo(a) {
  auto p;
  typedef bar;
}


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

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 undef
}
int nisplusdomain_set(const char *ifname, int ifindex, const char *domain) {
  return 0;
}


x86 assembly (clang, -O0):
<nisplusdomain_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @nisplusdomain_set(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
ret i32 0
}
void X509_set_ex_data(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_set_ex_data() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_entity(int /*<<< orphan*/, char *,
                                             char *);
void test_coq_comment_entities() {
  test_parser_verify_entity(test_parser_sourcefile("coq", " (*comment*)"),
                            "comment", "(*comment*)");
}


x86 assembly (clang, -O0):
<test_coq_comment_entities>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xed1(%rip),%rsi
lea    0xebe(%rip),%rdx
call   1040 <test_parser_verify_entity@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_coq_comment_entities>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
lea    0xed6(%rip),%rsi
lea    0xec3(%rip),%rdx
mov    %eax,%edi
pop    %rax
jmp    1040 <test_parser_verify_entity@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"coq\00"
@.str.1 = [13 x i8] c" (*comment*)\00"
@.str.2 = [8 x i8] c"comment\00"
@.str.3 = [12 x i8] c"(*comment*)\00"
define void @test_coq_comment_entities() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_entity(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"coq\00"
@.str.1 = [13 x i8] c" (*comment*)\00"
@.str.2 = [8 x i8] c"comment\00"
@.str.3 = [12 x i8] c"(*comment*)\00"
define void @test_coq_comment_entities() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_entity(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int Pop();
int /*<<< orphan*/ Push(int);
void DoCmp() {
  int a = Pop();
  int b = Pop();
  if (a < b)
    Push(1);
  else if (a > b)
    Push(-1);
  else
    Push(0);
}


x86 assembly (clang, -O0):
<DoCmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1157 <DoCmp+0x37>
mov    $0x1,%edi
call   1040 <Push@plt>
jmp    117e <DoCmp+0x5e>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1172 <DoCmp+0x52>
mov    $0xffffffff,%edi
call   1040 <Push@plt>
jmp    1179 <DoCmp+0x59>
xor    %edi,%edi
call   1040 <Push@plt>
jmp    117e <DoCmp+0x5e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoCmp>:
push   %rbx
xor    %eax,%eax
call   1030 <Pop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <Pop@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
setg   %cl
neg    %ecx
cmp    %eax,%ebx
mov    $0x1,%edi
cmovge %ecx,%edi
pop    %rbx
jmp    1040 <Push@plt>

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

LLVM IR (-O2):
define void @DoCmp() {
%1 = tail call i32 (...) @Pop()
%2 = tail call i32 (...) @Pop()
%3 = icmp slt i32 %1, %2
%4 = icmp sgt i32 %1, %2
%5 = sext i1 %4 to i32
%6 = select i1 %3, i32 1, i32 %5
%7 = tail call i32 @Push(i32 %6)
ret void
}
long long push_digit(long long i, char c) {
  int digit = c - '0';
  return 10 * i + digit;
}


x86 assembly (clang, -O0):
<push_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
imul   $0xa,-0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_digit>:
movslq %esi,%rax
lea    (%rdi,%rdi,4),%rcx
lea    (%rax,%rcx,2),%rax
add    $0xffffffffffffffd0,%rax
ret

LLVM IR (-O0):
define i64 @push_digit(i64 %0, i8 signext %1) {
%3 = alloca i64
%4 = alloca i8
%5 = alloca i32
store i64 %0, i64* %3
store i8 %1, i8* %4
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = sub nsw i32 %7, 48
store i32 %8, i32* %5
%9 = load i64, i64* %3
%10 = mul nsw i64 10, %9
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = add nsw i64 %10, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @push_digit(i64 %0, i8 signext %1) {
%3 = sext i8 %1 to i64
%4 = mul nsw i64 %0, 10
%5 = add i64 %4, -48
%6 = add i64 %5, %3
ret i64 %6
}
int test_imm_AFint32_reg(int val) { return ((val) & (0xAF << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_AFint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xaf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_AFint32_reg(i32 %0) {
%2 = and i32 %0, 175
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void grab() {
  asm volatile("callq _grab\n\t"
               "nop;nop;nop;nop;  nop;nop;nop;nop\n\t"
               "nop;nop;nop;nop;  nop;nop;nop;nop\n\t"
               "_grab:\n\t" ::
                   :);
}


x86 assembly (clang, -O0):
<grab>:
push   %rbp
mov    %rsp,%rbp
call   1119 <_grab>
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop

x86 assembly (clang, -O2):
<grab>:
call   1115 <_grab>
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop

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

LLVM IR (-O2):
define void @grab() {
tail call void asm sideeffect "callq _grab\0A\09nop;nop;nop;nop; nop;nop;nop;nop\0A\09nop;nop;nop;nop; nop;nop;nop;nop\0A\09_grab:\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void R_ETHER_Callback_Link_On(void) {}


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

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

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

LLVM IR (-O2):
define void @R_ETHER_Callback_Link_On() {
ret void
}
int funcD() { return 4; }


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

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

LLVM IR (-O0):
define i32 @funcD() {
ret i32 4
}

LLVM IR (-O2):
define i32 @funcD() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ get_string(char *);
int sscanf(char *, char *, long *);
char *tt_error_txt(char *, int);
char *macttErrorCodes(char *arg) {
  long i;
  get_string(arg);
  if (sscanf(arg, "%ld", &i) != 1)
    return arg;
  return tt_error_txt(arg, (int)i);
}


x86 assembly (clang, -O0):
<macttErrorCodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <get_string@plt>
mov    -0x10(%rbp),%rdi
lea    0xeb0(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     116f <macttErrorCodes+0x3f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1182 <macttErrorCodes+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %eax,%esi
call   1030 <tt_error_txt@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macttErrorCodes>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <get_string@plt>
lea    0xebc(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1165 <macttErrorCodes+0x35>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <tt_error_txt@plt>
mov    %rax,%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
define i8* @macttErrorCodes(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @get_string(i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %4)
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i8*, i8** %3
store i8* %11, i8** %2
br label %17
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i64, i64* %4
%15 = trunc i64 %14 to i32
%16 = call i8* @tt_error_txt(i8* %13, i32 %15)
store i8* %16, i8** %2
br label %17
17: ; preds = %12, %10
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define i8* @macttErrorCodes(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = tail call i32 @get_string(i8* %0)
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i64, i64* %2
%9 = trunc i64 %8 to i32
%10 = call i8* @tt_error_txt(i8* %0, i32 %9)
br label %11
11: ; preds = %1, %7
%12 = phi i8* [ %10, %7 ], [ %0, %1 ]
ret i8* %12
}
/* Variables and functions */
char *malloc(size_t);
void init_char(char **buf, size_t *l, size_t *i) {
  *l = 80;
  *buf = malloc(*l);
  (*buf)[0] = 0;
  *i = 0;
}


x86 assembly (clang, -O0):
<init_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x50,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_char>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
movq   $0x50,(%rsi)
mov    $0x50,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
movb   $0x0,(%rax)
movq   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @init_char(i8** nocapture writeonly %0, i64* nocapture writeonly %1, i64* nocapture writeonly %2) {
store i64 80, i64* %1
%4 = tail call dereferenceable_or_null(80) i8* @malloc(i64 80)
store i8* %4, i8** %0
store i8 0, i8* %4
store i64 0, i64* %2
ret void
}
/* Type definitions */
struct _LwVM {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(struct _LwVM *);
void cleanup(FILE *img_f, struct _LwVM *LwVM) {
  free(LwVM);
  fclose(img_f);
}


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

x86 assembly (clang, -O2):
<cleanup>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fclose@plt>

LLVM IR (-O0):
%struct._LwVM = type { i32 }
define void @cleanup(i32* %0, %struct._LwVM* %1) {
%3 = alloca i32*
%4 = alloca %struct._LwVM*
store i32* %0, i32** %3
store %struct._LwVM* %1, %struct._LwVM** %4
%5 = load %struct._LwVM*, %struct._LwVM** %4
%6 = call i32 @free(%struct._LwVM* %5)
%7 = load i32*, i32** %3
%8 = call i32 @fclose(i32* %7)
ret void
}

LLVM IR (-O2):
%struct._LwVM = type { i32 }
define void @cleanup(i32* nocapture %0, %struct._LwVM* nocapture %1) {
%3 = tail call i32 @free(%struct._LwVM* %1)
%4 = tail call i32 @fclose(i32* %0)
ret void
}
int hasChar(char s[], char c) {
  int i = 0;
  while (s[i] != '\0')
    if (s[i++] == c)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<hasChar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115d <hasChar+0x5d>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1158 <hasChar+0x58>
movl   $0x1,-0x4(%rbp)
jmp    1164 <hasChar+0x64>
jmp    1115 <hasChar+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasChar>:
movzbl (%rdi),%eax
test   %al,%al
je     1116 <hasChar+0x16>
add    $0x1,%rdi
cmp    %sil,%al
jne    1100 <hasChar>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hasChar(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i64 [ %9, %8 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = add nuw i64 %4, 1
%10 = icmp eq i8 %6, %1
br i1 %10, label %11, label %3
11: ; preds = %3, %8
%12 = phi i32 [ 1, %8 ], [ 0, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ kprint_at(char *, int, int);
void kprint(char *message) { kprint_at(message, -1, -1); }


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

x86 assembly (clang, -O2):
<kprint>:
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
jmp    1030 <kprint_at@plt>

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

LLVM IR (-O2):
define void @kprint(i8* %0) {
%2 = tail call i32 @kprint_at(i8* %0, i32 -1, i32 -1)
ret void
}
/* Variables and functions */
int write(int, char *, int);
int main(int args, char *argc[]) {
  char *message = "Hola mundo!\n";
  if (write(1, message, 13) != 13) {
    write(2, "This is awkward\n", 17);
    return -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)
lea    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x1,%edi
mov    $0xd,%edx
call   1030 <write@plt>
cmp    $0xd,%eax
je     116f <main+0x5f>
mov    $0x2,%edi
lea    0xeb4(%rip),%rsi
mov    $0x11,%edx
call   1030 <write@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1176 <main+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
mov    $0xd,%edx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
je     114b <main+0x3b>
lea    0xed6(%rip),%rsi
mov    $0x2,%edi
mov    $0x11,%edx
call   1030 <write@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hola mundo!\0A\00"
@.str.1 = [17 x i8] c"This is awkward\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @write(i32 1, i8* %7, i32 13)
%9 = icmp ne i32 %8, 13
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @write(i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 17)
store i32 -1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %10
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hola mundo!\0A\00"
@.str.1 = [17 x i8] c"This is awkward\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 13)
%4 = icmp eq i32 %3, 13
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 17)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int intakeNumber() {
  int iNumber;
  printf("\n Enter a random number : ");
  scanf("%d", &iNumber);
  return iNumber;
}


x86 assembly (clang, -O0):
<intakeNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intakeNumber>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"\0A Enter a random number : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @intakeNumber() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0A Enter a random number : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @intakeNumber() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ usage();
void error() {
  usage();
  exit(-1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <usage@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
xor    %eax,%eax
call   1030 <usage@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error() {
%1 = call i32 (...) @usage()
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @error() {
%1 = tail call i32 (...) @usage()
%2 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
scalar_t__ pow(float, int);
float sqrt(scalar_t__);
float per_trigon(float plev1, float plev2) {
  float ypot;
  ypot = sqrt(pow(plev1, 2) + pow(plev2, 2));
  return ypot + plev1 + plev2;
}


x86 assembly (clang, -O0):
<per_trigon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<per_trigon>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,%rbx
movss  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1040 <sqrt@plt>
addss  0xc(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @per_trigon(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = call i64 @pow(float %6, i32 2)
%8 = load float, float* %4
%9 = call i64 @pow(float %8, i32 2)
%10 = add nsw i64 %7, %9
%11 = call float @sqrt(i64 %10)
store float %11, float* %5
%12 = load float, float* %5
%13 = load float, float* %3
%14 = fadd float %12, %13
%15 = load float, float* %4
%16 = fadd float %14, %15
ret float %16
}

LLVM IR (-O2):
define float @per_trigon(float %0, float %1) {
%3 = tail call i64 @pow(float %0, i32 2)
%4 = tail call i64 @pow(float %1, i32 2)
%5 = add nsw i64 %4, %3
%6 = tail call float @sqrt(i64 %5)
%7 = fadd float %6, %0
%8 = fadd float %7, %1
ret float %8
}
const char *busstate_str(unsigned int value) {
  static const char *states[4] = {"off", "on", "tristate", "unknown"};
  if (value > 3)
    value = 3;
  return states[value];
}


x86 assembly (clang, -O0):
<busstate_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jbe    1118 <busstate_str+0x18>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2f0c(%rip),%rax
mov    (%rax,%rcx,8),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<busstate_str>:
cmp    $0x3,%edi
mov    $0x3,%eax
cmovb  %edi,%eax
lea    0xeee(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@busstate_str.states = internal global [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0)]
@.str = [4 x i8] c"off\00"
@.str.1 = [3 x i8] c"on\00"
@.str.2 = [9 x i8] c"tristate\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @busstate_str(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ugt i32 %3, 3
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 3, i32* %2
br label %6
6: ; preds = %5, %1
%7 = load i32, i32* %2
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* @busstate_str.states, i64 0, i64 %8
%10 = load i8*, i8** %9
ret i8* %10
}

LLVM IR (-O2):
@reltable.busstate_str = internal unnamed_addr constant [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.busstate_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.busstate_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.busstate_str to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.busstate_str to i64)) to i32)]
@.str = [4 x i8] c"off\00"
@.str.1 = [3 x i8] c"on\00"
@.str.2 = [9 x i8] c"tristate\00"
@.str.3 = [8 x i8] c"unknown\00"
define i8* @busstate_str(i32 %0) {
%2 = icmp ult i32 %0, 3
%3 = select i1 %2, i32 %0, i32 3
%4 = zext i32 %3 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.busstate_str to i8*), i64 %5)
ret i8* %6
}
int sys_get_pid() {
  int a;
  asm volatile("int $0x80" : "=a"(a) : "0"(5));
  return a;
}


x86 assembly (clang, -O0):
<sys_get_pid>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%eax
int    $0x80
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sys_get_pid() {
%1 = alloca i32
%2 = call i32 asm sideeffect "int $$0x80", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i32 5)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @sys_get_pid() {
%1 = tail call i32 asm sideeffect "int $$0x80", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i32 5)
ret i32 %1
}