xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ExecuteSuperFunGame() {
  printf("We both find toying with humans fun, right?\n");
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"We both find toying with humans fun, right?\0A\00"
define void @ExecuteSuperFunGame() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [44 x i8] c"We both find toying with humans fun, right?\00"
define void @ExecuteSuperFunGame() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *fopen(char const *, char *);
void *dumb_stdfile_open(const char *filename) { return fopen(filename, "rb"); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i8* @dumb_stdfile_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @fopen(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define noalias i8* @dumb_stdfile_open(i8* nocapture %0) {
%2 = tail call i8* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void Funkcija2() {
  puts("This is function two.");
  exit(1);
  puts("After exit");
}


x86 assembly (clang, -O0):
<Funkcija2>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Funkcija2>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"This is function two.\00"
define void @Funkcija2() {
%1 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"This is function two.\00"
define void @Funkcija2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char const *weak_l3();
const char *__attribute__((section(".test.c"))) sibcall_weak_l3(void) {
  return weak_l3();
}


x86 assembly (clang, -O0):
<sibcall_weak_l3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <weak_l3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sibcall_weak_l3>:
xor    %eax,%eax
jmp    1030 <weak_l3@plt>

LLVM IR (-O0):
define i8* @sibcall_weak_l3() section ".test.c" {
%1 = call i8* (...) @weak_l3()
ret i8* %1
}

LLVM IR (-O2):
define i8* @sibcall_weak_l3() section ".test.c" {
%1 = tail call i8* (...) @weak_l3()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rec_check(int);
int /*<<< orphan*/ system(char *);
int main() {
  int result = rec_check(-3);
  printf("%d\n", result);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffffd,%edi
call   1050 <rec_check@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffffffd,%edi
call   1050 <rec_check@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @rec_check(i32 -3)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = tail call i32 @rec_check(i32 -3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
void getPlaylistLine(FILE *pFile, int wLine, int *pwOffsetBytes,
                     char *pszLine) {
  pwOffsetBytes += wLine;
  fseek(pFile, *pwOffsetBytes, SEEK_SET);
  fgets(pszLine, 1024, pFile);
}


x86 assembly (clang, -O0):
<getPlaylistLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1030 <fgets@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPlaylistLine>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdi,%rbx
movslq %esi,%rax
mov    (%rdx,%rax,4),%esi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fgets@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
define void @getPlaylistLine(i32* %0, i32 %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i32, i32* %6
%10 = load i32*, i32** %7
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds i32, i32* %10, i64 %11
store i32* %12, i32** %7
%13 = load i32*, i32** %5
%14 = load i32*, i32** %7
%15 = load i32, i32* %14
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %13, i32 %15, i32 %16)
%18 = load i8*, i8** %8
%19 = load i32*, i32** %5
%20 = call i32 @fgets(i8* %18, i32 1024, i32* %19)
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define void @getPlaylistLine(i32* nocapture %0, i32 %1, i32* nocapture %2, i8* %3) {
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i32, i32* %2, i64 %5
%7 = load i32, i32* %6
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @fseek(i32* %0, i32 %7, i32 %8)
%10 = tail call i32 @fgets(i8* %3, i32 1024, i32* %0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int, size_t);
void *tl_alloc(size_t size, int setval) {
  void *ret = malloc(size);
  if (ret) {
    memset(ret, setval, size);
  }
  return ret;
}


x86 assembly (clang, -O0):
<tl_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1157 <tl_alloc+0x37>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tl_alloc>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1145 <tl_alloc+0x25>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @tl_alloc(i64 %0, i32 %1) {
%3 = tail call i8* @malloc(i64 %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memset(i8* %3, i32 %1, i64 %0)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int is_valid_in_UnderlyingStipulations(size_t __tag) {
  switch (__tag) {
  case 888:
  case 889:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_valid_in_UnderlyingStipulations>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffc88,%rax
sub    $0x1,%rax
ja     112d <is_valid_in_UnderlyingStipulations+0x2d>
jmp    1121 <is_valid_in_UnderlyingStipulations+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1134 <is_valid_in_UnderlyingStipulations+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_in_UnderlyingStipulations>:
and    $0xfffffffffffffffe,%rdi
xor    %eax,%eax
cmp    $0x378,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_valid_in_UnderlyingStipulations(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
switch i64 %4, label %6 [
i64 888, label %5
i64 889, label %5
]
5: ; preds = %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_valid_in_UnderlyingStipulations(i64 %0) {
%2 = and i64 %0, -2
%3 = icmp eq i64 %2, 888
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
typedef int /*<<< orphan*/ ASN1_TIME;

/* Variables and functions */
int /*<<< orphan*/ *ASN1_TIME_adj_internal(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/, int, long,
                                           int /*<<< orphan*/);
ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,
                         long offset_sec) {
  return (ASN1_TIME_adj_internal(s, t, offset_day, offset_sec, 0));
}


x86 assembly (clang, -O0):
<ASN1_TIME_adj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <ASN1_TIME_adj_internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_TIME_adj>:
xor    %r8d,%r8d
jmp    1030 <ASN1_TIME_adj_internal@plt>

LLVM IR (-O0):
define i32* @ASN1_TIME_adj(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i64, i64* %8
%13 = call i32* @ASN1_TIME_adj_internal(i32* %9, i32 %10, i32 %11, i64 %12, i32 0)
ret i32* %13
}

LLVM IR (-O2):
define i32* @ASN1_TIME_adj(i32* %0, i32 %1, i32 %2, i64 %3) {
%5 = tail call i32* @ASN1_TIME_adj_internal(i32* %0, i32 %1, i32 %2, i64 %3, i32 0)
ret i32* %5
}
void R_MPC_Create_UserInit(void) {}


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

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

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

LLVM IR (-O2):
define void @R_MPC_Create_UserInit() {
ret void
}
int div(int x, int y) {
  int t;
  t = x * 8192;
  return (t + y / 2) / y;
}


x86 assembly (clang, -O0):
<div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xd,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<div>:
shl    $0xd,%edi
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
add    %edi,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @div(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 13
%4 = sdiv i32 %1, 2
%5 = add nsw i32 %4, %3
%6 = sdiv i32 %5, %1
ret i32 %6
}
/* Variables and functions */
int fn_glutGet(int);
int glutGet(int type) { return fn_glutGet(type); }


x86 assembly (clang, -O0):
<glutGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fn_glutGet@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glutGet>:
jmp    1030 <fn_glutGet@plt>

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

LLVM IR (-O2):
define i32 @glutGet(i32 %0) {
%2 = tail call i32 @fn_glutGet(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void GiveInstructions(void) {
  printf("This program displays a calendar for a full\n");
  printf("year.  The year must not be before 1900.\n");
}


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

x86 assembly (clang, -O2):
<GiveInstructions>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"This program displays a calendar for a full\0A\00"
@.str.1 = [42 x i8] c"year. The year must not be before 1900.\0A\00"
define void @GiveInstructions() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [44 x i8] c"This program displays a calendar for a full\00"
@str.2 = [41 x i8] c"year. The year must not be before 1900.\00"
define void @GiveInstructions() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.2, i64 0, i64 0))
ret void
}
void kissSimPause() {}


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

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

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

LLVM IR (-O2):
define void @kissSimPause() {
ret void
}
void XtCvtStringToAtom() {}


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

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

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

LLVM IR (-O2):
define void @XtCvtStringToAtom() {
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char p[] = "1234";
  int num;
  num = atoi(p);
  printf("\n%s", p);
  printf("\n%d", num);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0xc(%rbp)
lea    -0x5(%rbp),%rsi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movb   $0x0,0x4(%rsp)
movl   $0x34333231,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
lea    0xeb2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.main.p = [5 x i8] c"1234\00"
@.str = [4 x i8] c"\0A%s\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @atoi(i8* %2)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("Hello world\n");
  printf("Version: %s\n", "00.01-6cc15c2-artur");
  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)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0xed8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0xed2(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
@.str.1 = [13 x i8] c"Version: %s\0A\00"
@.str.2 = [20 x i8] c"00.01-6cc15c2-artur\00"
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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"Version: %s\0A\00"
@.str.2 = [20 x i8] c"00.01-6cc15c2-artur\00"
@str = [12 x i8] c"Hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ is_even(void *);
int is_odd(void *v) { return !is_even(v); }


x86 assembly (clang, -O0):
<is_odd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_even@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_odd>:
push   %rax
call   1030 <is_even@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_odd(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @is_even(i8* %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_odd(i8* %0) {
%2 = tail call i32 @is_even(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ unit_error(char *, char const *, int);
void assert_true(int real, char const *caller, int line) {
  if (real == 0) {
    unit_error("%s:%d should be true", caller, line);
  }
}


x86 assembly (clang, -O0):
<assert_true>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113f <assert_true+0x2f>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xec6(%rip),%rdi
call   1030 <unit_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_true>:
test   %edi,%edi
je     1115 <assert_true+0x5>
ret
lea    0xee4(%rip),%rdi
jmp    1030 <unit_error@plt>

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

LLVM IR (-O2):
@.str = [21 x i8] c"%s:%d should be true\00"
define void @assert_true(i32 %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @unit_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void show_help(char *exe_name) {
  printf("IZP project 2; Created by <%s>\n\n"
         "Usage of %s\n"
         "\t--help\t\tPrints this help.\n"
         "\t--tan A N M\tCalculate and print tan(a) in range from N to M "
         "iterations.\n"
         "\t[-c C] -m A [B]\tCalculate distances from given parameters. C - "
         "height, A - alpha, B - beta\n",
         "xmochn00@stud.fit.vutbr.cz", exe_name);
}


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

x86 assembly (clang, -O2):
<show_help>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xfcc(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [237 x i8] c"IZP project 2; Created by <%s>\0A\0AUsage of %s\0A\09--help\09\09Prints this help.\0A\09--tan A N M\09Calculate and print tan(a) in range from N to M iterations.\0A\09[-c C] -m A [B]\09Calculate distances from given parameters. C - height, A - alpha, B - beta\0A\00"
@.str.1 = [27 x i8] c"xmochn00@stud.fit.vutbr.cz\00"
define void @show_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([237 x i8], [237 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [237 x i8] c"IZP project 2; Created by <%s>\0A\0AUsage of %s\0A\09--help\09\09Prints this help.\0A\09--tan A N M\09Calculate and print tan(a) in range from N to M iterations.\0A\09[-c C] -m A [B]\09Calculate distances from given parameters. C - height, A - alpha, B - beta\0A\00"
@.str.1 = [27 x i8] c"xmochn00@stud.fit.vutbr.cz\00"
define void @show_help(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([237 x i8], [237 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
int seek(int fd, int offset, int mode) {
  int ret;
  asm("movl $19, %%eax\n\t"
      "movl %1, %%ebx\n\t"
      "movl %2, %%ecx\n\t"
      "movl %3, %%edx\n\t"
      "int $0x80\n\t"
      "movl %%eax, %0"
      : "=m"(ret)
      : "m"(fd), "m"(offset), "m"(mode));
  return ret;
}


x86 assembly (clang, -O0):
<seek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x13,%eax
mov    -0x4(%rbp),%ebx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
int    $0x80
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seek>:
mov    %edi,-0x4(%rsp)
mov    %esi,-0x8(%rsp)
mov    %edx,-0xc(%rsp)
mov    $0x13,%eax
mov    -0x4(%rsp),%ebx
mov    -0x8(%rsp),%ecx
mov    -0xc(%rsp),%edx
int    $0x80
mov    %eax,-0x10(%rsp)
mov    -0x10(%rsp),%eax
ret

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

LLVM IR (-O2):
define i32 @seek(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = bitcast i32* %7 to i8*
%9 = load i32, i32* %7
ret i32 %9
}
/* Type definitions */
struct lnch_ctxt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ lnch_body_event(struct lnch_ctxt *const, int /*<<< orphan*/);
int /*<<< orphan*/ lnch_body_walk(struct lnch_ctxt *const);
void lnch_body_run(struct lnch_ctxt *const p_ctxt) {
  lnch_body_event(p_ctxt, 0);
  while ((1)) {
    lnch_body_walk(p_ctxt);
  }
}


x86 assembly (clang, -O0):
<lnch_body_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <lnch_body_event@plt>
mov    -0x8(%rbp),%rdi
call   1040 <lnch_body_walk@plt>
jmp    1137 <lnch_body_run+0x17>

x86 assembly (clang, -O2):
<lnch_body_run>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <lnch_body_event@plt>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <lnch_body_walk@plt>
jmp    1130 <lnch_body_run+0x10>

LLVM IR (-O0):
%struct.lnch_ctxt = type { i32 }
define void @lnch_body_run(%struct.lnch_ctxt* %0) {
%2 = alloca %struct.lnch_ctxt*
store %struct.lnch_ctxt* %0, %struct.lnch_ctxt** %2
%3 = load %struct.lnch_ctxt*, %struct.lnch_ctxt** %2
%4 = call i32 @lnch_body_event(%struct.lnch_ctxt* %3, i32 0)
br label %5
5: ; preds = %1, %5
%6 = load %struct.lnch_ctxt*, %struct.lnch_ctxt** %2
%7 = call i32 @lnch_body_walk(%struct.lnch_ctxt* %6)
br label %5
}

LLVM IR (-O2):
%struct.lnch_ctxt = type { i32 }
define void @lnch_body_run(%struct.lnch_ctxt* %0) {
%2 = tail call i32 @lnch_body_event(%struct.lnch_ctxt* %0, i32 0)
br label %3
3: ; preds = %1, %3
%4 = tail call i32 @lnch_body_walk(%struct.lnch_ctxt* %0)
br label %3
}
/* Variables and functions */
int do_send(int, char *, char const *, char const *);
int irc_privmsg(int fd, const char *channel, const char *msg) {
  return do_send(fd, "PRIVMSG %s :%s", channel, msg);
}


x86 assembly (clang, -O0):
<irc_privmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rsi
call   1030 <do_send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_privmsg>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <do_send@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"PRIVMSG %s :%s\00"
define i32 @irc_privmsg(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @do_send(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [15 x i8] c"PRIVMSG %s :%s\00"
define i32 @irc_privmsg(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @do_send(i32 %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
char *dlerror();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void dlerror_handle() {
  char *msg;
  if ((msg = dlerror()) != NULL) {
    fprintf(stderr, "socket: dlopen failed : %s\n", msg);
    fflush(stderr);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<dlerror_handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <dlerror@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     1192 <dlerror_handle+0x52>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlerror_handle>:
push   %rbx
xor    %eax,%eax
call   1030 <dlerror@plt>
test   %rax,%rax
jne    114f <dlerror_handle+0xf>
pop    %rbx
ret
mov    0x2e8a(%rip),%rbx
mov    (%rbx),%edi
lea    0xea1(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"socket: dlopen failed : %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @dlerror_handle() {
%1 = alloca i8*
%2 = call i8* (...) @dlerror()
store i8* %2, i8** %1
%3 = icmp ne i8* %2, null
br i1 %3, label %4, label %12
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = call i32 @fflush(i32 %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"socket: dlopen failed : %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @dlerror_handle() {
%1 = tail call i8* (...) @dlerror()
%2 = icmp eq i8* %1, null
br i1 %2, label %10, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fflush(i32 %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %0
ret void
}
/* Variables and functions */
int _getche();
int getche(void) { return _getche(); }


x86 assembly (clang, -O0):
<getche>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <_getche@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getche>:
xor    %eax,%eax
jmp    1030 <_getche@plt>

LLVM IR (-O0):
define i32 @getche() {
%1 = call i32 (...) @_getche()
ret i32 %1
}

LLVM IR (-O2):
define i32 @getche() {
%1 = tail call i32 (...) @_getche()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ADC_done(int);
int ADC_get(int);
int /*<<< orphan*/ ADC_start(int);
int ADC_read(int adc) {
  ADC_start(adc);
  while (!ADC_done(adc))
    ;
  return ADC_get(adc);
}


x86 assembly (clang, -O0):
<ADC_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <ADC_start@plt>
mov    -0x4(%rbp),%edi
call   1030 <ADC_done@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1160 <ADC_read+0x30>
jmp    1165 <ADC_read+0x35>
jmp    1143 <ADC_read+0x13>
mov    -0x4(%rbp),%edi
call   1050 <ADC_get@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADC_read>:
push   %rbx
mov    %edi,%ebx
call   1040 <ADC_start@plt>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <ADC_done@plt>
test   %eax,%eax
je     1140 <ADC_read+0x10>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <ADC_get@plt>

LLVM IR (-O0):
define i32 @ADC_read(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ADC_start(i32 %3)
br label %5
5: ; preds = %10, %1
%6 = load i32, i32* %2
%7 = call i32 @ADC_done(i32 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %11
10: ; preds = %5
br label %5
11: ; preds = %5
%12 = load i32, i32* %2
%13 = call i32 @ADC_get(i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @ADC_read(i32 %0) {
%2 = tail call i32 @ADC_start(i32 %0)
br label %3
3: ; preds = %3, %1
%4 = tail call i32 @ADC_done(i32 %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = tail call i32 @ADC_get(i32 %0)
ret i32 %7
}
/* Variables and functions */
float strtof(char const *, char **);
float StrToFloat(const char *source, const char **endp) {
  return strtof(source, (char **)endp);
}


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

x86 assembly (clang, -O2):
<StrToFloat>:
jmp    1030 <strtof@plt>

LLVM IR (-O0):
define float @StrToFloat(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i8*, i8** %3
%6 = load i8**, i8*** %4
%7 = call float @strtof(i8* %5, i8** %6)
ret float %7
}

LLVM IR (-O2):
define float @StrToFloat(i8* %0, i8** nocapture %1) {
%3 = tail call float @strtof(i8* %0, i8** %1)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Olá, Mundo! :-)"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Ol\C3\A1, Mundo! :-)\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Ol\C3\A1, Mundo! :-)\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
char *strutil_reverse(char *);
int main(void) {
  char *str = "Hello, world!";
  char *reversed = strutil_reverse(str);
  printf("Original: \"%s\"\n", str);
  printf("Reversed: \"%s\"\n", reversed);
  free(reversed);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strutil_reverse@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%r14
mov    %r14,%rdi
call   1040 <strutil_reverse@plt>
mov    %rax,%rbx
lea    0xec1(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
@.str.1 = [16 x i8] c"Original: \22%s\22\0A\00"
@.str.2 = [16 x i8] c"Reversed: \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strutil_reverse(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
@.str.1 = [16 x i8] c"Original: \22%s\22\0A\00"
@.str.2 = [16 x i8] c"Reversed: \22%s\22\0A\00"
define i32 @main() {
%1 = tail call i8* @strutil_reverse(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%4 = tail call i32 @free(i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0x24() {
  Assert_real((isxdigit(36) == 0),
              "/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/ctype/test_isxdigit.c",
              185, ("isxdigit should be 0 for $"));
}


x86 assembly (clang, -O0):
<t_isxdigit_0x24>:
push   %rbp
mov    %rsp,%rbp
mov    $0x24,%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xb9,%edx
lea    0xf5c(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isxdigit_0x24>:
push   %rax
mov    $0x24,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0xb9,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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/ctype/test_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 0 for $\00"
define void @t_isxdigit_0x24() {
%1 = call i64 @isxdigit(i32 36)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 185, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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/ctype/test_isxdigit.c\00"
@.str.1 = [27 x i8] c"isxdigit should be 0 for $\00"
define void @t_isxdigit_0x24() {
%1 = tail call i64 @isxdigit(i32 36)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 185, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int csolve_mod(int a, int m) { return a % m; }


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

x86 assembly (clang, -O2):
<csolve_mod>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @csolve_mod(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
ret i32 %3
}
int qsort_cmp__VEC_ID(const void *x, const void *y) {
  if (*((int *)x) > *((int *)y))
    return (-1);
  else
    return (*((int *)x) < *((int *)y));
}


x86 assembly (clang, -O0):
<qsort_cmp__VEC_ID>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jle    112a <qsort_cmp__VEC_ID+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1141 <qsort_cmp__VEC_ID+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_cmp__VEC_ID>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setl   %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @qsort_cmp__VEC_ID(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int pipe(int *);
int pipeHelperCreatePipe(int pipefd[2]) { return pipe(pipefd); }


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

x86 assembly (clang, -O2):
<pipeHelperCreatePipe>:
jmp    1030 <pipe@plt>

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

LLVM IR (-O2):
define i32 @pipeHelperCreatePipe(i32* %0) {
%2 = tail call i32 @pipe(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int open_pty_slave(char *name) {
  int sfd;
  if ((sfd = open(name, O_RDWR, 0)) < 0) {
    return -1;
  }
  return sfd;
}


x86 assembly (clang, -O0):
<open_pty_slave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1148 <open_pty_slave+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <open_pty_slave+0x3e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_pty_slave>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <open@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @open_pty_slave(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open(i8* %5, i32 %6, i32 0)
store i32 %7, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %12
12: ; preds = %10, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @open_pty_slave(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2, i32 0)
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
unsigned int array_size(const char **array) {
  unsigned int count = 0;
  const char **ptr = array;
  while (*ptr++) {
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<array_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
cmpq   $0x0,(%rax)
je     113e <array_size+0x3e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <array_size+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_size>:
cmpq   $0x0,(%rdi)
je     111d <array_size+0x1d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <array_size+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @array_size(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8** [ %7, %4 ], [ %0, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = getelementptr inbounds i8*, i8** %5, i64 1
%8 = add i32 %6, 1
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int op_or(int, int);
int test_or() {
  if (op_or(3, 4) != (3 | 4))
    return (-1);
  return (0);
}


x86 assembly (clang, -O0):
<test_or>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <op_or@plt>
cmp    $0x7,%eax
je     113c <test_or+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1143 <test_or+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_or>:
push   %rax
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <op_or@plt>
xor    %ecx,%ecx
cmp    $0x7,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test_or() {
%1 = alloca i32
%2 = call i32 @op_or(i32 3, i32 4)
%3 = icmp ne i32 %2, 7
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 -1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_or() {
%1 = tail call i32 @op_or(i32 3, i32 4)
%2 = icmp ne i32 %1, 7
%3 = sext i1 %2 to i32
ret i32 %3
}