xunge/DecIR huggingface dataset:
void gdk_beep() {}


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

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

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

LLVM IR (-O2):
define void @gdk_beep() {
ret void
}
/* Variables and functions */
scalar_t__ isalpha(char);
int isalpha_(char ch) { return isalpha(ch) || (ch == '_'); }


x86 assembly (clang, -O0):
<isalpha_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1146 <isalpha_+0x36>
movsbl -0x1(%rbp),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha_>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalpha@plt>
test   %rax,%rax
setne  %al
cmp    $0x5f,%bl
sete   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isalpha_(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isalpha(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 95
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isalpha_(i8 signext %0) {
%2 = tail call i64 @isalpha(i8 signext %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i8 %0, 95
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
double erf__(double);
double erf(double x) { return erf__(x); }


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

x86 assembly (clang, -O2):
<erf>:
jmp    1030 <erf__@plt>

LLVM IR (-O0):
define double @erf(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @erf__(double %3)
ret double %4
}

LLVM IR (-O2):
define double @erf(double %0) {
%2 = tail call double @erf__(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ ert_read(int, unsigned int *);
int /*<<< orphan*/ ert_write(int, unsigned short);
void readFIFO(unsigned short addr, unsigned int *value) {
  unsigned int tmp;
  ert_write(0x0848, addr | (1UL << (12)));
  do {
    ert_read(0x0848, &tmp);
  } while ((tmp & (1UL << (13))) == 0);
  ert_write(0x0848, 0);
  ert_read(0x0840, value);
}


x86 assembly (clang, -O0):
<readFIFO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
or     $0x1000,%rax
mov    $0x848,%edi
movzwl %ax,%esi
call   1030 <ert_write@plt>
mov    $0x848,%edi
lea    -0x14(%rbp),%rsi
call   1040 <ert_read@plt>
mov    -0x14(%rbp),%eax
and    $0x2000,%rax
cmp    $0x0,%rax
je     114a <readFIFO+0x2a>
mov    $0x848,%edi
xor    %esi,%esi
call   1030 <ert_write@plt>
mov    -0x10(%rbp),%rsi
mov    $0x840,%edi
call   1040 <ert_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFIFO>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%esi
or     $0x1000,%esi
mov    $0x848,%edi
call   1030 <ert_write@plt>
lea    0x4(%rsp),%rbx
xchg   %ax,%ax
mov    $0x848,%edi
mov    %rbx,%rsi
call   1040 <ert_read@plt>
testb  $0x20,0x5(%rsp)
je     1140 <readFIFO+0x20>
mov    $0x848,%edi
xor    %esi,%esi
call   1030 <ert_write@plt>
mov    $0x840,%edi
mov    %r14,%rsi
call   1040 <ert_read@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @readFIFO(i16 zeroext %0, i32* %1) {
%3 = alloca i16
%4 = alloca i32*
%5 = alloca i32
store i16 %0, i16* %3
store i32* %1, i32** %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i64
%8 = or i64 %7, 4096
%9 = trunc i64 %8 to i16
%10 = call i32 @ert_write(i32 2120, i16 zeroext %9)
br label %11
11: ; preds = %13, %2
%12 = call i32 @ert_read(i32 2120, i32* %5)
br label %13
13: ; preds = %11
%14 = load i32, i32* %5
%15 = zext i32 %14 to i64
%16 = and i64 %15, 8192
%17 = icmp eq i64 %16, 0
br i1 %17, label %11, label %18
18: ; preds = %13
%19 = call i32 @ert_write(i32 2120, i16 zeroext 0)
%20 = load i32*, i32** %4
%21 = call i32 @ert_read(i32 2112, i32* %20)
ret void
}

LLVM IR (-O2):
define void @readFIFO(i16 zeroext %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = or i16 %0, 4096
%6 = tail call i32 @ert_write(i32 2120, i16 zeroext %5)
br label %7
7: ; preds = %7, %2
%8 = call i32 @ert_read(i32 2120, i32* %3)
%9 = load i32, i32* %3
%10 = and i32 %9, 8192
%11 = icmp eq i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7
%13 = call i32 @ert_write(i32 2120, i16 zeroext 0)
%14 = call i32 @ert_read(i32 2112, i32* %1)
ret void
}
int _system_pre_init(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @_system_pre_init() {
ret i32 1
}

LLVM IR (-O2):
define i32 @_system_pre_init() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_108() {
  Assert_real((isqrt(108) == 10),
              "/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",
              545, ("Integer square root of 108 should be 10"));
}


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

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

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 108 should be 10\00"
define void @t_sqrt_108() {
%1 = call i32 @isqrt(i32 108)
%2 = icmp eq i32 %1, 10
%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 545, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 108 should be 10\00"
define void @t_sqrt_108() {
%1 = tail call i32 @isqrt(i32 108)
%2 = icmp eq i32 %1, 10
%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 545, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
putstk(typeobj) char typeobj;
{
  zpop();
  if (typeobj == 2)
    callrts("ccpint");
  else {
    ol("MOV A,L");
    ol("STAX D");
  }
}


x86 assembly (clang, -O0):
<putstk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    $0x0,%al
call   1030 <zpop@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2,%eax
jne    1165 <putstk+0x35>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <callrts@plt>
jmp    1181 <putstk+0x51>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <ol@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstk>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <zpop@plt>
cmp    $0x2,%bl
jne    114f <putstk+0x1f>
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1040 <callrts@plt>
pop    %rbx
ret
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1050 <ol@plt>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <ol@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"ccpint\00"
@.str.1 = [8 x i8] c"MOV A,L\00"
@.str.2 = [7 x i8] c"STAX D\00"
define i32 @putstk(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = call i32 (...) @zpop()
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @callrts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %14
11: ; preds = %1
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %11, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [7 x i8] c"ccpint\00"
@.str.1 = [8 x i8] c"MOV A,L\00"
@.str.2 = [7 x i8] c"STAX D\00"
define i32 @putstk(i32 %0) {
%2 = tail call i32 (...) @zpop()
%3 = and i32 %0, 255
%4 = icmp eq i32 %3, 2
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @callrts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %7, %5
ret i32 undef
}
void t2() {
  int a[2][3];
  int *p = a + 1;
  *p = 1;
  int *q = a;
  *p = 32;
  fexpect("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/array.c",
          18, 32, *(q + 3));
  ;
}


x86 assembly (clang, -O0):
<t2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x20(%rbp),%rax
add    $0xc,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x20,(%rax)
mov    -0x30(%rbp),%rax
mov    0xc(%rax),%ecx
lea    0xeb2(%rip),%rdi
mov    $0x12,%esi
mov    $0x20,%edx
mov    $0x0,%al
call   1030 <fexpect@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2>:
lea    0xee9(%rip),%rdi
mov    $0x12,%esi
mov    $0x20,%edx
mov    $0x20,%ecx
xor    %eax,%eax
jmp    1030 <fexpect@plt>

LLVM IR (-O0):
@.str = [128 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/array.c\00"
define void @t2() {
%1 = alloca [2 x [3 x i32]]
%2 = alloca i32*
%3 = alloca i32*
%4 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 0
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 1
%6 = bitcast [3 x i32]* %5 to i32*
store i32* %6, i32** %2
%7 = load i32*, i32** %2
store i32 1, i32* %7
%8 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 0
%9 = bitcast [3 x i32]* %8 to i32*
store i32* %9, i32** %3
%10 = load i32*, i32** %2
store i32 32, i32* %10
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 3
%13 = load i32, i32* %12
%14 = call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str, i64 0, i64 0), i32 18, i32 32, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [128 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/8l/8cc/refs/heads/master/test/array.c\00"
define void @t2() {
%1 = tail call i32 (i8*, i32, i32, i32, ...) bitcast (i32 (...)* @fexpect to i32 (i8*, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str, i64 0, i64 0), i32 18, i32 32, i32 32)
ret void
}
void RTVfsObjToDir(void) {}


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

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

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

LLVM IR (-O2):
define void @RTVfsObjToDir() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *exename) {
  printf("Usage: %s <file name> [<file io flag>]\n", exename);
  printf(" where <file io flag> = -w (write) or -r (read).\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Usage: %s <file name> [<file io flag>]\0A\00"
@.str.1 = [50 x i8] c" where <file io flag> = -w (write) or -r (read).\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Usage: %s <file name> [<file io flag>]\0A\00"
@str = [49 x i8] c" where <file io flag> = -w (write) or -r (read).\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
ret void
}
int signedValue(int v) {
  if (v < 0x7fff)
    return v;
  return v - 0x10000;
}


x86 assembly (clang, -O0):
<signedValue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x7fff,-0x8(%rbp)
jge    111f <signedValue+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112a <signedValue+0x2a>
mov    -0x8(%rbp),%eax
sub    $0x10000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signedValue>:
lea    -0x10000(%rdi),%eax
cmp    $0x7fff,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @signedValue(i32 %0) {
%2 = icmp slt i32 %0, 32767
%3 = add nsw i32 %0, -65536
%4 = select i1 %2, i32 %0, i32 %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ foo(double *);
int main() {
  double *p = NULL;
  foo(p);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(double* null)
ret i32 0
}
void g_array_sort() {}


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

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

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

LLVM IR (-O2):
define void @g_array_sort() {
ret void
}
/* Variables and functions */
int fibonnaci(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num, fib;
  printf("Diga um número");
  scanf("%d", &num);
  fib = fibonnaci(num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <fibonnaci@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <fibonnaci@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Diga um n\C3\BAmero\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 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 @fibonnaci(i32 %6)
store i32 %7, i32* %3
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Diga um n\C3\BAmero\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 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
%6 = call i32 @fibonnaci(i32 %5)
ret i32 0
}
int pq_implementation_stop(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @pq_implementation_stop() {
ret i32 0
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int get_timer(struct timeval *tv) {
  if (gettimeofday(tv, NULL) < 0) {
    fprintf(stderr, "gettimeofday() failed (errno %d)\n", errno);
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<get_timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
jge    116d <get_timer+0x4d>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
lea    0xea4(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1174 <get_timer+0x54>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_timer>:
push   %rax
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
js     1137 <get_timer+0x17>
pop    %rcx
ret
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@stderr = global i32 0
@.str = [34 x i8] c"gettimeofday() failed (errno %d)\0A\00"
@errno = global i32 0
define i32 @get_timer(%struct.timeval* %0) {
%2 = alloca i32
%3 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
%4 = load %struct.timeval*, %struct.timeval** %3
%5 = call i64 @gettimeofday(%struct.timeval* %4, i32* null)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 0, i32* %2
br label %12
11: ; preds = %1
store i32 1, i32* %2
br label %12
12: ; preds = %11, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@stderr = global i32 0
@.str = [34 x i8] c"gettimeofday() failed (errno %d)\0A\00"
@errno = global i32 0
define i32 @get_timer(%struct.timeval* nocapture %0) {
%2 = tail call i64 @gettimeofday(%struct.timeval* %0, i32* null)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ 0, %4 ], [ 1, %1 ]
ret i32 %9
}
__attribute__((no, noclone)) unsigned short foo8(unsigned short arg) {
  unsigned short ret = 1;
  if (arg + 1 < ((!1) ? -(1L << (sizeof(short) * 8 - 1)) : 0) ||
      arg + 1 > ((!1) ? ((1L << (sizeof(short) * 8 - 1)) - 1)
                      : ((1L << (sizeof(short) * 8)) - 1)))
    return ret;
  arg = arg + 1;
  ret = (unsigned char)arg;
  return arg;
}


x86 assembly (clang, -O0):
<foo8>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
movw   $0x1,-0x6(%rbp)
movzwl -0x4(%rbp),%eax
add    $0x1,%eax
cltq
cmp    $0x0,%rax
jl     1139 <foo8+0x39>
movzwl -0x4(%rbp),%eax
add    $0x1,%eax
cltq
cmp    $0xffff,%rax
jle    1146 <foo8+0x46>
mov    -0x6(%rbp),%ax
mov    %ax,-0x2(%rbp)
jmp    1164 <foo8+0x64>
movzwl -0x4(%rbp),%eax
add    $0x1,%eax
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
movzbl %al,%eax
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo8>:
inc    %di
mov    $0x1,%eax
cmovne %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @foo8(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = icmp slt i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %1
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = icmp sgt i64 %14, 65535
br i1 %15, label %16, label %18
16: ; preds = %10, %1
%17 = load i16, i16* %4
store i16 %17, i16* %2
br label %27
18: ; preds = %10
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
%21 = add nsw i32 %20, 1
%22 = trunc i32 %21 to i16
store i16 %22, i16* %3
%23 = load i16, i16* %3
%24 = trunc i16 %23 to i8
%25 = zext i8 %24 to i16
store i16 %25, i16* %4
%26 = load i16, i16* %3
store i16 %26, i16* %2
br label %27
27: ; preds = %18, %16
%28 = load i16, i16* %2
ret i16 %28
}

LLVM IR (-O2):
define zeroext i16 @foo8(i16 zeroext %0) {
%2 = add i16 %0, 1
%3 = icmp eq i16 %0, -1
%4 = select i1 %3, i16 1, i16 %2
ret i16 %4
}
/* Variables and functions */
long double __qdim(long double *, long double *);
long double intr_wrap_168(long double p1, long double p2) {
  return __qdim(&p1, &p2);
}


x86 assembly (clang, -O0):
<intr_wrap_168>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <__qdim@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_168>:
sub    $0x28,%rsp
fldt   0x40(%rsp)
fldt   0x30(%rsp)
fstpt  0x10(%rsp)
fstpt  (%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <__qdim@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @intr_wrap_168(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = call x86_fp80 @__qdim(x86_fp80* %3, x86_fp80* %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @intr_wrap_168(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = call x86_fp80 @__qdim(x86_fp80* %3, x86_fp80* %4)
ret x86_fp80 %5
}
int arr(int a[3]) { return a[2]; }


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

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

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

LLVM IR (-O2):
define i32 @arr(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ cons_putc(int /*<<< orphan*/);
void printstr(char *str) {
  const int max_str_len = 100;
  int cnt = 0;
  while (*str && cnt++ < max_str_len)
    cons_putc(*(str++));
}


x86 assembly (clang, -O0):
<printstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1153 <printstr+0x43>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x64,%eax
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1163 <printstr+0x53>
jmp    117f <printstr+0x6f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <cons_putc@plt>
jmp    112a <printstr+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstr>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113e <printstr+0x2e>
mov    %rdi,%r14
xor    %ebx,%ebx
nop
movsbl %al,%edi
call   1030 <cons_putc@plt>
movzbl 0x1(%r14,%rbx,1),%eax
test   %al,%al
je     113e <printstr+0x2e>
lea    0x1(%rbx),%rcx
cmp    $0x63,%ebx
mov    %rcx,%rbx
jb     1120 <printstr+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @printstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %9, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = add nuw nsw i32 %6, 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = tail call i32 @cons_putc(i32 %8)
%12 = load i8, i8* %10
%13 = icmp ne i8 %12, 0
%14 = icmp ult i32 %6, 99
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %4, label %16
16: ; preds = %4, %1
ret void
}
void gdk_window_enable_synchronized_configure() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_enable_synchronized_configure() {
ret void
}
/* Variables and functions */
float frac(float);
float calc_cyclic(float x) {
  float phase = 1 / (2 * 3.141592653589f);
  float sqrt2 = 1.4142136f;
  float sqrt2m2 = 2.8284271f;
  float f = sqrt2m2 * frac(x) - sqrt2;
  return f * f - 1.f;
}


x86 assembly (clang, -O0):
<calc_cyclic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xee7(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xec5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <frac@plt>
movaps %xmm0,%xmm2
movss  -0x18(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe6b(%rip),%xmm1
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_cyclic>:
push   %rax
call   1030 <frac@plt>
mulss  0xee2(%rip),%xmm0
addss  0xede(%rip),%xmm0
mulss  %xmm0,%xmm0
addss  0xed6(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @calc_cyclic(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %2
store float 0x3FC45F3060000000, float* %3
store float 0x3FF6A09E80000000, float* %4
store float 0x4006A09E60000000, float* %5
%7 = load float, float* %5
%8 = load float, float* %2
%9 = call float @frac(float %8)
%10 = load float, float* %4
%11 = fneg float %10
%12 = call float @llvm.fmuladd.f32(float %7, float %9, float %11)
store float %12, float* %6
%13 = load float, float* %6
%14 = load float, float* %6
%15 = call float @llvm.fmuladd.f32(float %13, float %14, float -1.000000e+00)
ret float %15
}

LLVM IR (-O2):
define float @calc_cyclic(float %0) {
%2 = tail call float @frac(float %0)
%3 = tail call float @llvm.fmuladd.f32(float %2, float 0x4006A09E60000000, float 0xBFF6A09E80000000)
%4 = tail call float @llvm.fmuladd.f32(float %3, float %3, float -1.000000e+00)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ backtrace_get_frame_symbols(void **, char **, int);
void c_backtrace_symbols(void **addresses, char **frames, int n_frames) {
  backtrace_get_frame_symbols(addresses, frames, n_frames);
}


x86 assembly (clang, -O0):
<c_backtrace_symbols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <backtrace_get_frame_symbols@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_backtrace_symbols>:
jmp    1030 <backtrace_get_frame_symbols@plt>

LLVM IR (-O0):
define void @c_backtrace_symbols(i8** %0, i8** %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i32
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8**, i8*** %4
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = call i32 @backtrace_get_frame_symbols(i8** %7, i8** %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @c_backtrace_symbols(i8** %0, i8** %1, i32 %2) {
%4 = tail call i32 @backtrace_get_frame_symbols(i8** %0, i8** %1, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ recv_ec_data();
int /*<<< orphan*/ send_ec_command(int);
uint8_t ec_query(void) {
  send_ec_command(0x84);
  return recv_ec_data();
}


x86 assembly (clang, -O0):
<ec_query>:
push   %rbp
mov    %rsp,%rbp
mov    $0x84,%edi
call   1030 <send_ec_command@plt>
mov    $0x0,%al
call   1040 <recv_ec_data@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_query>:
push   %rax
mov    $0x84,%edi
call   1030 <send_ec_command@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <recv_ec_data@plt>

LLVM IR (-O0):
define i32 @ec_query() {
%1 = call i32 @send_ec_command(i32 132)
%2 = call i32 (...) @recv_ec_data()
ret i32 %2
}

LLVM IR (-O2):
define i32 @ec_query() {
%1 = tail call i32 @send_ec_command(i32 132)
%2 = tail call i32 (...) @recv_ec_data()
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct time {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ time_init_val(struct time *, int /*<<< orphan*/ *);
void time_init_now(struct time *t) {
  time_t s;
  s = time(NULL);
  time_init_val(t, &s);
}


x86 assembly (clang, -O0):
<time_init_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <time_init_val@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_init_now>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <time_init_val@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.time = type { i32 }
define void @time_init_now(%struct.time* %0) {
%2 = alloca %struct.time*
%3 = alloca i32
store %struct.time* %0, %struct.time** %2
%4 = call i32 @time(i32* null)
store i32 %4, i32* %3
%5 = load %struct.time*, %struct.time** %2
%6 = call i32 @time_init_val(%struct.time* %5, i32* %3)
ret void
}

LLVM IR (-O2):
%struct.time = type { i32 }
define void @time_init_now(%struct.time* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call i32 @time_init_val(%struct.time* %0, i32* %2)
ret void
}
int count(char c, char *str) {
  int total = 0;
  int i = 0;
  while (str[i] != '\0')
    if (str[i++] == c)
      total++;
  return total;
}


x86 assembly (clang, -O0):
<count>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1161 <count+0x61>
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 -0x1(%rbp),%ecx
cmp    %ecx,%eax
jne    115c <count+0x5c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <count+0x1c>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count>:
mov    (%rsi),%cl
test   %cl,%cl
je     1126 <count+0x26>
add    $0x1,%rsi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %dil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <count+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @count(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %29, %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 %30
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* %3
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %22, %24
br i1 %25, label %26, label %29
26: ; preds = %15
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %29
29: ; preds = %26, %15
br label %7
30: ; preds = %7
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @count(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %14, %5 ], [ %3, %2 ]
%8 = phi i32 [ %12, %5 ], [ 0, %2 ]
%9 = add nuw nsw i64 %6, 1
%10 = icmp eq i8 %7, %0
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %8, %11
%13 = getelementptr inbounds i8, i8* %1, i64 %9
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %17
}
/* Type definitions */
struct flink_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ flink_is_last(struct flink_head *);
int /*<<< orphan*/ init_flink_head(struct flink_head *);
void flink_last_del(struct flink_head *head) {
  assert(flink_is_last(head));
  init_flink_head(head);
}


x86 assembly (clang, -O0):
<flink_last_del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <flink_is_last@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <init_flink_head@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flink_last_del>:
push   %rbx
mov    %rdi,%rbx
call   1040 <flink_is_last@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <init_flink_head@plt>

LLVM IR (-O0):
%struct.flink_head = type { i32 }
define void @flink_last_del(%struct.flink_head* %0) {
%2 = alloca %struct.flink_head*
store %struct.flink_head* %0, %struct.flink_head** %2
%3 = load %struct.flink_head*, %struct.flink_head** %2
%4 = call i32 @flink_is_last(%struct.flink_head* %3)
%5 = call i32 @assert(i32 %4)
%6 = load %struct.flink_head*, %struct.flink_head** %2
%7 = call i32 @init_flink_head(%struct.flink_head* %6)
ret void
}

LLVM IR (-O2):
%struct.flink_head = type { i32 }
define void @flink_last_del(%struct.flink_head* %0) {
%2 = tail call i32 @flink_is_last(%struct.flink_head* %0)
%3 = tail call i32 @assert(i32 %2)
%4 = tail call i32 @init_flink_head(%struct.flink_head* %0)
ret void
}
/* Variables and functions */
void v_htole(void *, int);
void v16_htole(void *p) { return v_htole(p, 2); }


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

x86 assembly (clang, -O2):
<v16_htole>:
mov    $0x2,%esi
jmp    1030 <v_htole@plt>

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

LLVM IR (-O2):
define void @v16_htole(i8* %0) {
tail call void @v_htole(i8* %0, i32 2)
ret void
}
/* Variables and functions */
int pm8058_mpp_config(unsigned int, int, unsigned int, unsigned int);
int pm8058_mpp_config_analog_output(unsigned mpp, unsigned level,
                                    unsigned control) {
  return pm8058_mpp_config(mpp, 4, level, control);
}


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

x86 assembly (clang, -O2):
<pm8058_mpp_config_analog_output>:
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x4,%esi
jmp    1030 <pm8058_mpp_config@plt>

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

LLVM IR (-O2):
define i32 @pm8058_mpp_config_analog_output(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @pm8058_mpp_config(i32 %0, i32 4, i32 %1, i32 %2)
ret i32 %4
}
int f_max(int a, int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<f_max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <f_max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <f_max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f_max(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @f_max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t h265hvcc_get_chroma_format(const uint8_t *p) { return p[15] & 0x3; }


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

x86 assembly (clang, -O2):
<h265hvcc_get_chroma_format>:
mov    0x3c(%rdi),%eax
and    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @h265hvcc_get_chroma_format(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 15
%5 = load i32, i32* %4
%6 = and i32 %5, 3
ret i32 %6
}

LLVM IR (-O2):
define i32 @h265hvcc_get_chroma_format(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 15
%3 = load i32, i32* %2
%4 = and i32 %3, 3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ list_dir(char *);
int main(int argc, char *argv[]) {
  list_dir(argv[1]);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @list_dir(i8* %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @list_dir(i8* %4)
ret i32 0
}
/* Type definitions */
struct tms {
  int dummy;
};

/* Variables and functions */
scalar_t__ times(struct tms *);
int bad_times(void *addr) { return (int)times((struct tms *)addr); }


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

x86 assembly (clang, -O2):
<bad_times>:
jmp    1030 <times@plt>

LLVM IR (-O0):
%struct.tms = type { i32 }
define i32 @bad_times(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.tms*
%5 = call i64 @times(%struct.tms* %4)
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
%struct.tms = type { i32 }
define i32 @bad_times(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.tms*
%3 = tail call i64 @times(%struct.tms* %2)
%4 = trunc i64 %3 to i32
ret i32 %4
}
char *default_mpgdecoder_version_06(void) {
  static char version[] = "0.06";
  return version;
}


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

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

LLVM IR (-O0):
@default_mpgdecoder_version_06.version = internal global [5 x i8] c"0.06\00"
define i8* @default_mpgdecoder_version_06() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @default_mpgdecoder_version_06.version, i64 0, i64 0)
}

LLVM IR (-O2):
@default_mpgdecoder_version_06.version = internal global [5 x i8] c"0.06\00"
define i8* @default_mpgdecoder_version_06() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @default_mpgdecoder_version_06.version, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ config_set(char const *, char const *, char *);
int /*<<< orphan*/ sprintf(char *, char *, long long);
long long config_set_number(const char *section, const char *name,
                            long long value) {
  char buffer[100];
  sprintf(buffer, "%lld", value);
  config_set(section, name, buffer);
  return value;
}


x86 assembly (clang, -O0):
<config_set_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1040 <config_set@plt>
mov    -0x18(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_set_number>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xec5(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
call   1030 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <config_set@plt>
mov    %rbx,%rax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
define i64 @config_set_number(i8* %0, i8* %1, i64 returned %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
%7 = call i32 @config_set(i8* %0, i8* %1, i8* %5)
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int16_t get_int16(const char *buff) { return (*(int16_t *)buff); }


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

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

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

LLVM IR (-O2):
define i32 @get_int16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void store_cur(void) { printf("\033[s"); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[s\00"
define void @store_cur() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}