xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ erase();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
void print_help() {
  erase();
  refresh();
  printw("TODO: Add help info here.");
  getch();
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <erase@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
lea    0xea7(%rip),%rdi
call   1040 <printw@plt>
mov    $0x0,%al
call   1060 <getch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
push   %rax
xor    %eax,%eax
call   1030 <erase@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <getch@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"TODO: Add help info here.\00"
define void @print_help() {
%1 = call i32 (...) @erase()
%2 = call i32 (...) @refresh()
%3 = call i32 @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"TODO: Add help info here.\00"
define void @print_help() {
%1 = tail call i32 (...) @erase()
%2 = tail call i32 (...) @refresh()
%3 = tail call i32 @printw(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @getch()
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int write(int const, int *, int);
int _oled_cmd(const int fd, const uint8_t cmd) {
  uint8_t buf[2] = {0x80, cmd};
  return write(fd, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<_oled_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x80,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_oled_cmd>:
push   %rax
movl   $0x80,(%rsp)
mov    %esi,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_oled_cmd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 128, i32* %6
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %4
store i32 %8, i32* %7
%9 = load i32, i32* %3
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%11 = call i32 @write(i32 %9, i32* %10, i32 8)
ret i32 %11
}

LLVM IR (-O2):
define i32 @_oled_cmd(i32 %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 128, i32* %5
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %1, i32* %6
%7 = call i32 @write(i32 %0, i32* %5, i32 8)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ script_error(char const *);
void yyerror(const char *s) { script_error(s); }


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

x86 assembly (clang, -O2):
<yyerror>:
jmp    1030 <script_error@plt>

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

LLVM IR (-O2):
define void @yyerror(i8* %0) {
%2 = tail call i32 @script_error(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
int getInfo(char *buf, int bufLen) {
  static const char *INFO = "info { name=Lfo }";
  int reqLen = strlen(INFO) + 1;
  if (buf != 0 && reqLen <= bufLen) {
    memcpy(buf, INFO, reqLen);
  }
  return reqLen;
}


x86 assembly (clang, -O0):
<getInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2efa(%rip),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116b <getInfo+0x4b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     116b <getInfo+0x4b>
mov    -0x8(%rbp),%rdi
mov    0x2ecd(%rip),%rsi
mov    -0x10(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInfo>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
test   %rbx,%rbx
je     1154 <getInfo+0x34>
cmp    %r14d,%eax
jge    1154 <getInfo+0x34>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@getInfo.INFO = internal global i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i32 0, i32 0)
@.str = [18 x i8] c"info { name=Lfo }\00"
define i32 @getInfo(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** @getInfo.INFO
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i8*, i8** @getInfo.INFO
%18 = load i32, i32* %5
%19 = call i32 @memcpy(i8* %16, i8* %17, i32 %18)
br label %20
20: ; preds = %15, %11, %2
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
@.str = [18 x i8] c"info { name=Lfo }\00"
define i32 @getInfo(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = add nsw i32 %3, 1
%5 = icmp ne i8* %0, null
%6 = icmp slt i32 %3, %1
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @memcpy(i8* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %10
10: ; preds = %8, %2
ret i32 %4
}
int fadd(float a, float b) { return a + b; }


x86 assembly (clang, -O0):
<fadd>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fadd>:
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @fadd(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %5, %6
%8 = fptosi float %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @fadd(float %0, float %1) {
%3 = fadd float %0, %1
%4 = fptosi float %3 to i32
ret i32 %4
}
/* Type definitions */
struct wl_proxy {
  int dummy;
};
struct wl_data_device {
  int dummy;
};

/* Variables and functions */
void *wl_proxy_get_user_data(struct wl_proxy *);
void *wl_data_device_get_user_data(struct wl_data_device *wl_data_device) {
  return wl_proxy_get_user_data((struct wl_proxy *)wl_data_device);
}


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

x86 assembly (clang, -O2):
<wl_data_device_get_user_data>:
jmp    1030 <wl_proxy_get_user_data@plt>

LLVM IR (-O0):
%struct.wl_data_device = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_data_device_get_user_data(%struct.wl_data_device* %0) {
%2 = alloca %struct.wl_data_device*
store %struct.wl_data_device* %0, %struct.wl_data_device** %2
%3 = load %struct.wl_data_device*, %struct.wl_data_device** %2
%4 = bitcast %struct.wl_data_device* %3 to %struct.wl_proxy*
%5 = call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.wl_data_device = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_data_device_get_user_data(%struct.wl_data_device* %0) {
%2 = bitcast %struct.wl_data_device* %0 to %struct.wl_proxy*
%3 = tail call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %2)
ret i8* %3
}
/* Variables and functions */
scalar_t__ isupper(int);
int tolower(int c) {
  if (isupper(c))
    return c - ('A' - 'a');
  else
    return c;
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
je     113b <tolower+0x2b>
mov    -0x8(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <tolower+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <isupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @isupper(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, -32
store i32 %9, i32* %2
br label %12
10: ; preds = %1
%11 = load i32, i32* %3
store i32 %11, i32* %2
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ toupper(char);
void strToUpper(char *str) {
  char c;
  do {
    c = *(str);
    *(str++) = toupper(c);
  } while (c != 0);
}


x86 assembly (clang, -O0):
<strToUpper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    111c <strToUpper+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strToUpper>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
movsbl (%rbx),%ebp
mov    %ebp,%edi
call   1030 <toupper@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %ebp,%ebp
jne    1120 <strToUpper+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @strToUpper(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i32 @toupper(i8 signext %4)
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %6, i8* %3
%8 = icmp eq i8 %4, 0
br i1 %8, label %9, label %2
9: ; preds = %2
ret void
}
void slc_read_callback(int result, int priv) {
  int *private_data = (int *)priv;
  private_data[1] = result;
  ((int (*)(int))0x107F6BCC)(private_data[0]);
}


x86 assembly (clang, -O0):
<slc_read_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x107f6bcc,%eax
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slc_read_callback>:
movslq %esi,%rax
mov    %edi,0x4(%rax)
mov    (%rax),%edi
mov    $0x107f6bcc,%eax
jmp    *%rax

LLVM IR (-O0):
define void @slc_read_callback(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* %4
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %5
%9 = load i32, i32* %3
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %9, i32* %11
%12 = load i32*, i32** %5
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = call i32 inttoptr (i64 276786124 to i32 (i32)*)(i32 %14)
ret void
}

LLVM IR (-O2):
define void @slc_read_callback(i32 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %0, i32* %5
%6 = load i32, i32* %4
%7 = tail call i32 inttoptr (i64 276786124 to i32 (i32)*)(i32 %6)
ret void
}
int pldummy_wingcc() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @pldummy_wingcc() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ heapifyUp(int *, int);
void add(int *pq, int *cap, int val) {
  pq[*cap] = val;
  *cap = *cap + 1;
  heapifyUp(pq, *cap - 1);
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
sub    $0x1,%esi
call   1030 <heapifyUp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
movslq (%rsi),%rax
mov    %edx,(%rdi,%rax,4)
mov    (%rsi),%eax
lea    0x1(%rax),%ecx
mov    %ecx,(%rsi)
mov    %eax,%esi
jmp    1030 <heapifyUp@plt>

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

LLVM IR (-O2):
define void @add(i32* %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %2, i32* %6
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
%9 = tail call i32 @heapifyUp(i32* %0, i32 %7)
ret void
}
void write_flashram_dummyb() {}


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

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

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

LLVM IR (-O2):
define void @write_flashram_dummyb() {
ret void
}
/* Variables and functions */
int system(char *);
int run_shell_command(char *commandstr) {
  if (system(commandstr) != -1)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<run_shell_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <system@plt>
cmp    $0xffffffff,%eax
je     113a <run_shell_command+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1141 <run_shell_command+0x31>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_shell_command>:
push   %rax
call   1030 <system@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @run_shell_command(i8* nocapture %0) {
%2 = tail call i32 @system(i8* %0)
%3 = icmp eq i32 %2, -1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void malloc_failed() {
  fprintf(stderr, "malloc() failed\n");
  abort();
}


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

x86 assembly (clang, -O2):
<malloc_failed>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"malloc() failed\0A\00"
define void @malloc_failed() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"malloc() failed\0A\00"
define void @malloc_failed() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
int bang(int x) {
  int a, b;
  a = x >> 31;
  b = ~x + 1 >> 31;
  return (a | b) + 1;
}


x86 assembly (clang, -O0):
<bang>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
sar    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bang>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @bang(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 31
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = xor i32 %7, -1
%9 = add nsw i32 %8, 1
%10 = ashr i32 %9, 31
store i32 %10, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = or i32 %11, %12
%14 = add nsw i32 %13, 1
ret i32 %14
}

LLVM IR (-O2):
define i32 @bang(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
double val_double(double x) { return x; }


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

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

LLVM IR (-O0):
define double @val_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
ret double %3
}

LLVM IR (-O2):
define double @val_double(double returned %0) {
ret double %0
}
char *basename(name)
char *name;
{
  char *base;
  base = rindex(name, '/');
  return base ? base + 1 : name;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <rindex@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <basename+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <basename+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <rindex@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @rindex(i8* %4, i32 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %13
11: ; preds = %1
%12 = load i8*, i8** %2
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = tail call i8* @rindex(i8* %0, i32 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
regx0adrx1_set(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (p0[x0]) = (((short *)11111111)[x1]); }


x86 assembly (clang, -O0):
<regx0adrx1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    $0xa98ac7,%eax
mov    (%rax,%rcx,2),%dx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0adrx1_set>:
movslq %ecx,%rax
movzwl 0xa98ac7(%rax,%rax,1),%eax
movslq %edx,%rcx
mov    %ax,(%r8,%rcx,2)
ret

LLVM IR (-O0):
define i32 @regx0adrx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i32, i32* %11
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %17
%19 = load i16, i16* %18
%20 = load i16*, i16** %12
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i16, i16* %20, i64 %22
store i16 %19, i16* %23
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
define i32 @regx0adrx1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture readnone %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %7
%9 = load i16, i16* %8
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds i16, i16* %4, i64 %10
store i16 %9, i16* %11
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int rc_i2c_read_words(int, int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int rc_i2c_read_word(int bus, uint8_t regAddr, uint16_t *data) {
  return rc_i2c_read_words(bus, regAddr, 1, data);
}


x86 assembly (clang, -O0):
<rc_i2c_read_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1030 <rc_i2c_read_words@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc_i2c_read_word>:
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <rc_i2c_read_words@plt>

LLVM IR (-O0):
define i32 @rc_i2c_read_word(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 = load i32*, i32** %6
%10 = call i32 @rc_i2c_read_words(i32 %7, i32 %8, i32 1, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @rc_i2c_read_word(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @rc_i2c_read_words(i32 %0, i32 %1, i32 1, i32* %2)
ret i32 %4
}
__attribute__((visibility("default"))) const double xfdim(double x, double y) {
  double ret = x - y;
  if (ret < 0 || x == y)
    ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<xfdim>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     1141 <xfdim+0x41>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    1149 <xfdim+0x49>
jp     1149 <xfdim+0x49>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfdim>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
cmpeqsd %xmm1,%xmm0
xorpd  %xmm1,%xmm1
maxsd  %xmm2,%xmm1
andnpd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @xfdim(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fsub double %6, %7
store double %8, double* %5
%9 = load double, double* %5
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load double, double* %3
%13 = load double, double* %4
%14 = fcmp oeq double %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11, %2
store double 0.000000e+00, double* %5
br label %16
16: ; preds = %15, %11
%17 = load double, double* %5
ret double %17
}

LLVM IR (-O2):
define double @xfdim(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fcmp olt double %3, 0.000000e+00
%5 = fcmp oeq double %0, %1
%6 = or i1 %5, %4
%7 = select i1 %6, double 0.000000e+00, double %3
ret double %7
}
int test_imm_A4int64_highword_reg(long long val) {
  return ((val >> 32) & (0xA4 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A4int64_highword_reg>:
movabs $0xa400000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A4int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 164
%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_A4int64_highword_reg(i64 %0) {
%2 = and i64 %0, 704374636544
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void exercise() {
  int age = 10;
  int height = 72;
  printf("I am %d years old.\n", age);
  printf("I am %d inches tall.\n", height);
}


x86 assembly (clang, -O0):
<exercise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x48,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exercise>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x48,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define void @exercise() {
%1 = alloca i32
%2 = alloca i32
store i32 10, i32* %1
store i32 72, i32* %2
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"I am %d years old.\0A\00"
@.str.1 = [22 x i8] c"I am %d inches tall.\0A\00"
define void @exercise() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 72)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(int);
uint8_t *ts_allocate(void) { return malloc(188 * sizeof(uint8_t)); }


x86 assembly (clang, -O0):
<ts_allocate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2f0,%edi
call   1030 <malloc@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32* @ts_allocate() {
%1 = call i32* @malloc(i32 752)
ret i32* %1
}

LLVM IR (-O2):
define noalias i32* @ts_allocate() {
%1 = tail call i32* @malloc(i32 752)
ret i32* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
void om_text_print_strkey_info(FILE *fp, char *key, char *val) {
  fprintf(fp, "* %s: %s\n", key, val);
}


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

x86 assembly (clang, -O2):
<om_text_print_strkey_info>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"* %s: %s\0A\00"
define void @om_text_print_strkey_info(i32* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
int my_power_rec(int nb, int power) {
  if (power < 0) {
    return (0);
  }
  if (power == 0) {
    return (1);
  }
  if (power > 1) {
    nb = nb * my_power_rec(nb, power - 1);
  }
  return (nb);
}


x86 assembly (clang, -O0):
<my_power_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1134 <my_power_rec+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1179 <my_power_rec+0x69>
cmpl   $0x0,-0xc(%rbp)
jne    114a <my_power_rec+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1179 <my_power_rec+0x69>
cmpl   $0x1,-0xc(%rbp)
jle    1173 <my_power_rec+0x63>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <my_power_rec@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_power_rec>:
test   %esi,%esi
js     1128 <my_power_rec+0x28>
mov    $0x1,%eax
test   %esi,%esi
je     111f <my_power_rec+0x1f>
nopl   (%rax)
cmp    $0x1,%esi
je     1124 <my_power_rec+0x24>
add    $0xffffffff,%esi
imul   %edi,%eax
test   %esi,%esi
jne    1110 <my_power_rec+0x10>
mov    $0x1,%edi
imul   %edi,%eax
ret
xor    %edi,%edi
mov    $0x1,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @my_power_rec(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %7
%5 = phi i32 [ %8, %7 ], [ %1, %2 ]
%6 = phi i32 [ %9, %7 ], [ 1, %2 ]
switch i32 %5, label %7 [
i32 0, label %10
i32 1, label %11
]
7: ; preds = %4
%8 = add nsw i32 %5, -1
%9 = mul nsw i32 %6, %0
br label %4
10: ; preds = %4
br label %11
11: ; preds = %4, %10, %2
%12 = phi i32 [ 1, %2 ], [ %6, %10 ], [ %6, %4 ]
%13 = phi i32 [ 0, %2 ], [ 1, %10 ], [ %0, %4 ]
%14 = mul nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
int MCL_CURRENT;
int MCL_FUTURE;
int mlockall(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sleep(int);
int main() {
  int ret;
  ret = mlockall(MCL_CURRENT | MCL_FUTURE);
  if (ret != 0)
    perror("mlockall failed:");
  while (1) {
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    0x2ea1(%rip),%rax
or     (%rax),%edi
call   1030 <mlockall@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116f <main+0x3f>
lea    0xe96(%rip),%rdi
call   1040 <perror@plt>
jmp    1174 <main+0x44>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1174 <main+0x44>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1030 <mlockall@plt>
test   %eax,%eax
jne    115c <main+0x2c>
nopl   0x0(%rax)
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1150 <main+0x20>
lea    0xe9d(%rip),%rdi
call   1040 <perror@plt>
jmp    1150 <main+0x20>

LLVM IR (-O0):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [17 x i8] c"mlockall failed:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @MCL_CURRENT
%4 = load i32, i32* @MCL_FUTURE
%5 = or i32 %3, %4
%6 = call i32 @mlockall(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
br label %12
12: ; preds = %11, %12
%13 = call i32 @sleep(i32 1)
br label %12
}

LLVM IR (-O2):
@MCL_CURRENT = global i32 0
@MCL_FUTURE = global i32 0
@.str = [17 x i8] c"mlockall failed:\00"
define i32 @main() {
%1 = load i32, i32* @MCL_CURRENT
%2 = load i32, i32* @MCL_FUTURE
%3 = or i32 %2, %1
%4 = tail call i32 @mlockall(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
br label %9
9: ; preds = %8, %9
%10 = tail call i32 @sleep(i32 1)
br label %9
}
float square_distance(float const a[2], float const b[2]) {
  double dx, dy;
  dx = a[0] - b[0];
  dy = a[1] - b[1];
  return dx * dx + dy * dy;
}


x86 assembly (clang, -O0):
<square_distance>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square_distance>:
movss  (%rdi),%xmm0
movss  0x4(%rdi),%xmm1
subss  (%rsi),%xmm0
cvtss2sd %xmm0,%xmm0
subss  0x4(%rsi),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @square_distance(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca double
%6 = alloca double
store float* %0, float** %3
store float* %1, float** %4
%7 = load float*, float** %3
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = fsub float %9, %12
%14 = fpext float %13 to double
store double %14, double* %5
%15 = load float*, float** %3
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = load float*, float** %4
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
%21 = fsub float %17, %20
%22 = fpext float %21 to double
store double %22, double* %6
%23 = load double, double* %5
%24 = load double, double* %5
%25 = load double, double* %6
%26 = load double, double* %6
%27 = fmul double %25, %26
%28 = call double @llvm.fmuladd.f64(double %23, double %24, double %27)
%29 = fptrunc double %28 to float
ret float %29
}

LLVM IR (-O2):
define float @square_distance(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fsub float %3, %4
%6 = fpext float %5 to double
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = fpext float %11 to double
%13 = fmul double %12, %12
%14 = tail call double @llvm.fmuladd.f64(double %6, double %6, double %13)
%15 = fptrunc double %14 to float
ret float %15
}
long long int llabs(long long int j) { return (j < 0LL) ? -j : j; }


x86 assembly (clang, -O0):
<llabs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1122 <llabs+0x22>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <llabs+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llabs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @llabs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %5
%11 = phi i64 [ %7, %5 ], [ %9, %8 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @llabs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
f() {
  int i = 2;
  for (int i = 90; i < 95; i++) {
    int x = 10;
  }
  return i;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x2,-0x4(%rbp)
movl   $0x5a,-0x8(%rbp)
cmpl   $0x5f,-0x8(%rbp)
jge    1131 <f+0x31>
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <f+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 2
}
rl_vi_put(count, key) int count, key;
{
  if (!uppercase_p(key))
    rl_forward(1);
  rl_yank();
  rl_backward(1);
}


x86 assembly (clang, -O0):
<rl_vi_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1040 <uppercase_p@plt>
cmp    $0x0,%eax
jne    116d <rl_vi_put+0x2d>
mov    $0x1,%edi
mov    $0x0,%al
call   1050 <rl_forward@plt>
mov    $0x0,%al
call   1030 <rl_yank@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1060 <rl_backward@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rl_vi_put>:
push   %rax
mov    %esi,%edi
xor    %eax,%eax
call   1040 <uppercase_p@plt>
test   %eax,%eax
jne    115a <rl_vi_put+0x1a>
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <rl_forward@plt>
xor    %eax,%eax
call   1030 <rl_yank@plt>
mov    $0x1,%edi
xor    %eax,%eax
pop    %rcx
jmp    1060 <rl_backward@plt>

LLVM IR (-O0):
define i32 @rl_vi_put(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = call i32 (i32, ...) bitcast (i32 (...)* @uppercase_p to i32 (i32, ...)*)(i32 %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 (i32, ...) bitcast (i32 (...)* @rl_forward to i32 (i32, ...)*)(i32 1)
br label %11
11: ; preds = %9, %2
%12 = call i32 (...) @rl_yank()
%13 = call i32 (i32, ...) bitcast (i32 (...)* @rl_backward to i32 (i32, ...)*)(i32 1)
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @rl_vi_put(i32 %0, i32 %1) {
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @uppercase_p to i32 (i32, ...)*)(i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @rl_forward to i32 (i32, ...)*)(i32 1)
br label %7
7: ; preds = %5, %2
%8 = tail call i32 (...) @rl_yank()
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @rl_backward to i32 (i32, ...)*)(i32 1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Inner(int);
int /*<<< orphan*/ printf(char *, int, int, int);
void Foo(int a, int b, int c) {
  printf("Foo: a=%d, b=%d, c=%d\n", a, b, c);
  Inner(a + b + c);
}


x86 assembly (clang, -O0):
<Foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
add    -0x8(%rbp),%edi
add    -0xc(%rbp),%edi
call   1030 <Inner@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Foo>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xece(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1040 <printf@plt>
add    %ebx,%ebp
add    %r14d,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <Inner@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Foo: a=%d, b=%d, c=%d\0A\00"
define void @Foo(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 = load i32, i32* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
%16 = call i32 @Inner(i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Foo: a=%d, b=%d, c=%d\0A\00"
define void @Foo(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
%5 = add nsw i32 %1, %0
%6 = add nsw i32 %5, %2
%7 = tail call i32 @Inner(i32 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int binarySearch(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int arr[] = {1, 2, 3, 5};
  int size = sizeof(arr) / sizeof(arr[0]);
  int find = 3;
  printf("Position of %d is %d\n", find, binarySearch(arr, 0, size - 1, find));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x3,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
mov    -0x28(%rbp),%ecx
xor    %esi,%esi
call   1040 <binarySearch@plt>
mov    -0x2c(%rbp),%esi
mov    %eax,%edx
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.arr = [4 x i32] [i32 1, i32 2, i32 3, i32 5]
@.str = [22 x i8] c"Position of %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i32]* %2 to i8*
store i32 4, i32* %3
store i32 3, i32* %4
%6 = load i32, i32* %4
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* %4
%11 = call i32 @binarySearch(i32* %7, i32 0, i32 %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [4 x i32] [i32 1, i32 2, i32 3, i32 5]
@.str = [22 x i8] c"Position of %d is %d\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @binarySearch(i32* %3, i32 0, i32 3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 3, i32 %4)
ret i32 0
}
__attribute__((visibility("default"))) void aflags_clobber(void) {}


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

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

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

LLVM IR (-O2):
define void @aflags_clobber() {
ret void
}
int lshift_s_u(int left, unsigned int right) {
  if ((left < 0) || (right >= sizeof(int) * 8) ||
      (left > (2147483647 >> right))) {
    return left;
  }
  return left << right;
}


x86 assembly (clang, -O0):
<lshift_s_u>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1138 <lshift_s_u+0x38>
mov    -0xc(%rbp),%eax
cmp    $0x20,%rax
jae    1138 <lshift_s_u+0x38>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x7fffffff,%edx
sar    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jle    1143 <lshift_s_u+0x43>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114e <lshift_s_u+0x4e>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lshift_s_u>:
mov    %esi,%ecx
mov    %edi,%eax
mov    $0x7fffffff,%edx
shr    %cl,%edx
xor    %esi,%esi
cmp    %edi,%edx
mov    %ecx,%edx
cmovl  %esi,%edx
cmp    $0x20,%ecx
cmovae %esi,%edx
test   %edi,%edi
cmovs  %esi,%edx
mov    %edx,%ecx
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @lshift_s_u(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
%4 = icmp ugt i32 %1, 31
%5 = or i1 %3, %4
%6 = lshr i32 2147483647, %1
%7 = icmp slt i32 %6, %0
%8 = select i1 %5, i1 true, i1 %7
%9 = select i1 %8, i32 0, i32 %1
%10 = shl i32 %0, %9
ret i32 %10
}