xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void sysWarn(const char *msg) {
  fprintf(stdout, "Warning: %s\n", msg);
  fprintf(stdout, "ignoring\n\n");
}


x86 assembly (clang, -O0):
<sysWarn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysWarn>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rbx
mov    (%rbx),%edi
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed9(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [13 x i8] c"Warning: %s\0A\00"
@.str.1 = [11 x i8] c"ignoring\0A\0A\00"
define void @sysWarn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stdout
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [13 x i8] c"Warning: %s\0A\00"
@.str.1 = [11 x i8] c"ignoring\0A\0A\00"
define void @sysWarn(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void I2C2_EV_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @I2C2_EV_IRQHandler() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ zsim_magic_op(int);
void zsim_roi_begin() {
  printf("["
         "HOOKS"
         "] ROI begin\n");
  zsim_magic_op((1025));
}


x86 assembly (clang, -O0):
<zsim_roi_begin>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x401,%edi
call   1040 <zsim_magic_op@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zsim_roi_begin>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x401,%edi
pop    %rax
jmp    1040 <zsim_magic_op@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"[HOOKS] ROI begin\0A\00"
define void @zsim_roi_begin() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @zsim_magic_op(i32 1025)
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"[HOOKS] ROI begin\00"
define void @zsim_roi_begin() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @zsim_magic_op(i32 1025)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xda() {
  Assert_real((iscntrl(218) == 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_iscntrl.c",
              1095, ("iscntrl should be 0 for 0xda"));
}


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

x86 assembly (clang, -O2):
<t_iscntrl_0xda>:
push   %rax
mov    $0xda,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x447,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xda\00"
define void @t_iscntrl_0xda() {
%1 = call i64 @iscntrl(i32 218)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1095, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xda\00"
define void @t_iscntrl_0xda() {
%1 = tail call i64 @iscntrl(i32 218)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1095, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
main() {
  int c;
  while ((c = getchar()) != EOF)
    putchar(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1155 <main+0x35>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%eax
je     1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %2
%9 = call i32 @putchar(i32 %8)
br label %3
10: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @putchar(i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
unsigned xrop3_51_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  stk1 = ~S;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_51_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_51_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
shl    $0x8,%esi
or     %esi,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @xrop3_51_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
store i32 %14, i32* %6
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 8
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = or i32 %17, %19
store i32 %20, i32* %7
%21 = load i32, i32* %6
%22 = xor i32 %21, -1
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = and i32 %23, %24
%26 = load i32, i32* %8
%27 = load i32, i32* %7
%28 = xor i32 %27, -1
%29 = and i32 %26, %28
%30 = or i32 %25, %29
%31 = load i32, i32* %7
%32 = load i32, i32* %6
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = load i32, i32* %5
%36 = and i32 %34, %35
%37 = or i32 %30, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @xrop3_51_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %4, %6
%8 = xor i32 %7, -1
ret i32 %8
}
/* Type definitions */
struct stack {
  int dummy;
};

/* Variables and functions */
int isEmpty(struct stack *ptrTop) { return (ptrTop == NULL) ? 0 : 1; }


x86 assembly (clang, -O0):
<isEmpty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEmpty>:
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
ret

LLVM IR (-O0):
%struct.stack = type { i32 }
define i32 @isEmpty(%struct.stack* %0) {
%2 = alloca %struct.stack*
store %struct.stack* %0, %struct.stack** %2
%3 = load %struct.stack*, %struct.stack** %2
%4 = icmp eq %struct.stack* %3, null
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 0, i32 1
ret i32 %6
}

LLVM IR (-O2):
%struct.stack = type { i32 }
define i32 @isEmpty(%struct.stack* readnone %0) {
%2 = icmp ne %struct.stack* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void put1bcd(uint8_t v) {
  v &= 0x0F;
  putchar('0' + v);
}


x86 assembly (clang, -O0):
<put1bcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put1bcd>:
and    $0xf,%edi
or     $0x30,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @put1bcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 48, %5
%7 = call i32 @putchar(i32 %6)
ret void
}

LLVM IR (-O2):
define void @put1bcd(i32 %0) {
%2 = and i32 %0, 15
%3 = or i32 %2, 48
%4 = tail call i32 @putchar(i32 %3)
ret void
}
void INT_Excep_PERIA_INTA227(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIA_INTA227() {
ret void
}
int optdevider(char c) {
  switch (c) {
  case '\0':
  case '=':
    return 1;
  default:
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<optdevider>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     112f <optdevider+0x2f>
jmp    111e <optdevider+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x3d,%eax
jne    113b <optdevider+0x3b>
jmp    112f <optdevider+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1147 <optdevider+0x47>
jmp    1140 <optdevider+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<optdevider>:
test   %dil,%dil
sete   %al
cmp    $0x3d,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @optdevider(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 0, label %6
i32 61, label %6
]
6: ; preds = %1, %1
store i32 1, i32* %2
br label %9
7: ; preds = %1
br label %8
8: ; preds = %7
store i32 0, i32* %2
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @optdevider(i8 signext %0) {
%2 = icmp eq i8 %0, 0
%3 = icmp eq i8 %0, 61
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ show_backtrace(int);
void *posix__Passwd__from_uid(void *self, long p0) {
  void *var;
  printf("NOT YET IMPLEMENTED nitni for posix#Passwd#from_uid at "
         "lib/standard/posix.nit:44,2--51\n");
  show_backtrace(1);
RET_LABEL:;
  return var;
}


x86 assembly (clang, -O0):
<posix__Passwd__from_uid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <show_backtrace@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [88 x i8] c"NOT YET IMPLEMENTED nitni for posix#Passwd#from_uid at lib/standard/posix.nit:44,2--51\0A\00"
define i8* @posix__Passwd__from_uid(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @show_backtrace(i32 1)
br label %8
8: ; preds = %2
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
@str = [87 x i8] c"NOT YET IMPLEMENTED nitni for posix#Passwd#from_uid at lib/standard/posix.nit:44,2--51\00"
define noalias i8* @posix__Passwd__from_uid(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([87 x i8], [87 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @show_backtrace(i32 1)
ret i8* undef
}
void tdefault_commit_resume(struct target_ops *self) {}


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

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

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

LLVM IR (-O2):
%struct.target_ops = type opaque
define void @tdefault_commit_resume(%struct.target_ops* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PS_SetBaseFolder(char *);
void PC_SetBaseFolder(char *path) { PS_SetBaseFolder(path); }


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

x86 assembly (clang, -O2):
<PC_SetBaseFolder>:
jmp    1030 <PS_SetBaseFolder@plt>

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

LLVM IR (-O2):
define void @PC_SetBaseFolder(i8* %0) {
%2 = tail call i32 @PS_SetBaseFolder(i8* %0)
ret void
}
/* Variables and functions */
int next_utf8(char const *, int *);
int fn_ch_101(const char *text) {
  int pos = 0;
  if (next_utf8(text, &pos) == 101)
    return pos;
  return -1;
}


x86 assembly (clang, -O0):
<fn_ch_101>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <next_utf8@plt>
cmp    $0x65,%eax
jne    1144 <fn_ch_101+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <fn_ch_101+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_ch_101>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <next_utf8@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x65,%ecx
jne    1133 <fn_ch_101+0x23>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @fn_ch_101(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @next_utf8(i8* %0, i32* %2)
%5 = icmp eq i32 %4, 101
%6 = load i32, i32* %2
%7 = select i1 %5, i32 %6, i32 -1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ MAXPATHLEN;
char *basename_r(char *, char *);
scalar_t__ malloc(int /*<<< orphan*/);
char *basename(char *path) {
  static char *bname = NULL;
  if (bname == NULL) {
    bname = (char *)malloc(MAXPATHLEN);
    if (bname == NULL)
      return (NULL);
  }
  return (basename_r(path, bname));
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,0x2f04(%rip)
jne    116f <basename+0x4f>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1040 <malloc@plt>
mov    %rax,0x2ee9(%rip)
cmpq   $0x0,0x2ee1(%rip)
jne    116a <basename+0x4a>
movq   $0x0,-0x8(%rbp)
jmp    1183 <basename+0x63>
jmp    116f <basename+0x4f>
mov    -0x10(%rbp),%rdi
mov    0x2ebe(%rip),%rsi
call   1030 <basename_r@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
push   %rbx
mov    %rdi,%rbx
mov    0x2f0d(%rip),%rsi
test   %rsi,%rsi
jne    114d <basename+0x2d>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <malloc@plt>
mov    %rax,%rsi
mov    %rax,0x2ef0(%rip)
test   %rax,%rax
je     1156 <basename+0x36>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <basename_r@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@basename.bname = internal global i8* null
@MAXPATHLEN = global i32 0
define i8* @basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** @basename.bname
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i32, i32* @MAXPATHLEN
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** @basename.bname
%10 = load i8*, i8** @basename.bname
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %6
store i8* null, i8** %2
br label %18
13: ; preds = %6
br label %14
14: ; preds = %13, %1
%15 = load i8*, i8** %3
%16 = load i8*, i8** @basename.bname
%17 = call i8* @basename_r(i8* %15, i8* %16)
store i8* %17, i8** %2
br label %18
18: ; preds = %14, %12
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@basename.bname = internal unnamed_addr global i8* null
@MAXPATHLEN = global i32 0
define i8* @basename(i8* %0) {
%2 = load i8*, i8** @basename.bname
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @MAXPATHLEN
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** @basename.bname
%8 = icmp eq i64 %6, 0
br i1 %8, label %12, label %9
9: ; preds = %4, %1
%10 = phi i8* [ %7, %4 ], [ %2, %1 ]
%11 = tail call i8* @basename_r(i8* %0, i8* %10)
br label %12
12: ; preds = %4, %9
%13 = phi i8* [ %11, %9 ], [ null, %4 ]
ret i8* %13
}
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  unsigned int index;
  if (s && f) {
    index = 0x00;
    while (*s)
      (void)f(index++, s++);
  }
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1164 <ft_striteri+0x64>
cmpq   $0x0,-0x10(%rbp)
je     1164 <ft_striteri+0x64>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115f <ft_striteri+0x5f>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    %edi,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    %rsi,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
call   *%rax
jmp    112d <ft_striteri+0x2d>
jmp    1164 <ft_striteri+0x64>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1135 <ft_striteri+0x35>
mov    %rsi,%r14
test   %rsi,%rsi
je     1135 <ft_striteri+0x35>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     1135 <ft_striteri+0x35>
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
mov    %ebx,%edi
call   *%r14
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <ft_striteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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

/* Variables and functions */
int block(struct cymkd_parser *);
int more_blocks(struct cymkd_parser *);
int /*<<< orphan*/ skip_empty_lines(struct cymkd_parser *);
bool document(struct cymkd_parser *parser) {
  bool success;
  skip_empty_lines(parser);
  success = block(parser);
  if (success) {
    success = more_blocks(parser);
  }
  return success;
}


x86 assembly (clang, -O0):
<document>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <skip_empty_lines@plt>
mov    -0x8(%rbp),%rdi
call   1030 <block@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1167 <document+0x37>
mov    -0x8(%rbp),%rdi
call   1050 <more_blocks@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<document>:
push   %rbx
mov    %rdi,%rbx
call   1040 <skip_empty_lines@plt>
mov    %rbx,%rdi
call   1030 <block@plt>
test   %eax,%eax
je     114e <document+0x1e>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <more_blocks@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.cymkd_parser = type { i32 }
define i32 @document(%struct.cymkd_parser* %0) {
%2 = alloca %struct.cymkd_parser*
%3 = alloca i32
store %struct.cymkd_parser* %0, %struct.cymkd_parser** %2
%4 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%5 = call i32 @skip_empty_lines(%struct.cymkd_parser* %4)
%6 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%7 = call i32 @block(%struct.cymkd_parser* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load %struct.cymkd_parser*, %struct.cymkd_parser** %2
%12 = call i32 @more_blocks(%struct.cymkd_parser* %11)
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
%struct.cymkd_parser = type { i32 }
define i32 @document(%struct.cymkd_parser* %0) {
%2 = tail call i32 @skip_empty_lines(%struct.cymkd_parser* %0)
%3 = tail call i32 @block(%struct.cymkd_parser* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @more_blocks(%struct.cymkd_parser* %0)
br label %7
7: ; preds = %5, %1
%8 = phi i32 [ %6, %5 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
void *ucc_brk(void *);
int brk(void *p) {
  void *ret;
  ret = ucc_brk(p);
  if (ret == p) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<brk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ucc_brk@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1143 <brk+0x33>
movl   $0x0,-0x4(%rbp)
jmp    114a <brk+0x3a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brk>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ucc_brk@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @brk(i8* %0) {
%2 = tail call i8* @ucc_brk(i8* %0)
%3 = icmp ne i8* %2, %0
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t add2(uint32_t a, uint32_t b) { return a + b; }


x86 assembly (clang, -O0):
<add2>:
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):
<add2>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @add2(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 @add2(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void const *, size_t);
char *mongo_data_append(char *start, const void *data, size_t len) {
  memcpy(start, data, len);
  return start + len;
}


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

x86 assembly (clang, -O2):
<mongo_data_append>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <memcpy@plt>
add    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @mongo_data_append(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcpy(i8* %7, i8* %8, i64 %9)
%11 = load i8*, i8** %4
%12 = load i64, i64* %6
%13 = getelementptr inbounds i8, i8* %11, i64 %12
ret i8* %13
}

LLVM IR (-O2):
define i8* @mongo_data_append(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
%5 = getelementptr inbounds i8, i8* %0, i64 %2
ret i8* %5
}
/* Variables and functions */
char getchar();
void flush_stdin(void) {
  while (getchar() != '\n')
    ;
}


x86 assembly (clang, -O0):
<flush_stdin>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <flush_stdin+0x9>
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1131 <flush_stdin+0x21>
jmp    1119 <flush_stdin+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_stdin>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <flush_stdin+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @flush_stdin() {
br label %1
1: ; preds = %5, %0
%2 = call signext i8 (...) @getchar()
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @flush_stdin() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
/* Variables and functions */
int _log2(unsigned int);
int _logk(unsigned int n, unsigned int k) { return _log2(n) / _log2(k); }


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

x86 assembly (clang, -O2):
<_logk>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <_log2@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <_log2@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_logk(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 @_log2(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @_log2(i32 %7)
%9 = sdiv i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @_logk(i32 %0, i32 %1) {
%3 = tail call i32 @_log2(i32 %0)
%4 = tail call i32 @_log2(i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ debugPrintf(int, char *, char *);
int main() {
  debugPrintf(1, "%s", "hello world!\n");
  debugPrintf(~1, "%s", "no printf!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xed5(%rip),%rsi
lea    0xed1(%rip),%rdx
call   1030 <debugPrintf@plt>
mov    $0xfffffffe,%edi
lea    0xebd(%rip),%rsi
lea    0xec7(%rip),%rdx
call   1030 <debugPrintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xee4(%rip),%rdx
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <debugPrintf@plt>
lea    0xede(%rip),%rdx
mov    $0xfffffffe,%edi
mov    %rbx,%rsi
call   1030 <debugPrintf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"hello world!\0A\00"
@.str.2 = [12 x i8] c"no printf!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @debugPrintf(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @debugPrintf(i32 -2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"hello world!\0A\00"
@.str.2 = [12 x i8] c"no printf!\0A\00"
define i32 @main() {
%1 = tail call i32 @debugPrintf(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @debugPrintf(i32 -2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
size_t get_shell_idx(char type) {
  switch (type) {
  case 'S':
    return 0;
  case 'L':
    return 1;
  case 'P':
    return 2;
  case 'D':
    return 3;
  case 'F':
    return 4;
  }
  abort();
}


x86 assembly (clang, -O0):
<get_shell_idx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xf,%eax
ja     1189 <get_shell_idx+0x79>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x0,-0x8(%rbp)
jmp    1190 <get_shell_idx+0x80>
movq   $0x1,-0x8(%rbp)
jmp    1190 <get_shell_idx+0x80>
movq   $0x2,-0x8(%rbp)
jmp    1190 <get_shell_idx+0x80>
movq   $0x3,-0x8(%rbp)
jmp    1190 <get_shell_idx+0x80>
movq   $0x4,-0x8(%rbp)
jmp    1190 <get_shell_idx+0x80>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_shell_idx>:
push   %rax
add    $0xffffffbc,%edi
cmp    $0xf,%edi
ja     1147 <get_shell_idx+0x37>
xor    %eax,%eax
lea    0xede(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x3,%eax
pop    %rcx
ret
mov    $0x4,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret
mov    $0x2,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i64 @get_shell_idx(i8 signext %0) {
%2 = alloca i64
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 83, label %6
i32 76, label %7
i32 80, label %8
i32 68, label %9
i32 70, label %10
]
6: ; preds = %1
store i64 0, i64* %2
br label %13
7: ; preds = %1
store i64 1, i64* %2
br label %13
8: ; preds = %1
store i64 2, i64* %2
br label %13
9: ; preds = %1
store i64 3, i64* %2
br label %13
10: ; preds = %1
store i64 4, i64* %2
br label %13
11: ; preds = %1
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %10, %9, %8, %7, %6
%14 = load i64, i64* %2
ret i64 %14
}

LLVM IR (-O2):
define i64 @get_shell_idx(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %7 [
i32 83, label %9
i32 76, label %3
i32 80, label %4
i32 68, label %5
i32 70, label %6
]
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %1, %6, %5, %4, %3
%10 = phi i64 [ 4, %6 ], [ 3, %5 ], [ 2, %4 ], [ 1, %3 ], [ 0, %1 ]
ret i64 %10
}
/* Variables and functions */
char *calloc(int, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ write(int, char *, int);
void *mine_write(void *fd_1) {
  int fd = *((int *)fd_1);
  char *input;
  input = calloc(1024, sizeof(char));
  while (1) {
    fgets(input, 1024 * sizeof(char), stdin);
    write(fd, input, (1024) * sizeof(char));
  }
}


x86 assembly (clang, -O0):
<mine_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x400,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x400,%edx
call   1030 <write@plt>
jmp    1158 <mine_write+0x28>

x86 assembly (clang, -O2):
<mine_write>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%ebp
mov    $0x400,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    0x2e99(%rip),%r14
nop
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1030 <write@plt>
jmp    1150 <mine_write+0x20>

LLVM IR (-O0):
@stdin = global i32 0
define i8* @mine_write(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
store i32 %7, i32* %3
%8 = call i8* @calloc(i32 1024, i32 1)
store i8* %8, i8** %4
br label %9
9: ; preds = %1, %9
%10 = load i8*, i8** %4
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 1024, i32 %11)
%13 = load i32, i32* %3
%14 = load i8*, i8** %4
%15 = call i32 @write(i32 %13, i8* %14, i32 1024)
br label %9
}

LLVM IR (-O2):
@stdin = global i32 0
define noalias i8* @mine_write(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call dereferenceable_or_null(1024) i8* @calloc(i32 1024, i32 1)
br label %5
5: ; preds = %5, %1
%6 = load i32, i32* @stdin
%7 = tail call i32 @fgets(i8* %4, i32 1024, i32 %6)
%8 = tail call i32 @write(i32 %3, i8* %4, i32 1024)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void say_hi(void) { printf("A: hi\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"A: hi\00"
define void @say_hi() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int *malloc(int);
void foo(void) {
  int *a = malloc(10 * sizeof(int));
  a[10] = 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x28(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x28,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 40)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = getelementptr inbounds i32, i32* %3, i64 10
store i32 0, i32* %4
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32* @malloc(i32 40)
ret void
}
int mik_isspace(int c) {
  switch (c) {
  case ' ':
  case '\t':
  case '\n':
  case '\r':
  case '\f':
  case '\v':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<mik_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x5,%eax
jb     112f <mik_isspace+0x2f>
jmp    111e <mik_isspace+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    113b <mik_isspace+0x3b>
jmp    112f <mik_isspace+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1142 <mik_isspace+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mik_isspace>:
mov    $0x1,%eax
lea    -0x9(%rdi),%ecx
cmp    $0x5,%ecx
jae    110e <mik_isspace+0xe>
ret
cmp    $0x20,%edi
je     110d <mik_isspace+0xd>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @mik_isspace(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %3
i32 9, label %3
i32 10, label %3
i32 13, label %3
i32 12, label %3
i32 11, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
size_t fsize_orDie(char const *);
int /*<<< orphan*/ loadFile_orDie(char const *, void *const, size_t);
void *malloc_orDie(size_t);
void *mallocAndLoadFile_orDie(const char *fileName, size_t *bufferSize) {
  size_t const fileSize = fsize_orDie(fileName);
  *bufferSize = fileSize;
  void *const buffer = malloc_orDie(*bufferSize);
  loadFile_orDie(fileName, buffer, *bufferSize);
  return buffer;
}


x86 assembly (clang, -O0):
<mallocAndLoadFile_orDie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fsize_orDie@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <malloc_orDie@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
call   1040 <loadFile_orDie@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mallocAndLoadFile_orDie>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1050 <fsize_orDie@plt>
mov    %rax,(%r15)
mov    %rax,%rdi
call   1030 <malloc_orDie@plt>
mov    %rax,%rbx
mov    (%r15),%rdx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <loadFile_orDie@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @mallocAndLoadFile_orDie(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i64* %1, i64** %4
%7 = load i8*, i8** %3
%8 = call i64 @fsize_orDie(i8* %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i64*, i64** %4
store i64 %9, i64* %10
%11 = load i64*, i64** %4
%12 = load i64, i64* %11
%13 = call i8* @malloc_orDie(i64 %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %3
%15 = load i8*, i8** %6
%16 = load i64*, i64** %4
%17 = load i64, i64* %16
%18 = call i32 @loadFile_orDie(i8* %14, i8* %15, i64 %17)
%19 = load i8*, i8** %6
ret i8* %19
}

LLVM IR (-O2):
define i8* @mallocAndLoadFile_orDie(i8* %0, i64* nocapture %1) {
%3 = tail call i64 @fsize_orDie(i8* %0)
store i64 %3, i64* %1
%4 = tail call i8* @malloc_orDie(i64 %3)
%5 = load i64, i64* %1
%6 = tail call i32 @loadFile_orDie(i8* %0, i8* %4, i64 %5)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("3."
         "141592653589793238462643383279502884197169399375105820974944592307816"
         "406286208998628034825342117067982148086513282306647093844609550582231"
         "725359408128481117450284102701938521105559644622948954930381964428810"
         "975665933446128475648233786783165271201909145648566923460348610454326"
         "648213393607260249141273724587006606315588174881520920962829254091715"
         "364367892590360011330530548820466521384146951941511609");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [402 x i8] c"3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([402 x i8], [402 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int main() {
  int i = 0;
  while (i < 100) {
    i = i + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    112a <main+0x2a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ request_code;
};
struct TYPE_4__ {
  TYPE_1__ xerror;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
unsigned char get_XEvent_xerror_request_code(void *_p) {
  return (unsigned char)((XEvent *)_p)->xerror.request_code;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xerror_request_code>:
mov    (%rdi),%al
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define zeroext i8 @get_XEvent_xerror_request_code(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define zeroext i8 @get_XEvent_xerror_request_code(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i8
ret i8 %4
}
void glue_2() {}


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

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

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

LLVM IR (-O2):
define void @glue_2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int var1;
  int var1_2;
  int var = 30;
  var1 = 10;
  var1_2 = 20;
  printf("var1 = %d, var1_2 = %d, var = %d\n", var1, var1_2, var);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0x10(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
mov    $0x1e,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"var1 = %d, var1_2 = %d, var = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 30, i32* %4
store i32 10, i32* %2
store i32 20, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"var1 = %d, var1_2 = %d, var = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, i32 30)
ret i32 0
}