xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *hoedown_realloc(void *ptr, size_t size) {
  void *ret = realloc(ptr, size);
  if (!ret) {
    fprintf(stderr, "Allocation failed.\n");
    abort();
  }
  return ret;
}


x86 assembly (clang, -O0):
<hoedown_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1178 <hoedown_realloc+0x48>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hoedown_realloc>:
push   %rax
call   1050 <realloc@plt>
test   %rax,%rax
je     113d <hoedown_realloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Allocation failed.\0A\00"
define noalias i8* @hoedown_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int unlink(char const *);
int clear_testfile(const char *testfile_name) {
  return (unlink(testfile_name));
}


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

x86 assembly (clang, -O2):
<clear_testfile>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define i32 @clear_testfile(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret i32 %2
}
/* Variables and functions */
size_t strlen(char *const);
size_t fts_maxarglen(char *const *argv) {
  size_t len, max;
  ;
  for (max = 0; *argv; ++argv)
    if ((len = strlen(*argv)) > max)
      max = len;
  return (max + 1);
}


x86 assembly (clang, -O0):
<fts_maxarglen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     116a <fts_maxarglen+0x5a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmp    -0x18(%rbp),%rax
jbe    1154 <fts_maxarglen+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1159 <fts_maxarglen+0x49>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <fts_maxarglen+0x14>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fts_maxarglen>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     114e <fts_maxarglen+0x3e>
add    $0x8,%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
call   1030 <strlen@plt>
cmp    %r14,%rax
cmova  %rax,%r14
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <fts_maxarglen+0x20>
add    $0x1,%r14
jmp    1154 <fts_maxarglen+0x44>
mov    $0x1,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fts_maxarglen(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8** [ %11, %4 ], [ %0, %1 ]
%8 = tail call i64 @strlen(i8* %5)
%9 = icmp ugt i64 %8, %6
%10 = select i1 %9, i64 %8, i64 %6
%11 = getelementptr inbounds i8*, i8** %7, i64 1
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = add i64 %10, 1
br label %16
16: ; preds = %14, %1
%17 = phi i64 [ 1, %1 ], [ %15, %14 ]
ret i64 %17
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(size_t);
int /*<<< orphan*/ qsort_aux(void *, size_t, size_t,
                             int (*)(void const *, void const *), void *);
void qsort(void *base, size_t nmemb, size_t size,
           int (*compar)(const void *, const void *)) {
  void *swap_space = malloc(size);
  qsort_aux(base, nmemb, size, compar, swap_space);
  free(swap_space);
}


x86 assembly (clang, -O0):
<qsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1050 <qsort_aux@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rdx,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %rax,%r8
call   1050 <qsort_aux@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @qsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32 (i8*, i8*)*
%9 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 (i8*, i8*)* %3, i32 (i8*, i8*)** %8
%10 = load i64, i64* %7
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %9
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = load i64, i64* %7
%15 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %8
%16 = load i8*, i8** %9
%17 = call i32 @qsort_aux(i8* %12, i64 %13, i64 %14, i32 (i8*, i8*)* %15, i8* %16)
%18 = load i8*, i8** %9
%19 = call i32 @free(i8* %18)
ret void
}

LLVM IR (-O2):
define void @qsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = tail call i8* @malloc(i64 %2)
%6 = tail call i32 @qsort_aux(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3, i8* %5)
%7 = tail call i32 @free(i8* %5)
ret void
}
/* Variables and functions */
float fmin(float _a, float _b) { return _a < _b ? _a : _b; }


