xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ copy_pwm_key_by_key(char const *, char *);
int get_pwm_key_by_name(char const *, char *);
int get_pwm_key(const char *input, char *key) {
  if (!copy_pwm_key_by_key(input, key)) {
    return get_pwm_key_by_name(input, key);
  }
  return 1;
}


x86 assembly (clang, -O0):
<get_pwm_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <copy_pwm_key_by_key@plt>
cmp    $0x0,%eax
jne    115b <get_pwm_key+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_pwm_key_by_name@plt>
mov    %eax,-0x4(%rbp)
jmp    1162 <get_pwm_key+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pwm_key>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <copy_pwm_key_by_key@plt>
test   %eax,%eax
je     1140 <get_pwm_key+0x20>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <get_pwm_key_by_name@plt>

LLVM IR (-O0):
define i32 @get_pwm_key(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 = load i8*, i8** %5
%8 = call i32 @copy_pwm_key_by_key(i8* %6, i8* %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i32 @get_pwm_key_by_name(i8* %11, i8* %12)
store i32 %13, i32* %3
br label %15
14: ; preds = %2
store i32 1, i32* %3
br label %15
15: ; preds = %14, %10
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @get_pwm_key(i8* %0, i8* %1) {
%3 = tail call i32 @copy_pwm_key_by_key(i8* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @get_pwm_key_by_name(i8* %0, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 1, %2 ]
ret i32 %8
}
void SetupSound(void) {}


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

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

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

LLVM IR (-O2):
define void @SetupSound() {
ret void
}
long long adddi3(long long a, long long b) { return a + b; }


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

x86 assembly (clang, -O2):
<adddi3>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @adddi3(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @adddi3(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int init_boxlib_asm();
int kolibri_boxlib_init(void) {
  int asm_init_status = init_boxlib_asm();
  if (asm_init_status == 0)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<kolibri_boxlib_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <init_boxlib_asm@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1138 <kolibri_boxlib_init+0x28>
movl   $0x0,-0x4(%rbp)
jmp    113f <kolibri_boxlib_init+0x2f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @kolibri_boxlib_init() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @init_boxlib_asm()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %8
7: ; preds = %0
store i32 1, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @kolibri_boxlib_init() {
%1 = tail call i32 (...) @init_boxlib_asm()
%2 = icmp ne i32 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ le32toh(int /*<<< orphan*/);
void unaligned_write_le32(void *_u, uint32_t a) {
  struct __attribute__((packed, may_alias)) {
    uint32_t x;
  } *u = _u;
  u->x = le32toh(a);
}


x86 assembly (clang, -O0):
<unaligned_write_le32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <le32toh@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unaligned_write_le32>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <le32toh@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.anon = type { i32 }
define void @unaligned_write_le32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.anon*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.anon*
store %struct.anon* %7, %struct.anon** %5
%8 = load i32, i32* %4
%9 = call i32 @le32toh(i32 %8)
%10 = load %struct.anon*, %struct.anon** %5
%11 = getelementptr inbounds %struct.anon, %struct.anon* %10, i32 0, i32 0
store i32 %9, i32* %11
ret void
}

LLVM IR (-O2):
define void @unaligned_write_le32(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @le32toh(i32 %1)
%4 = bitcast i8* %0 to i32*
store i32 %3, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cout(char *);
int /*<<< orphan*/ word2hexstr(unsigned int, char *);
void cout_h(unsigned int val) {
  char buff[16];
  buff[0] = '0';
  buff[1] = 'x';
  for (int i = 2; i < 16; i++)
    buff[i] = 0;
  word2hexstr(val, buff + 2);
  cout(buff);
}


x86 assembly (clang, -O0):
<cout_h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x30,-0x20(%rbp)
movb   $0x78,-0x1f(%rbp)
movl   $0x2,-0x24(%rbp)
cmpl   $0x10,-0x24(%rbp)
jge    115b <cout_h+0x3b>
movslq -0x24(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113a <cout_h+0x1a>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
add    $0x2,%rsi
call   1040 <word2hexstr@plt>
lea    -0x20(%rbp),%rdi
call   1030 <cout@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cout_h>:
sub    $0x18,%rsp
movw   $0x7830,(%rsp)
lea    0x2(%rsp),%rsi
movq   $0x0,0x2(%rsp)
movq   $0x0,0x8(%rsp)
call   1040 <word2hexstr@plt>
mov    %rsp,%rdi
call   1030 <cout@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define void @cout_h(i32 %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
store i8 48, i8* %3
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 1
store i8 120, i8* %4
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 2
%6 = call i32 @word2hexstr(i32 %0, i8* %5)
%7 = call i32 @cout(i8* %3)
ret void
}
char *strcpy(char *dest, char const *src) {
  return __builtin_strcpy(dest, src);
}


x86 assembly (clang, -O0):
<strcpy>:
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 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
jmp    1100 <strcpy>

LLVM IR (-O0):
define i8* @strcpy(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 i8* @strcpy(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @strcpy(i8* nocapture readnone %0, i8* nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  char *name;
  printf("What is your Name");
  scanf("%s", name);
  printf("Hello World %s", name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xedd(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec1(%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    0xee8(%rip),%rdi
call   1040 <scanf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"What is your Name\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [15 x i8] c"Hello World %s\00"
define void @main() {
%1 = alloca i8*
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = load i8*, i8** %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"What is your Name\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [15 x i8] c"Hello World %s\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* undef)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* undef)
ret void
}
/* Variables and functions */
scalar_t__ fake_call2();
int /*<<< orphan*/ rdtsc_markerStartRegion(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ rdtsc_markerStopRegion(char *, int, int /*<<< orphan*/);
void fake_call() {
  int j, k = 0;
  rdtsc_markerStartRegion("fake_call", 1, 0);
  for (j = 0; j < 100; j++) {
    k += fake_call2();
  }
  rdtsc_markerStopRegion("fake_call", 1, 0);
}


x86 assembly (clang, -O0):
<fake_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <rdtsc_markerStartRegion@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1185 <fake_call+0x55>
mov    $0x0,%al
call   1030 <fake_call2@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <fake_call+0x29>
lea    0xe74(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <rdtsc_markerStopRegion@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fake_call>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1050 <rdtsc_markerStartRegion@plt>
mov    $0x64,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <fake_call2@plt>
add    $0xffffffff,%ebx
jne    1150 <fake_call+0x20>
lea    0xe9d(%rip),%rdi
mov    $0x1,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <rdtsc_markerStopRegion@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"fake_call\00"
define void @fake_call() {
%1 = tail call i32 @rdtsc_markerStartRegion(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i64 (...) @fake_call2()
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 100
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @rdtsc_markerStopRegion(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0x8c() {
  Assert_real((isbdigit(140) == 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_isbdigit.c",
              705, ("isbdigit should be 0 for 0x8c"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0x8c>:
push   %rax
mov    $0x8c,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x2c1,%edx
pop    %rax
jmp    1030 <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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x8c\00"
define void @t_isbdigit_0x8c() {
%1 = call i64 @isbdigit(i32 140)
%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 705, i8* getelementptr inbounds ([30 x i8], [30 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0x8c\00"
define void @t_isbdigit_0x8c() {
%1 = tail call i64 @isbdigit(i32 140)
%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 705, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_info(void) {
  printf("Tool to search deleted files on a Smaky disk. fosfat-"
         "0.4.0"
         "\n\n"
         "Usage: fosrec [options] device destination\n\n"
         " -h --help             this help\n"
         " -v --version          version\n"
         " -a --harddisk         force an hard disk (default autodetect)\n"
         " -f --floppydisk       force a floppy disk (default autodetect)\n"
         " -l --fos-logger       that will turn on the FOS logger\n"
         "\n"
         "\nPlease, report bugs to <fosfat-devel@gamesover.ch>.\n");
}


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

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

LLVM IR (-O0):
@.str = [406 x i8] c"Tool to search deleted files on a Smaky disk. fosfat-0.4.0\0A\0AUsage: fosrec [options] device destination\0A\0A -h --help this help\0A -v --version version\0A -a --harddisk force an hard disk (default autodetect)\0A -f --floppydisk force a floppy disk (default autodetect)\0A -l --fos-logger that will turn on the FOS logger\0A\0A\0APlease, report bugs to <fosfat-devel@gamesover.ch>.\0A\00"
define void @print_info() {
%1 = call i32 @printf(i8* getelementptr inbounds ([406 x i8], [406 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [405 x i8] c"Tool to search deleted files on a Smaky disk. fosfat-0.4.0\0A\0AUsage: fosrec [options] device destination\0A\0A -h --help this help\0A -v --version version\0A -a --harddisk force an hard disk (default autodetect)\0A -f --floppydisk force a floppy disk (default autodetect)\0A -l --fos-logger that will turn on the FOS logger\0A\0A\0APlease, report bugs to <fosfat-devel@gamesover.ch>.\00"
define void @print_info() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([405 x i8], [405 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage(void) {
  fprintf(stderr, "\n"
                  "Usage: bntools align [options] <map_a> [<map_b>]\n"
                  "\n"
                  "Options:\n"
                  "   <map_a/b>   input map file(s), in tsv/cmap/bnx format\n"
                  "   -v          show verbose message\n"
                  "   -h          show this help\n"
                  "\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [185 x i8] c"\0AUsage: bntools align [options] <map_a> [<map_b>]\0A\0AOptions:\0A <map_a/b> input map file(s), in tsv/cmap/bnx format\0A -v show verbose message\0A -h show this help\0A\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [185 x i8] c"\0AUsage: bntools align [options] <map_a> [<map_b>]\0A\0AOptions:\0A <map_a/b> input map file(s), in tsv/cmap/bnx format\0A -v show verbose message\0A -h show this help\0A\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([185 x i8], [185 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f1(char *);
int /*<<< orphan*/ full_arr(char *);
int main() {
  char arr[100];
  full_arr(arr);
  f1(arr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <full_arr@plt>
lea    -0x70(%rbp),%rdi
call   1040 <f1@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <full_arr@plt>
mov    %rbx,%rdi
call   1040 <f1@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @full_arr(i8* %3)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @f1(i8* %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @full_arr(i8* %2)
%4 = call i32 @f1(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _PROCEDURE_LINKAGE_TABLE_();
void fn00027C8C() {
  _PROCEDURE_LINKAGE_TABLE_();
  return;
}


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

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

LLVM IR (-O0):
define void @fn00027C8C() {
%1 = call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}

LLVM IR (-O2):
define void @fn00027C8C() {
%1 = tail call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int sscanf(char const *, char *, int *);
int /*<<< orphan*/ stderr;
int parse_integer_or_exit(char const *str, char const *name) {
  int value;
  if (sscanf(str, "%d", &value) != 1) {
    fprintf(stderr, "\nErro no argumento \"%s\".\n\n", name);
    exit(2);
  }
  return value;
}


x86 assembly (clang, -O0):
<parse_integer_or_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1180 <parse_integer_or_exit+0x50>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_integer_or_exit>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xec1(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1158 <parse_integer_or_exit+0x28>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [27 x i8] c"\0AErro no argumento \22%s\22.\0A\0A\00"
define i32 @parse_integer_or_exit(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %4
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 2)
unreachable
14: ; preds = %2
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [27 x i8] c"\0AErro no argumento \22%s\22.\0A\0A\00"
define i32 @parse_integer_or_exit(i8* nocapture %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%10 = call i32 @exit(i32 2)
unreachable
11: ; preds = %2
%12 = load i32, i32* %3
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prgname) {
  printf("Usage : %s [OPTION] DIRECTORY FILE\n"
         "Load a barebox environment sector into a directory or\n"
         "save a directory into a barebox environment sector\n"
         "\n"
         "options:\n"
         "  -s        save (directory -> environment sector)\n"
         "  -z        force the built-in default environment at startup\n"
         "  -l        load (environment sector -> directory)\n"
         "  -p <size> pad output file to given size\n"
         "  -v        verbose\n",
         prgname);
}


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

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

LLVM IR (-O0):
@.str = [377 x i8] c"Usage : %s [OPTION] DIRECTORY FILE\0ALoad a barebox environment sector into a directory or\0Asave a directory into a barebox environment sector\0A\0Aoptions:\0A -s save (directory -> environment sector)\0A -z force the built-in default environment at startup\0A -l load (environment sector -> directory)\0A -p <size> pad output file to given size\0A -v verbose\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([377 x i8], [377 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [377 x i8] c"Usage : %s [OPTION] DIRECTORY FILE\0ALoad a barebox environment sector into a directory or\0Asave a directory into a barebox environment sector\0A\0Aoptions:\0A -s save (directory -> environment sector)\0A -z force the built-in default environment at startup\0A -l load (environment sector -> directory)\0A -p <size> pad output file to given size\0A -v verbose\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([377 x i8], [377 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void init_ndbm(void) { ; }


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

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

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

LLVM IR (-O2):
define void @init_ndbm() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func(void) { printf("func() from func_dev.c (Development) called.\n"); }


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

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

LLVM IR (-O0):
@.str = [46 x i8] c"func() from func_dev.c (Development) called.\0A\00"
define void @func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [45 x i8] c"func() from func_dev.c (Development) called.\00"
define void @func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct tree_node {
  int dummy;
};

/* Variables and functions */
struct tree_node *deserialize();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ serialize(struct tree_node *);
int main(void) {
  printf("Enter preorder traversal followed by inorder traversal\n");
  struct tree_node *root = deserialize();
  printf("Built tree:\n");
  serialize(root);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <deserialize@plt>
mov    %rax,%rbx
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <serialize@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tree_node = type { i32 }
@.str = [56 x i8] c"Enter preorder traversal followed by inorder traversal\0A\00"
@.str.1 = [13 x i8] c"Built tree:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tree_node*
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%4 = call %struct.tree_node* (...) @deserialize()
store %struct.tree_node* %4, %struct.tree_node** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = load %struct.tree_node*, %struct.tree_node** %2
%7 = call i32 @serialize(%struct.tree_node* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.tree_node = type { i32 }
@str = [55 x i8] c"Enter preorder traversal followed by inorder traversal\00"
@str.2 = [12 x i8] c"Built tree:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%2 = tail call %struct.tree_node* (...) @deserialize()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @serialize(%struct.tree_node* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
void reallocate(unsigned char **p, int s) {
  if (!p)
    return;
  if (*p)
    free(*p);
  *p = malloc(s);
  memset(*p, 0, s);
}


x86 assembly (clang, -O0):
<reallocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114f <reallocate+0x1f>
jmp    118c <reallocate+0x5c>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1169 <reallocate+0x39>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocate>:
test   %rdi,%rdi
je     1166 <reallocate+0x36>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     114a <reallocate+0x1a>
call   1030 <free@plt>
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <memset@plt>
ret

LLVM IR (-O0):
define void @reallocate(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 = icmp ne i8** %5, null
br i1 %6, label %8, label %7
7: ; preds = %2
br label %24
8: ; preds = %2
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = call i32 @free(i8* %14)
br label %16
16: ; preds = %12, %8
%17 = load i32, i32* %4
%18 = call i8* @malloc(i32 %17)
%19 = load i8**, i8*** %3
store i8* %18, i8** %19
%20 = load i8**, i8*** %3
%21 = load i8*, i8** %20
%22 = load i32, i32* %4
%23 = call i32 @memset(i8* %21, i32 0, i32 %22)
br label %24
24: ; preds = %16, %7
ret void
}

LLVM IR (-O2):
define void @reallocate(i8** %0, i32 %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = load i8*, i8** %0
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @free(i8* %5)
br label %9
9: ; preds = %7, %4
%10 = tail call i8* @malloc(i32 %1)
store i8* %10, i8** %0
%11 = tail call i32 @memset(i8* %10, i32 0, i32 %1)
br label %12
12: ; preds = %2, %9
ret void
}
int compare(const void *a1, const void *a2) {
  int i1 = *((const int *)a1);
  int i2 = *((const int *)a2);
  if (i1 < i2)
    return (-1);
  if (i1 > i2)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <compare+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <compare+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    114e <compare+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1155 <compare+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @compare(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 slt i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *fgets(char *, int, int /*<<< orphan*/ *);
char *c_fgets(char *s, int size, void *stream) {
  return fgets(s, size, (FILE *)stream);
}


x86 assembly (clang, -O0):
<c_fgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_fgets>:
jmp    1030 <fgets@plt>

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

LLVM IR (-O2):
define i8* @c_fgets(i8* %0, i32 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = tail call i8* @fgets(i8* %0, i32 %1, i32* %4)
ret i8* %5
}
/* Variables and functions */
unsigned short csc_crc_ccitt_byte(unsigned short, int /*<<< orphan*/);
unsigned short csc_crc_ccitt(unsigned short crc, void *buf, size_t len) {
  unsigned char *p = buf;
  while (len--) {
    crc = csc_crc_ccitt_byte(crc, *p++);
  }
  return crc;
}


x86 assembly (clang, -O0):
<csc_crc_ccitt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     116f <csc_crc_ccitt+0x5f>
mov    -0x2(%rbp),%ax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
movzbl (%rcx),%esi
movzwl %ax,%edi
call   1030 <csc_crc_ccitt_byte@plt>
mov    %ax,-0x2(%rbp)
jmp    112f <csc_crc_ccitt+0x1f>
movzwl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csc_crc_ccitt>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%eax
test   %rdx,%rdx
je     1146 <csc_crc_ccitt+0x36>
mov    %rdx,%r15
mov    %rsi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%r14,%rbx,1),%esi
movzwl %ax,%edi
call   1030 <csc_crc_ccitt_byte@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <csc_crc_ccitt+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define zeroext i16 @csc_crc_ccitt(i16 zeroext %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %5
%6 = phi i8* [ %10, %5 ], [ %1, %3 ]
%7 = phi i64 [ %9, %5 ], [ %2, %3 ]
%8 = phi i16 [ %13, %5 ], [ %0, %3 ]
%9 = add i64 %7, -1
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = tail call zeroext i16 @csc_crc_ccitt_byte(i16 zeroext %8, i32 %12)
%14 = icmp eq i64 %9, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %3
%16 = phi i16 [ %0, %3 ], [ %13, %5 ]
ret i16 %16
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int const);
int snprintf(char *, int const, char *, unsigned int const);
int uinttostr_noalloc(char *buf, const int buf_len, const unsigned val) {
  ;
  int ret;
  memset(buf, 0, buf_len);
  ret = snprintf(buf, buf_len, "%u", val);
  if (ret >= buf_len)
    ret = -1;
  return ret;
}


x86 assembly (clang, -O0):
<uinttostr_noalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xeaf(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     116c <uinttostr_noalloc+0x4c>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uinttostr_noalloc>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <memset@plt>
lea    0xec4(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%ecx
call   1030 <snprintf@plt>
cmp    %ebp,%eax
mov    $0xffffffff,%ecx
cmovge %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define i32 @uinttostr_noalloc(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
%5 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = icmp slt i32 %5, %1
%7 = select i1 %6, i32 %5, i32 -1
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
void wr_scrn_printf(int16_t r, int16_t c, const char *fmt, ...) { return; }


x86 assembly (clang, -O0):
<wr_scrn_printf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @wr_scrn_printf(i32 %0, i32 %1, i8* nocapture %2, ...) {
ret void
}
unsigned short swapped(unsigned short a) { return (a >> 8) | (a << 8); }


x86 assembly (clang, -O0):
<swapped>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzwl -0x2(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapped>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @swapped(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @swapped(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ util_prg_print_parse_error();
int /*<<< orphan*/ warnx(char *, char const *);
void misc_print_required_parm(const char *parm_name) {
  warnx("Parameter '%s' is required", parm_name);
  util_prg_print_parse_error();
}


x86 assembly (clang, -O0):
<misc_print_required_parm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <warnx@plt>
mov    $0x0,%al
call   1030 <util_prg_print_parse_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<misc_print_required_parm>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <warnx@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <util_prg_print_parse_error@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Parameter '%s' is required\00"
define void @misc_print_required_parm(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @warnx(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @util_prg_print_parse_error()
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Parameter '%s' is required\00"
define void @misc_print_required_parm(i8* %0) {
%2 = tail call i32 @warnx(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @util_prg_print_parse_error()
ret void
}
unsigned long fibonacci(unsigned short n) {
  if (n == 0) {
    return 2;
  }
  if (n == 1) {
    return 1;
  }
  return fibonacci(n - 1) + fibonacci(n - 2);
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
cmp    $0x0,%eax
jne    1139 <fibonacci+0x29>
movq   $0x2,-0x8(%rbp)
jmp    1183 <fibonacci+0x73>
movzwl -0xa(%rbp),%eax
cmp    $0x1,%eax
jne    1153 <fibonacci+0x43>
movq   $0x1,-0x8(%rbp)
jmp    1183 <fibonacci+0x73>
movzwl -0xa(%rbp),%eax
sub    $0x1,%eax
movzwl %ax,%edi
call   1030 <fibonacci@plt>
mov    %rax,-0x18(%rbp)
movzwl -0xa(%rbp),%eax
sub    $0x2,%eax
movzwl %ax,%edi
call   1030 <fibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
test   %bx,%bx
je     113c <fibonacci+0x2c>
xchg   %ax,%ax
cmp    $0x1,%bx
je     1143 <fibonacci+0x33>
lea    -0x1(%rbx),%eax
movzwl %ax,%edi
call   1030 <fibonacci@plt>
add    %rax,%r14
add    $0xfffffffe,%ebx
test   %bx,%bx
jne    1120 <fibonacci+0x10>
mov    $0x2,%eax
jmp    1148 <fibonacci+0x38>
mov    $0x1,%eax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibonacci(i16 zeroext %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i64 [ 0, %1 ], [ %9, %5 ]
%4 = phi i16 [ %0, %1 ], [ %8, %5 ]
switch i16 %4, label %5 [
i16 0, label %10
i16 1, label %11
]
5: ; preds = %2
%6 = add i16 %4, -1
%7 = tail call i64 @fibonacci(i16 zeroext %6)
%8 = add i16 %4, -2
%9 = add i64 %7, %3
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i64 [ 2, %10 ], [ 1, %2 ]
%13 = add i64 %12, %3
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
int /*<<< orphan*/ pt(int *, int);
int main(void) {
  const int a = 100;
  const int *ptr1 = &a;
  int b = 200;
  int const *ptr2;
  printf("*ptr2 = %d \n", *ptr2);
  int arr[] = {20, 30, 40, 50};
  pt(arr, 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0xc8,-0x14(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    0xeb2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
call   1040 <pt@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1040 <pt@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"*ptr2 = %d \0A\00"
@__const.main.arr = [4 x i32] [i32 20, i32 30, i32 40, i32 50]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca [4 x i32]
store i32 0, i32* %1
store i32 100, i32* %2
store i32* %2, i32** %3
store i32 200, i32* %4
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = bitcast [4 x i32]* %6 to i8*
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %6, i64 0, i64 0
%12 = call i32 @pt(i32* %11, i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"*ptr2 = %d \0A\00"
@__const.main.arr = [4 x i32] [i32 20, i32 30, i32 40, i32 50]
define i32 @main() {
%1 = alloca [4 x i32]
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 undef)
%3 = bitcast [4 x i32]* %1 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%5 = call i32 @pt(i32* %4, i32 4)
ret i32 0
}