xunge/DecIR huggingface dataset:
/* Type definitions */
struct winsize {
  scalar_t__ ws_col;
};

/* Variables and functions */
int /*<<< orphan*/ TIOCGWINSZ;
int ioctl(int, int /*<<< orphan*/, struct winsize *);
int getColumns(void) {
  struct winsize ws;
  if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0)
    return 80;
  return ws.ws_col;
}


x86 assembly (clang, -O0):
<getColumns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1143 <getColumns+0x33>
cmpq   $0x0,-0x10(%rbp)
jne    114f <getColumns+0x3f>
movl   $0x50,-0x4(%rbp)
jmp    1156 <getColumns+0x46>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getColumns>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    $0x1,%edi
call   1030 <ioctl@plt>
mov    (%rsp),%rcx
test   %rcx,%rcx
mov    $0x50,%edx
cmove  %edx,%ecx
cmp    $0xffffffff,%eax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.winsize = type { i64 }
@TIOCGWINSZ = global i32 0
define i32 @getColumns() {
%1 = alloca i32
%2 = alloca %struct.winsize
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i32 @ioctl(i32 1, i32 %3, %struct.winsize* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = getelementptr inbounds %struct.winsize, %struct.winsize* %2, i32 0, i32 0
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6, %0
store i32 80, i32* %1
br label %15
11: ; preds = %6
%12 = getelementptr inbounds %struct.winsize, %struct.winsize* %2, i32 0, i32 0
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
store i32 %14, i32* %1
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
%struct.winsize = type { i64 }
@TIOCGWINSZ = global i32 0
define i32 @getColumns() {
%1 = alloca %struct.winsize
%2 = bitcast %struct.winsize* %1 to i8*
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i32 @ioctl(i32 1, i32 %3, %struct.winsize* %1)
%5 = icmp eq i32 %4, -1
%6 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
%9 = select i1 %5, i1 true, i1 %8
%10 = trunc i64 %7 to i32
%11 = select i1 %9, i32 80, i32 %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ outportb(unsigned short, int);
void io_serial_configure_line(unsigned short com) { outportb((com + 3), 0x03); }


x86 assembly (clang, -O0):
<io_serial_configure_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x3,%eax
mov    $0x3,%esi
movzwl %ax,%edi
call   1030 <outportb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_serial_configure_line>:
add    $0x3,%edi
movzwl %di,%edi
mov    $0x3,%esi
jmp    1030 <outportb@plt>

LLVM IR (-O0):
define void @io_serial_configure_line(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = add nsw i32 %4, 3
%6 = trunc i32 %5 to i16
%7 = call i32 @outportb(i16 zeroext %6, i32 3)
ret void
}

LLVM IR (-O2):
define void @io_serial_configure_line(i16 zeroext %0) {
%2 = add i16 %0, 3
%3 = tail call i32 @outportb(i16 zeroext %2, i32 3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void fix_endian32(void *vptr, uint8_t swab) {
  uint8_t *ptr = (uint8_t *)vptr;
  uint8_t tmp;
  if (!swab) {
    return;
  }
  tmp = *ptr;
  *ptr = *(ptr + 3);
  *(ptr + 3) = tmp;
  tmp = *(ptr + 1);
  *(ptr + 1) = *(ptr + 2);
  *(ptr + 2) = tmp;
}


x86 assembly (clang, -O0):
<fix_endian32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1122 <fix_endian32+0x22>
jmp    1164 <fix_endian32+0x64>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_endian32>:
test   %esi,%esi
je     1111 <fix_endian32+0x11>
movdqu (%rdi),%xmm0
pshufd $0x1b,%xmm0,%xmm0
movdqu %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @fix_endian32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %2
br label %33
12: ; preds = %2
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
store i32 %14, i32* %6
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 3
%17 = load i32, i32* %16
%18 = load i32*, i32** %5
store i32 %17, i32* %18
%19 = load i32, i32* %6
%20 = load i32*, i32** %5
%21 = getelementptr inbounds i32, i32* %20, i64 3
store i32 %19, i32* %21
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
store i32 %24, i32* %6
%25 = load i32*, i32** %5
%26 = getelementptr inbounds i32, i32* %25, i64 2
%27 = load i32, i32* %26
%28 = load i32*, i32** %5
%29 = getelementptr inbounds i32, i32* %28, i64 1
store i32 %27, i32* %29
%30 = load i32, i32* %6
%31 = load i32*, i32** %5
%32 = getelementptr inbounds i32, i32* %31, i64 2
store i32 %30, i32* %32
br label %33
33: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @fix_endian32(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = bitcast i8* %0 to <4 x i32>*
%6 = load <4 x i32>, <4 x i32>* %5
%7 = shufflevector <4 x i32> %6, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%8 = bitcast i8* %0 to <4 x i32>*
store <4 x i32> %7, <4 x i32>* %8
br label %9
9: ; preds = %2, %4
ret void
}
/* Variables and functions */
scalar_t__ calloc(size_t, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *getbytes(size_t nbytes) {
  void *ret;
  if (nbytes < 1)
    nbytes = 1;
  ret = (void *)calloc(nbytes, 1);
  if (!ret)
    fprintf(stderr, "ERROR: getbytes() failed -- out of memory");
  return (ret);
}


x86 assembly (clang, -O0):
<getbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x1,-0x8(%rbp)
jae    113f <getbytes+0x1f>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <getbytes+0x51>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getbytes>:
push   %rbx
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %rax,%rdi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1154 <getbytes+0x34>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: getbytes() failed -- out of memory\00"
define i8* @getbytes(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ult i64 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 1, i64* %2
br label %7
7: ; preds = %6, %1
%8 = load i64, i64* %2
%9 = call i64 @calloc(i64 %8, i32 1)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %7
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: getbytes() failed -- out of memory\00"
define i8* @getbytes(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i64 1, i64 %0
%4 = tail call i64 @calloc(i64 %3, i32 1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %1
%10 = inttoptr i64 %4 to i8*
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printxy(int /*<<< orphan*/, int, char *);
void Main(void) {
  printxy(0, 3, "[!] Preparing 64 bits Kernel ...");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x3,%esi
lea    0xede(%rip),%rdx
call   1030 <printxy@plt>
jmp    1127 <Main+0x17>

x86 assembly (clang, -O2):
<Main>:
push   %rax
lea    0xee8(%rip),%rdx
xor    %edi,%edi
mov    $0x3,%esi
call   1030 <printxy@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
jmp    1130 <Main+0x20>

LLVM IR (-O0):
@.str = [33 x i8] c"[!] Preparing 64 bits Kernel ...\00"
define void @Main() {
%1 = call i32 @printxy(i32 0, i32 3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@.str = [33 x i8] c"[!] Preparing 64 bits Kernel ...\00"
define void @Main() {
%1 = tail call i32 @printxy(i32 0, i32 3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ unlink(char const *);
void remove_pidfile(const char *pid_file) {
  if (pid_file == NULL)
    return;
  if (unlink(pid_file) != 0) {
    fprintf(stderr, "Could not remove the pid file %s.\n", pid_file);
  }
}


x86 assembly (clang, -O0):
<remove_pidfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <remove_pidfile+0x1c>
jmp    1168 <remove_pidfile+0x48>
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%rax
je     1168 <remove_pidfile+0x48>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_pidfile>:
push   %rbx
test   %rdi,%rdi
je     114c <remove_pidfile+0x2c>
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %rax,%rax
je     114c <remove_pidfile+0x2c>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
mov    %rbx,%rdx
pop    %rbx
jmp    1040 <fprintf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Could not remove the pid file %s.\0A\00"
define void @remove_pidfile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i64 @unlink(i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %2
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %5, %10, %6
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Could not remove the pid file %s.\0A\00"
define void @remove_pidfile(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i64 @unlink(i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %1, %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ J1939SocketClose(int);
int J1939SocketOpen(char *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int s = J1939SocketOpen("vcan0", 1785 * 10, 1785 * 10);
  printf("write ret: %i\n", s);
  J1939SocketClose(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x45ba,%edx
mov    %edx,%esi
call   1030 <J1939SocketOpen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <J1939SocketClose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x45ba,%esi
mov    $0x45ba,%edx
call   1030 <J1939SocketOpen@plt>
mov    %eax,%ebx
lea    0xeb6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1050 <J1939SocketClose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"vcan0\00"
@.str.1 = [15 x i8] c"write ret: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @J1939SocketOpen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 17850, i32 17850)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @J1939SocketClose(i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"vcan0\00"
@.str.1 = [15 x i8] c"write ret: %i\0A\00"
define i32 @main() {
%1 = tail call i32 @J1939SocketOpen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 17850, i32 17850)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = tail call i32 @J1939SocketClose(i32 %1)
ret i32 0
}
void gtk_text_buffer_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_buffer_get_type() {
ret void
}
const char *crypto_get_library_version_string(void) {}


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

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

LLVM IR (-O0):
define i8* @crypto_get_library_version_string() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define noalias i8* @crypto_get_library_version_string() {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  double deg, rad;
  char name[20];
  printf("Podaj imię: ");
  scanf("%19s", name);
  printf("Twoje imie to: %19s\n", name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Podaj imi\C4\99: \00"
@.str.1 = [5 x i8] c"%19s\00"
@.str.2 = [21 x i8] c"Twoje imie to: %19s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca [20 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Podaj imi\C4\99: \00"
@.str.1 = [5 x i8] c"%19s\00"
@.str.2 = [21 x i8] c"Twoje imie to: %19s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memmove(unsigned char *, unsigned char const *, int);
void rs_poly_div_x(unsigned char *_p, const unsigned char *_q, int _dp1) {
  memmove(_p, _q + 1, (_dp1 - 1) * sizeof(*_p));
  _p[_dp1 - 1] = 0;
}


x86 assembly (clang, -O0):
<rs_poly_div_x>:
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
add    $0x1,%rsi
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edx
call   1030 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rs_poly_div_x>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
add    $0x1,%rsi
movslq %edx,%rbx
lea    -0x1(%rbx),%rdx
call   1030 <memmove@plt>
movb   $0x0,-0x1(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @rs_poly_div_x(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 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 1
%14 = trunc i64 %13 to i32
%15 = call i32 @memmove(i8* %7, i8* %9, i32 %14)
%16 = load i8*, i8** %4
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %16, i64 %19
store i8 0, i8* %20
ret void
}

LLVM IR (-O2):
define void @rs_poly_div_x(i8* %0, i8* %1, i32 %2) {
%4 = getelementptr inbounds i8, i8* %1, i64 1
%5 = add nsw i32 %2, -1
%6 = sext i32 %5 to i64
%7 = tail call i32 @memmove(i8* %0, i8* %4, i32 %5)
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %8
ret void
}
/* Variables and functions */
int __get_cpsr();
__attribute__((always_)) int irq_is_enabled(void) {
  return !(__get_cpsr() & 0x00000080);
}


x86 assembly (clang, -O0):
<irq_is_enabled>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <__get_cpsr@plt>
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_is_enabled>:
push   %rax
xor    %eax,%eax
call   1030 <__get_cpsr@plt>
xor    %ecx,%ecx
test   $0x80,%al
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @irq_is_enabled() {
%1 = call i32 (...) @__get_cpsr()
%2 = and i32 %1, 128
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @irq_is_enabled() {
%1 = tail call i32 (...) @__get_cpsr()
%2 = lshr i32 %1, 7
%3 = and i32 %2, 1
%4 = xor i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void fnPrintArray(int A[], int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%d\t", A[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<fnPrintArray>:
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    1159 <fnPrintArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <fnPrintArray+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnPrintArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <fnPrintArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <fnPrintArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @fnPrintArray(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 = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @fnPrintArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ egcd(unsigned long, unsigned long, long *, long *);
unsigned long invert(unsigned long m, unsigned long b) {
  long s, t;
  egcd(m, b, &t, &s);
  if (s < 0)
    return m + s;
  return s;
}


x86 assembly (clang, -O0):
<invert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1030 <egcd@plt>
cmpq   $0x0,-0x20(%rbp)
jge    1151 <invert+0x41>
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1159 <invert+0x49>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   1030 <egcd@plt>
mov    (%rsp),%rcx
mov    %rcx,%rax
sar    $0x3f,%rax
and    %rbx,%rax
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @invert(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = call i32 @egcd(i64 %0, i64 %1, i64* %4, i64* %3)
%8 = load i64, i64* %3
%9 = icmp slt i64 %8, 0
%10 = select i1 %9, i64 %0, i64 0
%11 = add i64 %10, %8
ret i64 %11
}
/* Variables and functions */
scalar_t__ memcmp(void const *, void const *, size_t);
int hasheq_strp(const void *a, size_t na, const void *b, size_t nb) {
  if (na != nb) {
    return 0;
  }
  return memcmp(a, b, na) == 0;
}


x86 assembly (clang, -O0):
<hasheq_strp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1142 <hasheq_strp+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1162 <hasheq_strp+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasheq_strp>:
xor    %eax,%eax
cmp    %rcx,%rsi
jne    1135 <hasheq_strp+0x25>
push   %rax
mov    %rsi,%r8
mov    %rdx,%rsi
mov    %r8,%rdx
call   1030 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @hasheq_strp(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = icmp eq i64 %1, %3
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = tail call i64 @memcmp(i8* %0, i8* %2, i64 %1)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %4, %6
%11 = phi i32 [ %9, %6 ], [ 0, %4 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
void c(int code, void *k) {
  char *x = (char *)k;
  printf("%d%c", code, x[0]);
}


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x18(%rbp),%rax
lea    0xecb(%rip),%rdi
movsbl (%rax),%edx
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
mov    %edi,%eax
movsbl (%rsi),%edx
lea    0xee4(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%c\00"
define void @c(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0, i8 signext %3)
ret void
}
/* Variables and functions */
int flsll(long long mask) {
  int bit;
  if (mask == 0)
    return (0);
  for (bit = 1; mask != 1; bit++)
    mask = (unsigned long long)mask >> 1;
  return (bit);
}


x86 assembly (clang, -O0):
<flsll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <flsll+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1151 <flsll+0x51>
movl   $0x1,-0x14(%rbp)
cmpq   $0x1,-0x10(%rbp)
je     114b <flsll+0x4b>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <flsll+0x26>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flsll>:
test   %rdi,%rdi
je     112d <flsll+0x2d>
mov    $0x1,%eax
cmp    $0x1,%rdi
je     112c <flsll+0x2c>
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
shr    %rdi
add    $0x1,%eax
cmp    $0x1,%rdi
jne    1120 <flsll+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @flsll(i64 %0) {
switch i64 %0, label %2 [
i64 0, label %10
i64 1, label %8
]
2: ; preds = %1, %2
%3 = phi i32 [ %6, %2 ], [ 1, %1 ]
%4 = phi i64 [ %5, %2 ], [ %0, %1 ]
%5 = lshr i64 %4, 1
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i64 %5, 1
br i1 %7, label %8, label %2
8: ; preds = %2, %1
%9 = phi i32 [ 1, %1 ], [ %6, %2 ]
br label %10
10: ; preds = %1, %8
%11 = phi i32 [ 0, %1 ], [ %9, %8 ]
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t nrf_drv_radio802154_rx_duration_get(uint8_t psdu_length,
                                             bool ack_requested) {
  uint16_t result = 10 + (psdu_length + 1) * 2;
  if (ack_requested) {
    result += 12 + 10 + (6 * 2);
  }
  result *= 16;
  return result;
}


x86 assembly (clang, -O0):
<nrf_drv_radio802154_rx_duration_get>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
shl    $0x1,%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112c <nrf_drv_radio802154_rx_duration_get+0x2c>
mov    -0xc(%rbp),%eax
add    $0x22,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_drv_radio802154_rx_duration_get>:
test   %esi,%esi
lea    0xc(%rdi,%rdi,1),%ecx
lea    0x2e(%rdi,%rdi,1),%eax
cmove  %ecx,%eax
shl    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @nrf_drv_radio802154_rx_duration_get(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
%8 = mul nsw i32 %7, 2
%9 = add nsw i32 10, %8
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 34
store i32 %14, i32* %5
br label %15
15: ; preds = %12, %2
%16 = load i32, i32* %5
%17 = mul nsw i32 %16, 16
store i32 %17, i32* %5
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
define i32 @nrf_drv_radio802154_rx_duration_get(i32 %0, i32 %1) {
%3 = shl i32 %0, 1
%4 = icmp eq i32 %1, 0
%5 = select i1 %4, i32 12, i32 46
%6 = add i32 %5, %3
%7 = shl nsw i32 %6, 4
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void fprint_swap(FILE *stream) {
  fprintf(stream, "SWAP  A                         ");
}


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

x86 assembly (clang, -O2):
<fprint_swap>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
@.str = [33 x i8] c"SWAP A \00"
define void @fprint_swap(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 32, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int func(int);
int main() { return func(77); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4d,%edi
call   1030 <func@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x4d,%edi
jmp    1030 <func@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32 77)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ abort();
char *strdup(char const *);
char *xstrdup(const char *s) {
  char *copy = strdup(s);
  if (copy == NULL)
    abort();
  else
    return copy;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <xstrdup+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rax
call   1040 <strdup@plt>
test   %rax,%rax
je     112d <xstrdup+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ printf(char *);
int main(int ac, char *av[]) {
  foo();
  printf("If you see this statement, it means that the buffer overflow\n");
  printf("never occurred.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [62 x i8] c"If you see this statement, it means that the buffer overflow\0A\00"
@.str.1 = [17 x i8] c"never occurred.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @foo()
%7 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [61 x i8] c"If you see this statement, it means that the buffer overflow\00"
@str.2 = [16 x i8] c"never occurred.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @foo()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void displayMyString(char *key, void *data) {
  char *stringData = data;
  printf("\nkey: %s data: %s", key, stringData);
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"\0Akey: %s data: %s\00"
define void @displayMyString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
%7 = load i8*, i8** %3
%8 = load i8*, i8** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0Akey: %s data: %s\00"
define void @displayMyString(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
int test_imm_CDint16_mem(short *val) {
  return ((*val) & (0xCD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CDint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xcd,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_CDint16_mem>:
testb  $0xcd,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_CDint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 205
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void gnu_debug_lock() {}


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

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

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

LLVM IR (-O2):
define void @gnu_debug_lock() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
time_t osGetTime(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @osGetTime() {
ret i32 0
}
int cal_utf8_num_bytes(unsigned char byte) {
  int num = 0;
  int val = 0x80;
  while (byte & val) {
    ++num;
    val >>= 1;
  }
  return num;
}


x86 assembly (clang, -O0):
<cal_utf8_num_bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x80,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
je     113f <cal_utf8_num_bytes+0x3f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1118 <cal_utf8_num_bytes+0x18>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_utf8_num_bytes>:
xor    %eax,%eax
test   $0x80,%dil
je     1119 <cal_utf8_num_bytes+0x19>
xor    %eax,%eax
mov    $0x80,%ecx
nop
add    $0x1,%eax
shr    %ecx
test   %edi,%ecx
jne    1110 <cal_utf8_num_bytes+0x10>
ret

LLVM IR (-O0):
define i32 @cal_utf8_num_bytes(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
store i32 128, i32* %4
br label %5
5: ; preds = %11, %1
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = load i32, i32* %4
%9 = and i32 %7, %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = ashr i32 %14, 1
store i32 %15, i32* %4
br label %5
16: ; preds = %5
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @cal_utf8_num_bytes(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 128, %1 ]
%7 = phi i32 [ %8, %5 ], [ 0, %1 ]
%8 = add nuw nsw i32 %7, 1
%9 = lshr i32 %6, 1
%10 = and i32 %9, %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i32 [ 0, %1 ], [ %8, %5 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ UI;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int ui_open_fail(UI *ui) {
  (void)ui;
  fprintf(stderr, "It seems like get_pin fell through even though the pin "
                  "should already be set!\n");
  return 0;
}


x86 assembly (clang, -O0):
<ui_open_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_open_fail>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [79 x i8] c"It seems like get_pin fell through even though the pin should already be set!\0A\00"
define i32 @ui_open_fail(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [79 x i8] c"It seems like get_pin fell through even though the pin should already be set!\0A\00"
define i32 @ui_open_fail(i32* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
double or (double a, double b) { return 1.0 - (1.0 - a) * (1.0 - b); }


x86 assembly (clang, -O0):
<or>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xedd(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb5(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<or>:
movsd  0xef8(%rip),%xmm2
movapd %xmm2,%xmm3
subsd  %xmm0,%xmm3
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @or(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fsub double 1.000000e+00, %5
%7 = load double, double* %4
%8 = fsub double 1.000000e+00, %7
%9 = fneg double %6
%10 = call double @llvm.fmuladd.f64(double %9, double %8, double 1.000000e+00)
ret double %10
}

LLVM IR (-O2):
define double @or(double %0, double %1) {
%3 = fsub double 1.000000e+00, %0
%4 = fsub double 1.000000e+00, %1
%5 = fneg double %3
%6 = tail call double @llvm.fmuladd.f64(double %5, double %4, double 1.000000e+00)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ sceKernelExitDeleteThread(int /*<<< orphan*/);
void uvl_exit(int status) { sceKernelExitDeleteThread(0); }


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

x86 assembly (clang, -O2):
<uvl_exit>:
xor    %edi,%edi
jmp    1030 <sceKernelExitDeleteThread@plt>

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

LLVM IR (-O2):
define void @uvl_exit(i32 %0) {
%2 = tail call i32 @sceKernelExitDeleteThread(i32 0)
ret void
}
/* Type definitions */
struct bplus_tree {
  int dummy;
};

/* Variables and functions */
int bplus_tree_delete(struct bplus_tree *, int);
int bplus_tree_insert(struct bplus_tree *, int, int);
int bplus_tree_put(struct bplus_tree *tree, int key, int data) {
  if (data) {
    return bplus_tree_insert(tree, key, data);
  } else {
    return bplus_tree_delete(tree, key);
  }
}


x86 assembly (clang, -O0):
<bplus_tree_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1153 <bplus_tree_put+0x33>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <bplus_tree_insert@plt>
mov    %eax,-0x4(%rbp)
jmp    1162 <bplus_tree_put+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <bplus_tree_delete@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bplus_tree_put>:
test   %edx,%edx
je     1129 <bplus_tree_put+0x9>
jmp    1030 <bplus_tree_insert@plt>
jmp    1040 <bplus_tree_delete@plt>

LLVM IR (-O0):
%struct.bplus_tree = type { i32 }
define i32 @bplus_tree_put(%struct.bplus_tree* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.bplus_tree*
%6 = alloca i32
%7 = alloca i32
store %struct.bplus_tree* %0, %struct.bplus_tree** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load %struct.bplus_tree*, %struct.bplus_tree** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @bplus_tree_insert(%struct.bplus_tree* %11, i32 %12, i32 %13)
store i32 %14, i32* %4
br label %19
15: ; preds = %3
%16 = load %struct.bplus_tree*, %struct.bplus_tree** %5
%17 = load i32, i32* %6
%18 = call i32 @bplus_tree_delete(%struct.bplus_tree* %16, i32 %17)
store i32 %18, i32* %4
br label %19
19: ; preds = %15, %10
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
%struct.bplus_tree = type { i32 }
define i32 @bplus_tree_put(%struct.bplus_tree* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @bplus_tree_insert(%struct.bplus_tree* %0, i32 %1, i32 %2)
br label %9
7: ; preds = %3
%8 = tail call i32 @bplus_tree_delete(%struct.bplus_tree* %0, i32 %1)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}