xunge/DecIR huggingface dataset:
const char *streamFilesuffix(int filetype) {
  static const char fileSuffix[][5] = {"",    ".grb", ".grb", ".nc",  ".nc",
                                       ".nc", ".nc",  ".srv", ".ext", ".ieg"};
  int size = (int)(sizeof(fileSuffix) / sizeof(fileSuffix[0]));
  if (filetype > 0 && filetype < size)
    return (fileSuffix[filetype]);
  else
    return (fileSuffix[0]);
}


x86 assembly (clang, -O0):
<streamFilesuffix>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    113f <streamFilesuffix+0x3f>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    113f <streamFilesuffix+0x3f>
movslq -0xc(%rbp),%rcx
lea    0xed1(%rip),%rax
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    114a <streamFilesuffix+0x4a>
lea    0xeba(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<streamFilesuffix>:
movslq %edi,%rax
add    $0xffffffff,%edi
lea    (%rax,%rax,4),%rax
lea    0xeef(%rip),%rcx
add    %rcx,%rax
cmp    $0x9,%edi
cmovae %rcx,%rax
ret

LLVM IR (-O0):
@streamFilesuffix.fileSuffix = internal constant [10 x [5 x i8]] [[5 x i8] zeroinitializer, [5 x i8] c".grb\00", [5 x i8] c".grb\00", [5 x i8] c".nc\00\00", [5 x i8] c".nc\00\00", [5 x i8] c".nc\00\00", [5 x i8] c".nc\00\00", [5 x i8] c".srv\00", [5 x i8] c".ext\00", [5 x i8] c".ieg\00"]
define i8* @streamFilesuffix(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 10, i32* %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x [5 x i8]], [10 x [5 x i8]]* @streamFilesuffix.fileSuffix, i64 0, i64 %13
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %14, i64 0, i64 0
store i8* %15, i8** %2
br label %17
16: ; preds = %7, %1
store i8* getelementptr inbounds ([10 x [5 x i8]], [10 x [5 x i8]]* @streamFilesuffix.fileSuffix, i64 0, i64 0, i64 0), i8** %2
br label %17
17: ; preds = %16, %11
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@streamFilesuffix.fileSuffix = internal constant [10 x [5 x i8]] [[5 x i8] zeroinitializer, [5 x i8] c".grb\00", [5 x i8] c".grb\00", [5 x i8] c".nc\00\00", [5 x i8] c".nc\00\00", [5 x i8] c".nc\00\00", [5 x i8] c".nc\00\00", [5 x i8] c".srv\00", [5 x i8] c".ext\00", [5 x i8] c".ieg\00"]
define i8* @streamFilesuffix(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 9
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [10 x [5 x i8]], [10 x [5 x i8]]* @streamFilesuffix.fileSuffix, i64 0, i64 %4, i64 0
%6 = select i1 %3, i8* %5, i8* getelementptr inbounds ([10 x [5 x i8]], [10 x [5 x i8]]* @streamFilesuffix.fileSuffix, i64 0, i64 0, i64 0)
ret i8* %6
}
void pr8486() { printf("%s", 1); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @pr8486() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
double floor(int /*<<< orphan*/);
int /*<<< orphan*/ log10(double);
double pow(double, double);
int /*<<< orphan*/ sprintf(char *, char *, double, int);
int __etoa(char *buffer, double n, int precision) {
  double exponent;
  exponent = floor(log10(n));
  n /= pow(10.0, exponent);
  sprintf(buffer, "%fe%d", n, (int)exponent);
  return 0;
}


x86 assembly (clang, -O0):
<__etoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log10@plt>
mov    %eax,%edi
call   1060 <floor@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xe89(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x20(%rbp),%edx
lea    0xe66(%rip),%rsi
call   1050 <sprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__etoa>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
call   1040 <log10@plt>
mov    %eax,%edi
call   1060 <floor@plt>
movaps %xmm0,%xmm1
movsd  %xmm0,(%rsp)
movsd  0xe96(%rip),%xmm0
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si (%rsp),%edx
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
movapd %xmm1,%xmm0
call   1050 <sprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%fe%d\00"
define i32 @__etoa(i8* %0, double %1, i32 %2) {
%4 = alloca i8*
%5 = alloca double
%6 = alloca i32
%7 = alloca double
store i8* %0, i8** %4
store double %1, double* %5
store i32 %2, i32* %6
%8 = load double, double* %5
%9 = call i32 @log10(double %8)
%10 = call double @floor(i32 %9)
store double %10, double* %7
%11 = load double, double* %7
%12 = call double @pow(double 1.000000e+01, double %11)
%13 = load double, double* %5
%14 = fdiv double %13, %12
store double %14, double* %5
%15 = load i8*, i8** %4
%16 = load double, double* %5
%17 = load double, double* %7
%18 = fptosi double %17 to i32
%19 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %16, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%fe%d\00"
define i32 @__etoa(i8* nocapture writeonly %0, double %1, i32 %2) {
%4 = tail call i32 @log10(double %1)
%5 = tail call double @floor(i32 %4)
%6 = tail call double @pow(double 1.000000e+01, double %5)
%7 = fdiv double %1, %6
%8 = fptosi double %5 to i32
%9 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %7, i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ put64(unsigned long long);
int /*<<< orphan*/ put8(int);
void mov_reg64_imm64(int reg64, unsigned long long imm64) {
  put8(0x48);
  put8(0xB8 + reg64);
  put64(imm64);
}


x86 assembly (clang, -O0):
<mov_reg64_imm64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x48,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
add    $0xb8,%edi
call   1030 <put8@plt>
mov    -0x10(%rbp),%rdi
call   1040 <put64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_reg64_imm64>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x48,%edi
call   1030 <put8@plt>
add    $0xb8,%ebp
mov    %ebp,%edi
call   1030 <put8@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <put64@plt>

LLVM IR (-O0):
define void @mov_reg64_imm64(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = call i32 @put8(i32 72)
%6 = load i32, i32* %3
%7 = add nsw i32 184, %6
%8 = call i32 @put8(i32 %7)
%9 = load i64, i64* %4
%10 = call i32 @put64(i64 %9)
ret void
}

LLVM IR (-O2):
define void @mov_reg64_imm64(i32 %0, i64 %1) {
%3 = tail call i32 @put8(i32 72)
%4 = add nsw i32 %0, 184
%5 = tail call i32 @put8(i32 %4)
%6 = tail call i32 @put64(i64 %1)
ret void
}
/* Variables and functions */
int *allocate_ints(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ set_ints(int *, int);
int main(void) {
  int *ints = allocate_ints(10);
  if (ints == NULL) {
    exit(1);
  }
  set_ints(ints, 10);
  free(ints);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <allocate_ints@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1172 <main+0x32>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1050 <set_ints@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
call   1030 <allocate_ints@plt>
test   %rax,%rax
je     116c <main+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1050 <set_ints@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @allocate_ints(i32 10)
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = load i32*, i32** %2
%10 = call i32 @set_ints(i32* %9, i32 10)
%11 = load i32*, i32** %2
%12 = call i32 @free(i32* %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @allocate_ints(i32 10)
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %0
%6 = tail call i32 @set_ints(i32* %1, i32 10)
%7 = tail call i32 @free(i32* %1)
ret i32 0
}
unsigned long hash(char *str, unsigned m) {
  unsigned long v = 0L;
  for (; *str; str++) {
    v = ((v << 7) + *str);
  }
  return v % m;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1148 <hash+0x48>
mov    -0x18(%rbp),%rax
shl    $0x7,%rax
mov    -0x8(%rbp),%rcx
movsbq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <hash+0x13>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <hash+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
shl    $0x7,%rax
movsbq %cl,%rcx
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
jmp    112a <hash+0x2a>
xor    %eax,%eax
mov    %esi,%ecx
mov    %rax,%rdx
shr    $0x20,%rdx
je     113e <hash+0x3e>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i64 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %0, %2 ]
%9 = shl i64 %7, 7
%10 = sext i8 %6 to i64
%11 = add i64 %9, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i64 [ 0, %2 ], [ %11, %5 ]
%17 = zext i32 %1 to i64
%18 = urem i64 %16, %17
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int fd;
  unsigned char key_val;
  fd = open("/dev/buttons", O_RDWR);
  if (fd < 0) {
    printf("can't open!\n");
  }
  while (1) {
    sleep(5);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1174 <main+0x44>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <main+0x49>
mov    $0x5,%edi
call   1050 <sleep@plt>
jmp    1179 <main+0x49>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1040 <open@plt>
test   %eax,%eax
jns    1160 <main+0x30>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x5,%edi
call   1050 <sleep@plt>
jmp    1160 <main+0x30>

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/buttons\00"
@O_RDWR = global i32 0
@.str.1 = [13 x i8] c"can't open!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @O_RDWR
%9 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
br label %15
15: ; preds = %14, %15
%16 = call i32 @sleep(i32 5)
br label %15
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/buttons\00"
@O_RDWR = global i32 0
@str = [12 x i8] c"can't open!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_RDWR
%4 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
br label %9
9: ; preds = %8, %9
%10 = tail call i32 @sleep(i32 5)
br label %9
}
/* Variables and functions */
char *getenv(char *);
const char *username() {
  const char *username = getenv("USER");
  if (NULL == username) {
    username = "default";
  }
  return username;
}


x86 assembly (clang, -O0):
<username>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    113f <username+0x2f>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<username>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xede(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"USER\00"
@.str.1 = [8 x i8] c"default\00"
define i8* @username() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* null, %3
br i1 %4, label %5, label %6
5: ; preds = %0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %6
6: ; preds = %5, %0
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
@.str.1 = [8 x i8] c"default\00"
define i8* @username() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1
ret i8* %3
}
void seq_lseek(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<seq_lseek>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq_lseek>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.seq_lseek = [10 x i8] c"seq_lseek\00"
define void @seq_lseek() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__func__.seq_lseek, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.seq_lseek = [10 x i8] c"seq_lseek\00"
define void @seq_lseek() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__func__.seq_lseek, i64 0, i64 0))
ret void
}
void RunRobotStop(struct Robot *robot) {}


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

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

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

LLVM IR (-O2):
%struct.Robot = type opaque
define void @RunRobotStop(%struct.Robot* nocapture %0) {
ret void
}
const char *greeting(void) { return "Hello from C land"; }


x86 assembly (clang, -O0):
<greeting>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<greeting>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Hello from C land\00"
define i8* @greeting() {
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [18 x i8] c"Hello from C land\00"
define i8* @greeting() {
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ fib(int);
int /*<<< orphan*/ naive_printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ naive_scanf(char *, int *);
int program_main() {
  int n;
  while (1) {
    naive_scanf("%d", &n);
    if (n < 0)
      break;
    naive_printf("%d\n", fib(n));
  }
  return 0;
}


x86 assembly (clang, -O0):
<program_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <naive_scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jge    1157 <program_main+0x27>
jmp    1172 <program_main+0x42>
mov    -0x4(%rbp),%edi
call   1050 <fib@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
call   1040 <naive_printf@plt>
jmp    1138 <program_main+0x8>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<program_main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <naive_scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
js     1192 <program_main+0x62>
lea    0xeaa(%rip),%r14
lea    0xea0(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
call   1050 <fib@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <naive_printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <naive_scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jns    1170 <program_main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @program_main() {
%1 = alloca i32
br label %2
2: ; preds = %0, %7
%3 = call i32 @naive_scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
br label %11
7: ; preds = %2
%8 = load i32, i32* %1
%9 = call i32 @fib(i32 %8)
%10 = call i32 @naive_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %2
11: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @program_main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @naive_scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %11, %6 ], [ %4, %0 ]
%8 = call i32 @fib(i32 %7)
%9 = call i32 @naive_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @naive_scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %0
ret i32 0
}
/* Type definitions */
struct hdr_histogram {
  int dummy;
};
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ counts_get_normalised(struct hdr_histogram const *,
                                         int /*<<< orphan*/);
int64_t hdr_count_at_index(const struct hdr_histogram *h, int32_t index) {
  return counts_get_normalised(h, index);
}


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

x86 assembly (clang, -O2):
<hdr_count_at_index>:
jmp    1030 <counts_get_normalised@plt>

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

LLVM IR (-O2):
%struct.hdr_histogram = type { i32 }
define i32 @hdr_count_at_index(%struct.hdr_histogram* %0, i32 %1) {
%3 = tail call i32 @counts_get_normalised(%struct.hdr_histogram* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int strlen(const char *str) {
  int x;
  for (x = 0; str[x] != 0; x++)
    ;
  return x;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <strlen+0x37>
jmp    1129 <strlen+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, char *);
void ReadString(char *str) {
  char c;
  int i = -1;
  do {
    i++;
    scanf("%c", &c);
    str[i] = c;
  } while (c != 10);
  str[i] = 0;
}


x86 assembly (clang, -O0):
<ReadString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    1123 <ReadString+0x13>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadString>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xedd(%rip),%r14
lea    0xf(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <scanf@plt>
movzbl 0xf(%rsp),%eax
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1130 <ReadString+0x20>
movb   $0x0,-0x1(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @ReadString(i8* nocapture writeonly %0) {
%2 = alloca i8
br label %3
3: ; preds = %3, %1
%4 = phi i64 [ %5, %3 ], [ -1, %1 ]
%5 = add i64 %4, 1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %7, i8* %8
%9 = icmp eq i8 %7, 10
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int /*<<< orphan*/ __NR_unlinkat;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, char const *);
__attribute__((always_)) int _syscall_unlink(const char *pathname) {
  return syscall(__NR_unlinkat, AT_FDCWD, pathname);
}


x86 assembly (clang, -O0):
<_syscall_unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_syscall_unlink>:
mov    %rdi,%rdx
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_unlinkat = global i32 0
@AT_FDCWD = global i32 0
define i32 @_syscall_unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @__NR_unlinkat
%4 = load i32, i32* @AT_FDCWD
%5 = load i8*, i8** %2
%6 = call i32 @syscall(i32 %3, i32 %4, i8* %5)
ret i32 %6
}

LLVM IR (-O2):
@__NR_unlinkat = global i32 0
@AT_FDCWD = global i32 0
define i32 @_syscall_unlink(i8* %0) {
%2 = load i32, i32* @__NR_unlinkat
%3 = load i32, i32* @AT_FDCWD
%4 = tail call i32 @syscall(i32 %2, i32 %3, i8* %0)
ret i32 %4
}
int b43_pcmcia_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @b43_pcmcia_init() {
ret i32 0
}
void kasan_poison_slab(struct page *page) {}


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

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

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

LLVM IR (-O2):
%struct.page = type opaque
define void @kasan_poison_slab(%struct.page* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *xalloc(size_t);
void *xalloc_zero(size_t size) {
  void *result = xalloc(size);
  memset(result, 0, size);
  return result;
}


x86 assembly (clang, -O0):
<xalloc_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <xalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xalloc_zero>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <xalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @xalloc_zero(i64 %0) {
%2 = tail call i8* @xalloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ clean(int);
int read(int, char *, int);
int /*<<< orphan*/ reportError(char *);
int target(int fd) {
  char buffer[10];
  int bs = read(fd, buffer, 5);
  if (bs < 0) {
    reportError(buffer);
    clean(fd);
    return -30;
  }
  return bs + 6;
}


x86 assembly (clang, -O0):
<target>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
mov    $0x5,%edx
call   1030 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1176 <target+0x46>
lea    -0x12(%rbp),%rdi
call   1040 <reportError@plt>
mov    -0x8(%rbp),%edi
call   1050 <clean@plt>
movl   $0xffffffe2,-0x4(%rbp)
jmp    117f <target+0x4f>
mov    -0x18(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x6(%rsp),%rsi
mov    $0x5,%edx
call   1030 <read@plt>
test   %eax,%eax
js     114f <target+0x1f>
add    $0x6,%eax
jmp    1165 <target+0x35>
lea    0x6(%rsp),%rdi
call   1040 <reportError@plt>
mov    %ebx,%edi
call   1050 <clean@plt>
mov    $0xffffffe2,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @target(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%8 = call i32 @read(i32 %6, i8* %7, i32 5)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%13 = call i32 @reportError(i8* %12)
%14 = load i32, i32* %3
%15 = call i32 @clean(i32 %14)
store i32 -30, i32* %2
br label %19
16: ; preds = %1
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 6
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @target(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 5)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @reportError(i8* %3)
%8 = call i32 @clean(i32 %0)
br label %11
9: ; preds = %1
%10 = add nuw nsw i32 %4, 6
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ -30, %6 ], [ %10, %9 ]
ret i32 %12
}
void yldisp_ringer_vol_up() {}


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

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

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

LLVM IR (-O2):
define void @yldisp_ringer_vol_up() {
ret void
}
double ephAltToPhi(double alt) { return 90.0 - alt; }


x86 assembly (clang, -O0):
<ephAltToPhi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ephAltToPhi>:
movsd  0xef8(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ephAltToPhi(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double 9.000000e+01, %3
ret double %4
}

LLVM IR (-O2):
define double @ephAltToPhi(double %0) {
%2 = fsub double 9.000000e+01, %0
ret double %2
}
void hputi4(hstring, keyword, ival) char *hstring;
char *keyword;
int ival;
{
  char value[30];
  sprintf(value, "%d", ival);
  hputc(hstring, keyword, value);
  return;
}


x86 assembly (clang, -O0):
<hputi4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1030 <hputc@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hputi4>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeca(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <hputc@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @hputi4(i8* %0, i8* %1, i32 %2) {
%4 = alloca [30 x i8]
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%7 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @hputc to i32 (i8*, i8*, i8*, ...)*)(i8* %0, i8* %1, i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello world\n");
  return 42;
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
char *__qunit_print_header(char *buff) {
  sprintf(buff, "Test file    : "
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/alkafir/qcollect/refs/heads/"
                "master/test/qunit.h"
                "\n"
                "QUnit version: "
                "2"
                "."
                "0"
                "."
                "0"
                "\n"
                ""
                "Compiled on  : "
                "Mar 17 2022"
                "\n"
                "\n");
  return buff;
}


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

x86 assembly (clang, -O2):
<__qunit_print_header>:
lea    0xee9(%rip),%rsi
mov    $0xcb,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
@.str = [203 x i8] c"Test file : /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alkafir/qcollect/refs/heads/master/test/qunit.h\0AQUnit version: 2.0.0\0ACompiled on : Mar 17 2022\0A\0A\00"
define i8* @__qunit_print_header(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([203 x i8], [203 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
@.str = [203 x i8] c"Test file : /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alkafir/qcollect/refs/heads/master/test/qunit.h\0AQUnit version: 2.0.0\0ACompiled on : Mar 17 2022\0A\0A\00"
define i8* @__qunit_print_header(i8* returned writeonly %0) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(203) %0, i8* align 1 dereferenceable(203) getelementptr inbounds ([203 x i8], [203 x i8]* @.str, i64 0, i64 0), i64 203, i1 false)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ cPrintf(char *);
void help16(void) { cPrintf("  q                 quit simulator\n"); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c" q quit simulator\0A\00"
define void @help16() {
%1 = call i32 @cPrintf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c" q quit simulator\0A\00"
define void @help16() {
%1 = tail call i32 @cPrintf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strchr(char *, char);
void dos2unix(const char *buf, int size) {
  char *p = (char *)buf;
  while ((p = strchr(p, '\r')) != NULL) {
    int ch = *(p + 1);
    if (ch == '\n') {
      *p = 0x20;
    }
  }
}


x86 assembly (clang, -O0):
<dos2unix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0xd,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1164 <dos2unix+0x54>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jne    115f <dos2unix+0x4f>
mov    -0x18(%rbp),%rax
movb   $0x20,(%rax)
jmp    1127 <dos2unix+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dos2unix>:
push   %rax
jmp    1123 <dos2unix+0x13>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,%rdi
mov    $0xd,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     113d <dos2unix+0x2d>
cmpb   $0xa,0x1(%rax)
jne    1120 <dos2unix+0x10>
movb   $0x20,(%rax)
jmp    1120 <dos2unix+0x10>
pop    %rax
ret

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

LLVM IR (-O2):
define void @dos2unix(i8* %0, i32 %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 13)
%4 = icmp eq i8* %3, null
br i1 %4, label %14, label %5
5: ; preds = %2, %11
%6 = phi i8* [ %12, %11 ], [ %3, %2 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %5
store i8 32, i8* %6
br label %11
11: ; preds = %10, %5
%12 = tail call i8* @strchr(i8* dereferenceable(1) %6, i8 signext 13)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %5
14: ; preds = %11, %2
ret void
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SN_close_env(struct SN_env *);
extern void swedish_UTF_8_close_env(struct SN_env *z) { SN_close_env(z); }


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

x86 assembly (clang, -O2):
<swedish_UTF_8_close_env>:
jmp    1030 <SN_close_env@plt>

LLVM IR (-O0):
%struct.SN_env = type { i32 }
define void @swedish_UTF_8_close_env(%struct.SN_env* %0) {
%2 = alloca %struct.SN_env*
store %struct.SN_env* %0, %struct.SN_env** %2
%3 = load %struct.SN_env*, %struct.SN_env** %2
%4 = call i32 @SN_close_env(%struct.SN_env* %3)
ret void
}

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define void @swedish_UTF_8_close_env(%struct.SN_env* %0) {
%2 = tail call i32 @SN_close_env(%struct.SN_env* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int rmdir(char *);
void cmd_rmdir(int argc, char *argv[]) {
  if (rmdir(argv[1]) == -1)
    perror("rmdir");
}


x86 assembly (clang, -O0):
<cmd_rmdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <rmdir@plt>
cmp    $0xffffffff,%eax
jne    1151 <cmd_rmdir+0x31>
lea    0xeb4(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_rmdir>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <rmdir@plt>
cmp    $0xffffffff,%eax
je     1131 <cmd_rmdir+0x11>
pop    %rax
ret
lea    0xec8(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"rmdir\00"
define void @cmd_rmdir(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @rmdir(i8* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"rmdir\00"
define void @cmd_rmdir(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @rmdir(i8* %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
extern void vec_free(void *vec) { free(((char *)vec - (sizeof(size_t) * 3))); }


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

x86 assembly (clang, -O2):
<vec_free>:
add    $0xffffffffffffffe8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @vec_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 -24
%5 = call i32 @free(i8* %4)
ret void
}

LLVM IR (-O2):
define void @vec_free(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -24
%3 = tail call i32 @free(i8* %2)
ret void
}
void SPI_wait(int channel_mask) {
  if (channel_mask & 1)
    while (!((*((volatile unsigned char *)0xE0020004)) & (1 << 7)))
      ;
  if (channel_mask & 2)
    while ((*((volatile unsigned char *)0xE006800C)) & (1 << 4))
      ;
}


x86 assembly (clang, -O0):
<SPI_wait>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1149 <SPI_wait+0x49>
jmp    111b <SPI_wait+0x1b>
mov    $0xe0020004,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113f <SPI_wait+0x3f>
jmp    1144 <SPI_wait+0x44>
jmp    111b <SPI_wait+0x1b>
jmp    1149 <SPI_wait+0x49>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     117d <SPI_wait+0x7d>
jmp    115d <SPI_wait+0x5d>
mov    $0xe006800c,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1178 <SPI_wait+0x78>
jmp    115d <SPI_wait+0x5d>
jmp    117d <SPI_wait+0x7d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPI_wait>:
mov    $0xe0020004,%eax
test   $0x1,%dil
je     1115 <SPI_wait+0x15>
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rax)
jns    1110 <SPI_wait+0x10>
test   $0x2,%dil
je     1129 <SPI_wait+0x29>
nopl   0x0(%rax,%rax,1)
testb  $0x10,0x48008(%rax)
jne    1120 <SPI_wait+0x20>
ret

LLVM IR (-O0):
define void @SPI_wait(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %1
br label %7
7: ; preds = %13, %6
%8 = load volatile i8, i8* inttoptr (i64 3758227460 to i8*)
%9 = zext i8 %8 to i32
%10 = and i32 %9, 128
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %14
13: ; preds = %7
br label %7
14: ; preds = %7
br label %15
15: ; preds = %14, %1
%16 = load i32, i32* %2
%17 = and i32 %16, 2
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %15
br label %20
20: ; preds = %25, %19
%21 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%22 = zext i8 %21 to i32
%23 = and i32 %22, 16
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
br label %20
26: ; preds = %20
br label %27
27: ; preds = %26, %15
ret void
}

LLVM IR (-O2):
define void @SPI_wait(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1, %4
%5 = load volatile i8, i8* inttoptr (i64 3758227460 to i8*)
%6 = icmp sgt i8 %5, -1
br i1 %6, label %4, label %7
7: ; preds = %4, %1
%8 = and i32 %0, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7, %10
%11 = load volatile i8, i8* inttoptr (i64 3758522380 to i8*)
%12 = and i8 %11, 16
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %10
14: ; preds = %10, %7
ret void
}
/* Type definitions */
struct sk_buff {
  int dummy;
};
struct phonetmsg {
  int dummy;
};

/* Variables and functions */
scalar_t__ skb_transport_header(struct sk_buff *);
struct phonetmsg *pn_msg(struct sk_buff *skb) {
  return (struct phonetmsg *)skb_transport_header(skb);
}


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

x86 assembly (clang, -O2):
<pn_msg>:
jmp    1030 <skb_transport_header@plt>

LLVM IR (-O0):
%struct.phonetmsg = type { i32 }
%struct.sk_buff = type { i32 }
define %struct.phonetmsg* @pn_msg(%struct.sk_buff* %0) {
%2 = alloca %struct.sk_buff*
store %struct.sk_buff* %0, %struct.sk_buff** %2
%3 = load %struct.sk_buff*, %struct.sk_buff** %2
%4 = call i64 @skb_transport_header(%struct.sk_buff* %3)
%5 = inttoptr i64 %4 to %struct.phonetmsg*
ret %struct.phonetmsg* %5
}

LLVM IR (-O2):
%struct.phonetmsg = type { i32 }
%struct.sk_buff = type { i32 }
define %struct.phonetmsg* @pn_msg(%struct.sk_buff* %0) {
%2 = tail call i64 @skb_transport_header(%struct.sk_buff* %0)
%3 = inttoptr i64 %2 to %struct.phonetmsg*
ret %struct.phonetmsg* %3
}