xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ isspace(char);
int is_blankline(char *buffer) {
  for (; *buffer != '\0'; buffer++)
    if (!isspace(*buffer))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_blankline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1163 <is_blankline+0x53>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    114d <is_blankline+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_blankline+0x5a>
jmp    1152 <is_blankline+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <is_blankline+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_blankline>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <is_blankline+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     1149 <is_blankline+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <is_blankline+0x20>
jmp    114b <is_blankline+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_blankline(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isspace(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
int tpl_cpu_bigendian() {
  unsigned i = 1;
  char *c;
  c = (char *)&i;
  return (c[0] == 1 ? 0 : 1);
}


x86 assembly (clang, -O0):
<tpl_cpu_bigendian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @tpl_cpu_bigendian() {
%1 = alloca i32
%2 = alloca i8*
store i32 1, i32* %1
%3 = bitcast i32* %1 to i8*
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @tpl_cpu_bigendian() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int main() {
  char *foo = NULL;
  assert(foo != NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = load i8*, i8** %1
%3 = icmp ne i8* %2, null
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ SmcConn;
typedef int /*<<< orphan*/ SmPointer;

/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SmcCloseConnection(int /*<<< orphan*/, int /*<<< orphan*/,
                                      int /*<<< orphan*/ *);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
void session_died(SmcConn conn, SmPointer client_data) {
  SmcCloseConnection(conn, 0, NULL);
  kill(getpid(), SIGTERM);
}


x86 assembly (clang, -O0):
<session_died>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <SmcCloseConnection@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<session_died>:
push   %rax
xor    %esi,%esi
xor    %edx,%edx
call   1040 <SmcCloseConnection@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2ea0(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
pop    %rax
jmp    1050 <kill@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
define void @session_died(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 @SmcCloseConnection(i32 %5, i32 0, i32* null)
%7 = call i32 (...) @getpid()
%8 = load i32, i32* @SIGTERM
%9 = call i32 @kill(i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define void @session_died(i32 %0, i32 %1) {
%3 = tail call i32 @SmcCloseConnection(i32 %0, i32 0, i32* null)
%4 = tail call i32 (...) @getpid()
%5 = load i32, i32* @SIGTERM
%6 = tail call i32 @kill(i32 %4, i32 %5)
ret void
}
void UART0_ER_intr(void) {}


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

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

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

LLVM IR (-O2):
define void @UART0_ER_intr() {
ret void
}
/* Variables and functions */
scalar_t__ handle_open_failure();
int open(char const *, int);
int my_open(const char *path, int flags) {
  int fd;
  do {
    fd = open(path, flags);
  } while (fd < 0 && handle_open_failure());
  return fd;
}


x86 assembly (clang, -O0):
<my_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <open@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jge    115e <my_open+0x3e>
mov    $0x0,%al
call   1030 <handle_open_failure@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    112f <my_open+0xf>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_open>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    114d <my_open+0x2d>
xor    %eax,%eax
call   1030 <handle_open_failure@plt>
test   %rax,%rax
jne    1130 <my_open+0x10>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @my_open(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %6
6: ; preds = %16, %2
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @open(i8* %7, i32 %8)
store i32 %9, i32* %5
br label %10
10: ; preds = %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i64 (...) @handle_open_failure()
%15 = icmp ne i64 %14, 0
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ false, %10 ], [ %15, %13 ]
br i1 %17, label %6, label %18
18: ; preds = %16
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @my_open(i8* nocapture %0, i32 %1) {
br label %3
3: ; preds = %6, %2
%4 = tail call i32 @open(i8* %0, i32 %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i64 (...) @handle_open_failure()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %3
9: ; preds = %3, %6
ret i32 %4
}
/* Variables and functions */
int partition(int *, int, int);
void quick_sort(int *A, int i, int j) {
  int p;
  if (i < j) {
    p = partition(A, i, j);
    quick_sort(A, i, p - 1);
    quick_sort(A, p + 1, j);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
char *cstr(a, b)
char *const a;
const char *const b;
{ return 0; }


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

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

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

LLVM IR (-O2):
define noalias i8* @cstr(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ unreg(void *, char const *, int);
void ml_free(void *ptr, const char *file, int line) {
  unreg(ptr, file, line);
  free(ptr);
}


x86 assembly (clang, -O0):
<ml_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <unreg@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ml_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <unreg@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @ml_free(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @unreg(i8* %7, i8* %8, i32 %9)
%11 = load i8*, i8** %4
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @ml_free(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @unreg(i8* %0, i8* %1, i32 %2)
%5 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ strlen(char *);
void cmdline_parser_print_version(void) {
  printf("%s %s\n", (strlen("cdnf") ? "cdnf" : "cdnf"), "4.02");
}


x86 assembly (clang, -O0):
<cmdline_parser_print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xedc(%rip),%rdi
call   1030 <strlen@plt>
lea    0xed0(%rip),%rsi
cmp    $0x0,%rax
cmovne %rsi,%rsi
lea    0xeba(%rip),%rdi
lea    0xebf(%rip),%rdx
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_parser_print_version>:
lea    0xee9(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xee7(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [5 x i8] c"cdnf\00"
@.str.2 = [5 x i8] c"4.02\00"
define void @cmdline_parser_print_version() {
%1 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s %s\0A\00"
@.str.1 = [5 x i8] c"cdnf\00"
@.str.2 = [5 x i8] c"4.02\00"
define void @cmdline_parser_print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void SAK(void) {}


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

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

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

LLVM IR (-O2):
define void @SAK() {
ret void
}
int do_533() { return 533; }


x86 assembly (clang, -O0):
<do_533>:
push   %rbp
mov    %rsp,%rbp
mov    $0x215,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_533() {
ret i32 533
}

LLVM IR (-O2):
define i32 @do_533() {
ret i32 533
}
unsigned short swap(unsigned short s) {
  return ((s & 0xff00) >> 8) | ((s & 0xff) << 8);
}


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

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

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

LLVM IR (-O2):
define zeroext i16 @swap(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
int test_imm_27int64_midword_reg(long long val) {
  return ((val >> 16) & (0x27 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_27int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0x27,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_27int64_midword_reg>:
test   $0x270000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_27int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 39
%6 = icmp ne i64 %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_27int64_midword_reg(i64 %0) {
%2 = and i64 %0, 2555904
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  int i = 0;
  while (i++ < 5) {
    printf("Hey world\n");
  }
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x5,%eax
jge    115b <main+0x3b>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Hey world\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = icmp slt i32 %4, 5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %3
9: ; preds = %3
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@str = [10 x i8] c"Hey world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int getline(char **, size_t *, int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strncpy(char *, char *, int);
char *readInfixExpression() {
  char *buff = NULL;
  ssize_t len;
  size_t buffLen = 0;
  len = getline(&buff, &buffLen, stdin);
  char *line = malloc(len);
  strncpy(line, buff, len);
  line[len - 1] = '\0';
  return line;
}


x86 assembly (clang, -O0):
<readInfixExpression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInfixExpression>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <getline@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
define i8* @readInfixExpression() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i64
%4 = alloca i8*
store i8* null, i8** %1
store i64 0, i64* %3
%5 = load i32, i32* @stdin
%6 = call i32 @getline(i8** %1, i64* %3, i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = load i8*, i8** %1
%11 = load i32, i32* %2
%12 = call i32 @strncpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %4
%14 = load i32, i32* %2
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
@stdin = global i32 0
define i8* @readInfixExpression() {
%1 = alloca i8*
%2 = alloca i64
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = load i32, i32* @stdin
%6 = call i32 @getline(i8** %1, i64* %2, i32 %5)
%7 = call i8* @malloc(i32 %6)
%8 = load i8*, i8** %1
%9 = call i32 @strncpy(i8* %7, i8* %8, i32 %6)
%10 = add nsw i32 %6, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
store i8 0, i8* %12
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ Sys_failure(char *);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int truncate(char const *, int /*<<< orphan*/);
void Truncate(const char *path, off_t length) {
  int retval;
  assert(path != NULL);
  retval = truncate(path, length);
  if (retval == -1)
    Sys_failure("truncate");
}


x86 assembly (clang, -O0):
<Truncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <truncate@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1176 <Truncate+0x46>
lea    0xe8f(%rip),%rdi
call   1050 <Sys_failure@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Truncate>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <truncate@plt>
cmp    $0xffffffff,%eax
je     115c <Truncate+0x2c>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe9d(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <Sys_failure@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"truncate\00"
define void @Truncate(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @truncate(i8* %10, i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @Sys_failure(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"truncate\00"
define void @Truncate(i8* %0, i32 %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @truncate(i8* %0, i32 %1)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @Sys_failure(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
ret void
}
/* Variables and functions */
int v5dClose();
int v5dclose_() { return v5dClose(); }


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

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

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

LLVM IR (-O2):
define i32 @v5dclose_() {
%1 = tail call i32 (...) @v5dClose()
ret i32 %1
}
/* Variables and functions */
scalar_t__ read(int /*<<< orphan*/, char *, int);
int gl_getc() {
  int c;
  char ch;
  c = (read(0, &ch, 1) > 0) ? ch : -1;
  return c;
}


x86 assembly (clang, -O0):
<gl_getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x0,%rax
jle    113e <gl_getc+0x2e>
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    114b <gl_getc+0x3b>
mov    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114b <gl_getc+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_getc>:
push   %rax
lea    0x7(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
test   %rax,%rax
movsbl 0x7(%rsp),%ecx
mov    $0xffffffff,%eax
cmovg  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gl_getc() {
%1 = alloca i32
%2 = alloca i8
%3 = call i64 @read(i32 0, i8* %2, i32 1)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
br label %9
8: ; preds = %0
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ -1, %8 ]
store i32 %10, i32* %1
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @gl_getc() {
%1 = alloca i8
%2 = call i64 @read(i32 0, i8* %1, i32 1)
%3 = icmp sgt i64 %2, 0
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = select i1 %3, i32 %5, i32 -1
ret i32 %6
}
void INT_Excep_SCI12_SCIX2(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI12_SCIX2() {
ret void
}
short encodePosition(int x, int y) { return x << 8 | y; }


x86 assembly (clang, -O0):
<encodePosition>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
or     -0x8(%rbp),%eax
cwtl
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @encodePosition(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 = shl i32 %5, 8
%7 = load i32, i32* %4
%8 = or i32 %6, %7
%9 = trunc i32 %8 to i16
ret i16 %9
}

LLVM IR (-O2):
define signext i16 @encodePosition(i32 %0, i32 %1) {
%3 = shl i32 %0, 8
%4 = or i32 %3, %1
%5 = trunc i32 %4 to i16
ret i16 %5
}
void die(int sig) {
  error("die", "MegaHAL received signal %d", sig);
  exithal();
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xecb(%rip),%rdi
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1040 <error@plt>
mov    $0x0,%al
call   1030 <exithal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %edi,%edx
lea    0xed6(%rip),%rdi
lea    0xed3(%rip),%rsi
xor    %eax,%eax
call   1040 <error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <exithal@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"die\00"
@.str.1 = [27 x i8] c"MegaHAL received signal %d\00"
define void @die(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @exithal()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"die\00"
@.str.1 = [27 x i8] c"MegaHAL received signal %d\00"
define void @die(i32 %0) {
%2 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @exithal()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_intvector(int *v, int nl, int nh) { free((char *)(v + nl)); }


x86 assembly (clang, -O0):
<free_intvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_intvector>:
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_intvector(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = bitcast i32* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
int gintor(int x, int y) {
  x |= y;
  if (!x)
    foo((void *)0);
  return x;
}


x86 assembly (clang, -O0):
<gintor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <gintor+0x2a>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gintor>:
push   %rbx
mov    %edi,%ebx
or     %esi,%ebx
jne    111e <gintor+0xe>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @gintor(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @foo(i8* null)
br label %7
7: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void DMA1_Stream0_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @DMA1_Stream0_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @DMA1_Stream0_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
int VideoRamVector(int x, int y) { return y * 1024 + x; }


x86 assembly (clang, -O0):
<VideoRamVector>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0xa,%eax
add    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<VideoRamVector>:
shl    $0xa,%esi
lea    (%rsi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @VideoRamVector(i32 %0, i32 %1) {
%3 = shl nsw i32 %1, 10
%4 = add nsw i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ *strchr(char const *, char);
int is_glob(const char *fn) {
  return (strchr(fn, '*') != NULL || strchr(fn, '?') != NULL ||
          strchr(fn, '[') != NULL);
}


x86 assembly (clang, -O0):
<is_glob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2a,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    1174 <is_glob+0x64>
mov    -0x8(%rbp),%rdi
mov    $0x3f,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    1174 <is_glob+0x64>
mov    -0x8(%rbp),%rdi
mov    $0x5b,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_glob>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2a,%esi
call   1030 <strchr@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1152 <is_glob+0x42>
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1152 <is_glob+0x42>
mov    %rbx,%rdi
mov    $0x5b,%esi
call   1030 <strchr@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_glob(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @strchr(i8* %3, i8 signext 42)
%5 = icmp ne i32* %4, null
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32* @strchr(i8* %7, i8 signext 63)
%9 = icmp ne i32* %8, null
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i32* @strchr(i8* %11, i8 signext 91)
%13 = icmp ne i32* %12, null
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_glob(i8* %0) {
%2 = tail call i32* @strchr(i8* %0, i8 signext 42)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i32* @strchr(i8* %0, i8 signext 63)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i32* @strchr(i8* %0, i8 signext 91)
%9 = icmp ne i32* %8, null
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %4 ], [ 1, %1 ], [ %10, %7 ]
ret i32 %12
}
int main(int n) {
  int i, j, k, l, m;
  i = 0;
  j = 100;
  k = 1000;
  l = 10000;
  m = 100000;
  while (i < 1000)
    i = i + 1;
  while (j < 1000)
    j = j + k;
  while (k > 100)
    k = k - j;
  while (l > 1000)
    l = l + k;
  while (m > 1)
    m = m - l;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x64,-0x10(%rbp)
movl   $0x3e8,-0x14(%rbp)
movl   $0x2710,-0x18(%rbp)
movl   $0x186a0,-0x1c(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    114c <main+0x4c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <main+0x31>
jmp    1151 <main+0x51>
cmpl   $0x3e8,-0x10(%rbp)
jge    116c <main+0x6c>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1151 <main+0x51>
jmp    1171 <main+0x71>
cmpl   $0x64,-0x14(%rbp)
jle    1189 <main+0x89>
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x71>
jmp    118e <main+0x8e>
cmpl   $0x3e8,-0x18(%rbp)
jle    11a9 <main+0xa9>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    118e <main+0x8e>
jmp    11ae <main+0xae>
cmpl   $0x1,-0x1c(%rbp)
jle    11c6 <main+0xc6>
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11ae <main+0xae>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %2
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 100, i32* %5
store i32 1000, i32* %6
store i32 10000, i32* %7
store i32 100000, i32* %8
br label %9
9: ; preds = %12, %1
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %9
15: ; preds = %9
br label %16
16: ; preds = %19, %15
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 1000
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = add nsw i32 %20, %21
store i32 %22, i32* %5
br label %16
23: ; preds = %16
br label %24
24: ; preds = %27, %23
%25 = load i32, i32* %6
%26 = icmp sgt i32 %25, 100
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = sub nsw i32 %28, %29
store i32 %30, i32* %6
br label %24
31: ; preds = %24
br label %32
32: ; preds = %35, %31
%33 = load i32, i32* %7
%34 = icmp sgt i32 %33, 1000
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = add nsw i32 %36, %37
store i32 %38, i32* %7
br label %32
39: ; preds = %32
br label %40
40: ; preds = %43, %39
%41 = load i32, i32* %8
%42 = icmp sgt i32 %41, 1
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i32, i32* %8
%45 = load i32, i32* %7
%46 = sub nsw i32 %44, %45
store i32 %46, i32* %8
br label %40
47: ; preds = %40
%48 = load i32, i32* %2
ret i32 %48
}

LLVM IR (-O2):
define i32 @main(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main() {
  char *lista[5] = {"coffe",
                    "tea"
                    "soda"
                    "water",
                    "juice"};
  printf("%zd", strlen(lista[0]));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
lea    0xeb1(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xeac(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeae(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"coffe\00"
@.str.1 = [13 x i8] c"teasodawater\00"
@.str.2 = [6 x i8] c"juice\00"
@.str.3 = [4 x i8] c"%zd\00"
define i32 @main() {
%1 = alloca [5 x i8*]
%2 = bitcast [5 x i8*]* %1 to i8*
%3 = bitcast i8* %2 to [5 x i8*]*
%4 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8** %4
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i32 0, i32 1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i32 0, i32 2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"coffe\00"
@.str.3 = [4 x i8] c"%zd\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
struct t_gui_window {
  int dummy;
};

/* Variables and functions */
const char *gui_window_get_string(struct t_gui_window *window,
                                  const char *property) {
  if (window && property) {
  }
  return NULL;
}


x86 assembly (clang, -O0):
<gui_window_get_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1127 <gui_window_get_string+0x27>
cmpq   $0x0,-0x10(%rbp)
je     1127 <gui_window_get_string+0x27>
jmp    1127 <gui_window_get_string+0x27>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.t_gui_window = type { i32 }
define i8* @gui_window_get_string(%struct.t_gui_window* %0, i8* %1) {
%3 = alloca %struct.t_gui_window*
%4 = alloca i8*
store %struct.t_gui_window* %0, %struct.t_gui_window** %3
store i8* %1, i8** %4
%5 = load %struct.t_gui_window*, %struct.t_gui_window** %3
%6 = icmp ne %struct.t_gui_window* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %7
br label %11
11: ; preds = %10, %7, %2
ret i8* null
}

LLVM IR (-O2):
%struct.t_gui_window = type { i32 }
define noalias i8* @gui_window_get_string(%struct.t_gui_window* nocapture readnone %0, i8* nocapture readnone %1) {
ret i8* null
}
struct servent *getservbyport(int port, const char *proto) {
  anvil_syslog(0, "%s unimplemented\n", __FUNCTION__);
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<getservbyport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
lea    0xed8(%rip),%rsi
lea    0xee3(%rip),%rdx
mov    $0x0,%al
call   1030 <anvil_syslog@plt>
jmp    1136 <getservbyport+0x26>

x86 assembly (clang, -O2):
<getservbyport>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xef3(%rip),%rdx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <anvil_syslog@plt>
nopl   0x0(%rax,%rax,1)
jmp    1130 <getservbyport+0x20>

LLVM IR (-O0):
%struct.servent = type opaque
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.getservbyport = [14 x i8] c"getservbyport\00"
define %struct.servent* @getservbyport(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.getservbyport, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
br label %6
}

LLVM IR (-O2):
%struct.servent = type opaque
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.getservbyport = [14 x i8] c"getservbyport\00"
define %struct.servent* @getservbyport(i32 %0, i8* nocapture readnone %1) {
%3 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.getservbyport, i64 0, i64 0))
br label %4
4: ; preds = %2, %4
br label %4
}
void gtk_about_dialog_get_comments() {}


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

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

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

LLVM IR (-O2):
define void @gtk_about_dialog_get_comments() {
ret void
}
/* Variables and functions */
int EINVAL;
int blockdev_invalidate_cache(int fd) { return EINVAL; }


x86 assembly (clang, -O0):
<blockdev_invalidate_cache>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockdev_invalidate_cache>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @blockdev_invalidate_cache(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @EINVAL
ret i32 %3
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @blockdev_invalidate_cache(i32 %0) {
%2 = load i32, i32* @EINVAL
ret i32 %2
}
int fun4(int i) {
  printf("in file [%s] func [%s] : %d\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/blackerliu/c.lang.kata/refs/heads/master/"
         "liborder/fun2.c",
         __FUNCTION__, i);
  return 0;
}


x86 assembly (clang, -O0):
<fun4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
lea    0xedb(%rip),%rdi
lea    0xef1(%rip),%rsi
lea    0xf7d(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun4>:
push   %rax
mov    %edi,%ecx
lea    0xee6(%rip),%rdi
lea    0xefc(%rip),%rsi
lea    0xf88(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"in file [%s] func [%s] : %d\0A\00"
@.str.1 = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/blackerliu/c.lang.kata/refs/heads/master/liborder/fun2.c\00"
@__FUNCTION__.fun4 = [5 x i8] c"fun4\00"
define i32 @fun4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.fun4, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"in file [%s] func [%s] : %d\0A\00"
@.str.1 = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/blackerliu/c.lang.kata/refs/heads/master/liborder/fun2.c\00"
@__FUNCTION__.fun4 = [5 x i8] c"fun4\00"
define i32 @fun4(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.fun4, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fopen(char *, char *);
void test_file_open_success() {
  assert(fopen("/Users/fabianterhorst/bla.txt", "r"));
}


x86 assembly (clang, -O0):
<test_file_open_success>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xeec(%rip),%rsi
call   1040 <fopen@plt>
mov    %eax,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_file_open_success>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeef(%rip),%rsi
call   1040 <fopen@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"/Users/fabianterhorst/bla.txt\00"
@.str.1 = [2 x i8] c"r\00"
define void @test_file_open_success() {
%1 = call i32 @fopen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @assert(i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"/Users/fabianterhorst/bla.txt\00"
@.str.1 = [2 x i8] c"r\00"
define void @test_file_open_success() {
%1 = tail call i32 @fopen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @assert(i32 %1)
ret void
}
int msm_chg_rpc_connect(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @msm_chg_rpc_connect() {
ret i32 0
}