x86 assembly (clang, -O0):
<fmin>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <fmin+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <fmin+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmin>:
minss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @fmin(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ exit_game(int);
int /*<<< orphan*/ reset_scrn();
void signal_handler(int sig) {
  reset_scrn();
  exit_game(1);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <reset_scrn@plt>
mov    $0x1,%edi
call   1040 <exit_game@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
xor    %eax,%eax
call   1030 <reset_scrn@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <exit_game@plt>

LLVM IR (-O0):
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @reset_scrn()
%4 = call i32 @exit_game(i32 1)
ret void
}

LLVM IR (-O2):
define void @signal_handler(i32 %0) {
%2 = tail call i32 (...) @reset_scrn()
%3 = tail call i32 @exit_game(i32 1)
ret void
}
/* Variables and functions */
int PHYSFS_mount(char const *, int /*<<< orphan*/ *, int);
int PHYSFS_addToSearchPath(const char *newDir, int appendToPath) {
  return (PHYSFS_mount(newDir, NULL, appendToPath));
}


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

x86 assembly (clang, -O2):
<PHYSFS_addToSearchPath>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <PHYSFS_mount@plt>

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

LLVM IR (-O2):
define i32 @PHYSFS_addToSearchPath(i8* %0, i32 %1) {
%3 = tail call i32 @PHYSFS_mount(i8* %0, i32* null, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ CRT_done();
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void CRT_handleSIGSEGV(int sgn) {
  (void)sgn;
  CRT_done();
  fprintf(stderr, "\n\nhtop "
                  "1.0.3"
                  " aborting. Please report bug at http://hisham.hm/htop\n");
  abort();
}


x86 assembly (clang, -O0):
<CRT_handleSIGSEGV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <CRT_done@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<CRT_handleSIGSEGV>:
push   %rax
xor    %eax,%eax
call   1050 <CRT_done@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"\0A\0Ahtop 1.0.3 aborting. Please report bug at http://hisham.hm/htop\0A\00"
define void @CRT_handleSIGSEGV(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @CRT_done()
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"\0A\0Ahtop 1.0.3 aborting. Please report bug at http://hisham.hm/htop\0A\00"
define void @CRT_handleSIGSEGV(i32 %0) {
%2 = tail call i32 (...) @CRT_done()
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long timeout_ms(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<timeout_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeout_ms>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @timeout_ms() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = sdiv i32 %7, 1000
%9 = add nsw i32 %5, %8
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @timeout_ms() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
%11 = sext i32 %10 to i64
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ prefix();
void f_empty_while_loop_prefix() {
  prefix();
  while (1) {
  }
}


x86 assembly (clang, -O0):
<f_empty_while_loop_prefix>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <prefix@plt>
jmp    111b <f_empty_while_loop_prefix+0xb>

x86 assembly (clang, -O2):
<f_empty_while_loop_prefix>:
push   %rax
xor    %eax,%eax
call   1030 <prefix@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <f_empty_while_loop_prefix+0x10>

LLVM IR (-O0):
define void @f_empty_while_loop_prefix() {
%1 = call i32 (...) @prefix()
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define void @f_empty_while_loop_prefix() {
%1 = tail call i32 (...) @prefix()
br label %2
2: ; preds = %0, %2
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int CountCharacters(FILE *InputFile) {
  int counter = 0;
  char c;
  while ((c = fgetc(InputFile)) != ('\n')) {
    if (c == EOF)
      break;
    counter++;
  }
  rewind(InputFile);
  return counter;
}


x86 assembly (clang, -O0):
<CountCharacters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1174 <CountCharacters+0x54>
movsbl -0xd(%rbp),%eax
mov    0x2e92(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1166 <CountCharacters+0x46>
jmp    1174 <CountCharacters+0x54>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <CountCharacters+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CountCharacters>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0xffffffff,%ebx
mov    0x2eb4(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <fgetc@plt>
add    $0x1,%ebx
cmp    $0xa,%al
je     1154 <CountCharacters+0x34>
cmp    (%r15),%al
jne    1140 <CountCharacters+0x20>
mov    %r14,%rdi
call   1030 <rewind@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @CountCharacters(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8
store i32* %0, i32** %2
store i32 0, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32*, i32** %2
%7 = call signext i8 @fgetc(i32* %6)
store i8 %7, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = load i8, i8* @EOF
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %12, %14
br i1 %15, label %16, label %17
16: ; preds = %10
br label %20
17: ; preds = %10
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %16, %5
%21 = load i32*, i32** %2
%22 = call i32 @rewind(i32* %21)
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @CountCharacters(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %9, %2 ]
%4 = tail call signext i8 @fgetc(i32* %0)
%5 = icmp eq i8 %4, 10
%6 = load i8, i8* @EOF
%7 = icmp eq i8 %4, %6
%8 = select i1 %5, i1 true, i1 %7
%9 = add nuw nsw i32 %3, 1
br i1 %8, label %10, label %2
10: ; preds = %2
%11 = tail call i32 @rewind(i32* %0)
ret i32 %3
}
/* Variables and functions */
int little_endian(char);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int i = 0x12345678;
  char *p = (char *)&i;
  if (little_endian(*p) == 1) {
    printf("little endian.\n");
  } else {
    printf("big endian.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12345678,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <little_endian@plt>
cmp    $0x1,%eax
jne    1164 <main+0x44>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
jmp    1170 <main+0x50>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x78,%edi
call   1040 <little_endian@plt>
cmp    $0x1,%eax
lea    0xed7(%rip),%rax
lea    0xec4(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"little endian.\0A\00"
@.str.1 = [13 x i8] c"big endian.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
store i32 305419896, i32* %2
%4 = bitcast i32* %2 to i8*
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = call i32 @little_endian(i8 signext %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"big endian.\00"
@str.2 = [15 x i8] c"little endian.\00"
define i32 @main() {
%1 = tail call i32 @little_endian(i8 signext 120)
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 0
}
int f9(unsigned char c) {
  if (c == 0x22)
    return 0;
  if (c == 0x20)
    return 0;
  if (c < 0x20)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<f9>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x22,%eax
jne    1123 <f9+0x23>
movl   $0x0,-0x4(%rbp)
jmp    115c <f9+0x5c>
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    113c <f9+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    115c <f9+0x5c>
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jge    1155 <f9+0x55>
movl   $0x0,-0x4(%rbp)
jmp    115c <f9+0x5c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f9>:
xor    %eax,%eax
mov    %edi,%ecx
or     $0x2,%cl
cmp    $0x22,%cl
jne    110d <f9+0xd>
ret
xor    %eax,%eax
cmp    $0x20,%dil
setae  %al
ret

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

LLVM IR (-O2):
define i32 @f9(i8 zeroext %0) {
switch i8 %0, label %2 [
i8 34, label %5
i8 32, label %5
]
2: ; preds = %1
%3 = icmp ugt i8 %0, 31
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %2, %1, %1
%6 = phi i32 [ 0, %1 ], [ 0, %1 ], [ %4, %2 ]
ret i32 %6
}
void dev_init_buffers(struct net_device *dev) {}


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

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

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

LLVM IR (-O2):
%struct.net_device = type opaque
define void @dev_init_buffers(%struct.net_device* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main(void) {
  int i;
  while (scanf("%i", &i))
    if (i ^ 42)
      printf("%i\n", i);
    else
      break;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     1176 <main+0x56>
mov    -0x8(%rbp),%eax
xor    $0x2a,%eax
cmp    $0x0,%eax
je     116c <main+0x4c>
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    1171 <main+0x51>
jmp    1176 <main+0x56>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1181 <main+0x61>
lea    0xebd(%rip),%r14
lea    0xeb3(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
je     1181 <main+0x61>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %0, %8
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 42
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %8, %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int main(int argc, char **argv) {
  argv[0] = "fgrep";
  execv("/vsta/bin/grep", argv);
  return (1);
}


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
lea    0xecf(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rsi
lea    0xec7(%rip),%rdi
call   1030 <execv@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"fgrep\00"
@.str.1 = [15 x i8] c"/vsta/bin/grep\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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = load i8**, i8*** %5
%9 = call i32 @execv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %8)
ret i32 1
}

LLVM IR (-O2):
@.str = [6 x i8] c"fgrep\00"
@.str.1 = [15 x i8] c"/vsta/bin/grep\00"
define i32 @main(i32 %0, i8** %1) {
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = tail call i32 @execv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %1)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void gen_lohi(FILE *outfile, int lohi) {
  fprintf(outfile, "_");
  if (lohi == 0) {
    fprintf(outfile, "lo");
  } else {
    fprintf(outfile, "hi");
  }
}


x86 assembly (clang, -O0):
<gen_lohi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    114e <gen_lohi+0x3e>
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
jmp    115e <gen_lohi+0x4e>
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_lohi>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x5f,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
test   %ebp,%ebp
lea    0xec2(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"_\00"
@.str.1 = [3 x i8] c"lo\00"
@.str.2 = [3 x i8] c"hi\00"
define void @gen_lohi(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 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"lo\00"
@.str.2 = [3 x i8] c"hi\00"
define void @gen_lohi(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fputc(i32 95, i32* %0)
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%6 = tail call i64 @fwrite(i8* %5, i64 2, i64 1, i32* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fail(char *);
scalar_t__ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
long int size(FILE *file) {
  if (fseek(file, 0, SEEK_END) != 0)
    fail("Unable to access file.\n");
  return ftell(file);
}


x86 assembly (clang, -O0):
<size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
cmp    $0x0,%rax
je     1166 <size+0x36>
lea    0xe9f(%rip),%rdi
call   1030 <fail@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<size>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
test   %rax,%rax
je     1155 <size+0x25>
lea    0xeb0(%rip),%rdi
call   1030 <fail@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <ftell@plt>

LLVM IR (-O0):
@SEEK_END = global i32 0
@.str = [24 x i8] c"Unable to access file.\0A\00"
define i64 @size(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @SEEK_END
%5 = call i64 @fseek(i32* %3, i32 0, i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @fail(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32*, i32** %2
%11 = call i64 @ftell(i32* %10)
ret i64 %11
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@.str = [24 x i8] c"Unable to access file.\0A\00"
define i64 @size(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i64 @fseek(i32* %0, i32 0, i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @fail(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = tail call i64 @ftell(i32* %0)
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ compress(char *, char *);
int main(int argc, char **argv) {
  compress("Opdracht3.c", "Opdracht3_compressed.c");
  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
lea    0xed8(%rip),%rsi
call   1030 <compress@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"Opdracht3.c\00"
@.str.1 = [23 x i8] c"Opdracht3_compressed.c\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 @compress(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Opdracht3.c\00"
@.str.1 = [23 x i8] c"Opdracht3_compressed.c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @compress(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
unsigned int REG_SPI_BASE(unsigned int);
__attribute__((always_)) __attribute__((flatten)) unsigned int
SPI_CTRL1(unsigned int i) {
  return (REG_SPI_BASE(i) + 0x0c);
}


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

x86 assembly (clang, -O2):
<SPI_CTRL1>:
push   %rax
call   1030 <REG_SPI_BASE@plt>
add    $0xc,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @SPI_CTRL1(i32 %0) {
%2 = tail call i32 @REG_SPI_BASE(i32 %0)
%3 = add i32 %2, 12
ret i32 %3
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR7D_get(void) { return U_WMRCORENONE_get("U_WMR7D"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR7D\00"
define i32 @U_WMR7D_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR7D\00"
define i32 @U_WMR7D_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
struct bstree_node {
  int dummy;
};
struct bstree {
  int dummy;
};

/* Variables and functions */
struct bstree_node *do_lookup(struct bstree_node const *, struct bstree const *,
                              struct bstree_node **, int *);
struct bstree_node *bstree_lookup(const struct bstree_node *key,
                                  const struct bstree *tree) {
  struct bstree_node *parent;
  int is_left;
  return do_lookup(key, tree, &parent, &is_left);
}


x86 assembly (clang, -O0):
<bstree_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1030 <do_lookup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bstree_lookup>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <do_lookup@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.bstree_node = type { i32 }
%struct.bstree = type { i32 }
define %struct.bstree_node* @bstree_lookup(%struct.bstree_node* %0, %struct.bstree* %1) {
%3 = alloca %struct.bstree_node*
%4 = alloca %struct.bstree*
%5 = alloca %struct.bstree_node*
%6 = alloca i32
store %struct.bstree_node* %0, %struct.bstree_node** %3
store %struct.bstree* %1, %struct.bstree** %4
%7 = load %struct.bstree_node*, %struct.bstree_node** %3
%8 = load %struct.bstree*, %struct.bstree** %4
%9 = call %struct.bstree_node* @do_lookup(%struct.bstree_node* %7, %struct.bstree* %8, %struct.bstree_node** %5, i32* %6)
ret %struct.bstree_node* %9
}

LLVM IR (-O2):
%struct.bstree_node = type { i32 }
%struct.bstree = type { i32 }
define %struct.bstree_node* @bstree_lookup(%struct.bstree_node* %0, %struct.bstree* %1) {
%3 = alloca %struct.bstree_node*
%4 = alloca i32
%5 = bitcast %struct.bstree_node** %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call %struct.bstree_node* @do_lookup(%struct.bstree_node* %0, %struct.bstree* %1, %struct.bstree_node** %3, i32* %4)
ret %struct.bstree_node* %7
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ subwindow;
};
typedef TYPE_1__ XButtonPressedEvent;

/* Variables and functions */
unsigned long get_XButtonPressedEvent_subwindow(void *_p) {
  return (unsigned long)((XButtonPressedEvent *)_p)->subwindow;
}


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

x86 assembly (clang, -O2):
<get_XButtonPressedEvent_subwindow>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XButtonPressedEvent_subwindow(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XButtonPressedEvent_subwindow(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int num;
  printf("Digite um numero: ");
  scanf("%d", &num);
  printf("%d \n", num + 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
add    $0x2,%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0x2,%esi
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%d \0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"%d \0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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 = add nsw i32 %5, 2
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret void
}
A0RX1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*((unsigned short *)10000000)) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0RX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movzwl (%rax),%eax
mov    -0x20(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movzwl (%rcx,%rdx,2),%ecx
cmp    %ecx,%eax
jg     1147 <A0RX1+0x47>
movl   $0x1,-0x4(%rbp)
jmp    114e <A0RX1+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0RX1>:
movzwl 0x989680,%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%r9,%rcx,2),%dx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @A0RX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture %5) {
%7 = load i16, i16* inttoptr (i64 10000000 to i16*)
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i16, i16* %5, i64 %8
%10 = load i16, i16* %9
%11 = icmp ule i16 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
struct dirent {
  int d_type;
};

/* Variables and functions */
int c_dirent_mode(struct dirent *ep) { return ep->d_type; }


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

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

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @c_dirent_mode(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @c_dirent_mode(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
int part_guesses(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @part_guesses() {
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int solcon_dimension_of_dobldobl_solutions(int *dimension) {
  int *a, fail;
  double *c;
  fail = _ada_use_c2phc4c(343, a, dimension, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_dimension_of_dobldobl_solutions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x157,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_dimension_of_dobldobl_solutions>:
mov    %rdi,%rdx
mov    $0x157,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @solcon_dimension_of_dobldobl_solutions(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32* %0, i32** %2
%6 = load i32*, i32** %3
%7 = load i32*, i32** %2
%8 = load double*, double** %5
%9 = call i32 @_ada_use_c2phc4c(i32 343, i32* %6, i32* %7, double* %8, i32 0)
store i32 %9, i32* %4
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
define i32 @solcon_dimension_of_dobldobl_solutions(i32* %0) {
%2 = tail call i32 @_ada_use_c2phc4c(i32 343, i32* undef, i32* %0, double* undef, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void defOnDomainRegistered(char *domain) {
  printf("defOnDomainRegistered %s\n", domain);
}


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

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

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

LLVM IR (-O2):
@.str = [26 x i8] c"defOnDomainRegistered %s\0A\00"
define void @defOnDomainRegistered(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int strlen(char *);
void str_trim(char *line) {
  int len = strlen(line) - 1;
  if (line[len] == '\n' || line[len] == '\r') {
    line[len] = '\0';
  }
}


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

x86 assembly (clang, -O2):
<str_trim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
mov    -0x1(%rax,%rbx,1),%cl
cmp    $0xd,%cl
je     1129 <str_trim+0x19>
cmp    $0xa,%cl
jne    112e <str_trim+0x1e>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @str_trim(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %8 [
i8 10, label %7
i8 13, label %7
]
7: ; preds = %1, %1
store i8 0, i8* %5
br label %8
8: ; preds = %1, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void main(void) {
  int n = 6, m = 3;
  n *= m + 1;
  printf("%i %i\n", m, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x6,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x3,%esi
mov    $0x18,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%i %i\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 6, i32* %1
store i32 3, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, %4
store i32 %6, i32* %1
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%i %i\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 3, i32 24)
ret void
}