xunge/DecIR huggingface dataset:
/* Variables and functions */
char *role_select();
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *strdup(char *);
char *role_system_string(char *where) {
  char system_string[1024];
  sprintf(system_string, "select.sh \"%s\" role \"%s\" none", role_select(),
          where);
  return strdup(system_string);
}


x86 assembly (clang, -O0):
<role_system_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    $0x0,%al
call   1030 <role_select@plt>
mov    -0x418(%rbp),%rdi
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
lea    0xe97(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<role_system_string>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <role_select@plt>
lea    0xeb5(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <sprintf@plt>
mov    %r14,%rdi
call   1050 <strdup@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"select.sh \22%s\22 role \22%s\22 none\00"
define i8* @role_system_string(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i8* (...) @role_select()
%6 = load i8*, i8** %2
%7 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i8* @strdup(i8* %8)
ret i8* %9
}

LLVM IR (-O2):
@.str = [30 x i8] c"select.sh \22%s\22 role \22%s\22 none\00"
define noalias i8* @role_system_string(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i8* (...) @role_select()
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %0)
%6 = call i8* @strdup(i8* %3)
ret i8* %6
}
/* Type definitions */
struct in_addr {
  int /*<<< orphan*/ s_addr;
};

/* Variables and functions */
int errno;
scalar_t__ inet_aton(char *, struct in_addr *);
unsigned long ntohl(int /*<<< orphan*/);
unsigned long atoh(char *ascii_address) {
  unsigned long IP;
  struct in_addr address;
  if (inet_aton(ascii_address, &address) == 0) {
    errno = 1;
    return 0;
  }
  IP = ntohl(address.s_addr);
  return IP;
}


x86 assembly (clang, -O0):
<atoh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <inet_aton@plt>
cmp    $0x0,%rax
jne    115d <atoh+0x3d>
mov    0x2e96(%rip),%rax
movl   $0x1,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1171 <atoh+0x51>
mov    -0x20(%rbp),%edi
call   1040 <ntohl@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoh>:
push   %rax
mov    %rsp,%rsi
call   1030 <inet_aton@plt>
test   %rax,%rax
je     1138 <atoh+0x18>
mov    (%rsp),%edi
call   1040 <ntohl@plt>
pop    %rcx
ret
mov    0x2ea1(%rip),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@errno = global i32 0
define i64 @atoh(i8* %0) {
%2 = alloca %struct.in_addr
%3 = bitcast %struct.in_addr* %2 to i8*
%4 = call i64 @inet_aton(i8* %0, %struct.in_addr* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* @errno
br label %11
7: ; preds = %1
%8 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %2, i64 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @ntohl(i32 %9)
br label %11
11: ; preds = %7, %6
%12 = phi i64 [ 0, %6 ], [ %10, %7 ]
ret i64 %12
}
double ho_recognize_font_1_three(const double *array_in) {
  double return_value = 0.0;
  return return_value;
}


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

x86 assembly (clang, -O2):
<ho_recognize_font_1_three>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @ho_recognize_font_1_three(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
store double 0.000000e+00, double* %3
%4 = load double, double* %3
ret double %4
}

LLVM IR (-O2):
define double @ho_recognize_font_1_three(double* nocapture readnone %0) {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void curses_stop(void) { endwin(); }


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

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

LLVM IR (-O0):
define void @curses_stop() {
%1 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
define void @curses_stop() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int bar(unsigned int);
long foo(long x, unsigned int y) {
  return *(((long *)(bar(y) - 1)) + 1 + (x >> 2) % 359);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <bar@plt>
sub    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x2,%rax
mov    $0x167,%ecx
cqto
idiv   %rcx
mov    -0x18(%rbp),%rax
mov    0x8(%rax,%rdx,8),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <bar@plt>
mov    %eax,%ecx
sar    $0x2,%rbx
movabs $0xb68d31340e4307d9,%rdx
31 8d b6
mov    %rbx,%rax
imul   %rdx
movslq %ecx,%rax
add    %rbx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x8,%rdx
add    %rcx,%rdx
imul   $0x167,%rdx,%rcx
sub    %rcx,%rbx
mov    0x7(%rax,%rbx,8),%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @foo(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @bar(i32 %5)
%7 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i64*
%10 = getelementptr inbounds i64, i64* %9, i64 1
%11 = load i64, i64* %3
%12 = ashr i64 %11, 2
%13 = srem i64 %12, 359
%14 = getelementptr inbounds i64, i64* %10, i64 %13
%15 = load i64, i64* %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @foo(i64 %0, i32 %1) {
%3 = tail call i32 @bar(i32 %1)
%4 = add nsw i32 %3, -1
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i64*
%7 = getelementptr inbounds i64, i64* %6, i64 1
%8 = ashr i64 %0, 2
%9 = srem i64 %8, 359
%10 = getelementptr inbounds i64, i64* %7, i64 %9
%11 = load i64, i64* %10
ret i64 %11
}
/* Type definitions */
typedef int uint64_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t get_timestamp_us() {
  struct timeval now;
  gettimeofday(&now, NULL);
  uint64_t ts = now.tv_sec;
  return ts * 1000000 + now.tv_usec;
}


x86 assembly (clang, -O0):
<get_timestamp_us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
imul   $0xf4240,-0xc(%rbp),%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_timestamp_us>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,(%rsp),%eax
add    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @get_timestamp_us() {
%1 = alloca %struct.timeval
%2 = alloca i32
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @get_timestamp_us() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = add nsw i32 %6, %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free_list();
void clear_program() { free_list(); }


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

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

LLVM IR (-O0):
define void @clear_program() {
%1 = call i32 (...) @free_list()
ret void
}

LLVM IR (-O2):
define void @clear_program() {
%1 = tail call i32 (...) @free_list()
ret void
}
/* Variables and functions */
int recv(int, char *, int, int /*<<< orphan*/);
int udp_recv(int fd, char *buf, int len) {
  int ret = recv(fd, buf, len, 0);
  if (ret < 0)
    return 0;
  return ret;
}


x86 assembly (clang, -O0):
<udp_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    114c <udp_recv+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1152 <udp_recv+0x42>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udp_recv>:
push   %rbx
xor    %ebx,%ebx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
cmovs  %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @udp_recv(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @recv(i32 %0, i8* %1, i32 %2, i32 0)
%5 = icmp sgt i32 %4, 0
%6 = select i1 %5, i32 %4, i32 0
ret i32 %6
}
int xml_ideographic(int c) {
  if (c <= 0x9fa5) {
    return (c >= 0x4e00 && c <= 0x9fa5);
  } else {
    if (c <= 0x3007) {
      return (c == 0x3007);
    } else {
      return (c >= 0x3021 && c <= 0x3029);
    }
  }
}


x86 assembly (clang, -O0):
<xml_ideographic>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x9fa5,-0x8(%rbp)
jg     1143 <xml_ideographic+0x43>
xor    %eax,%eax
cmpl   $0x4e00,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1133 <xml_ideographic+0x33>
cmpl   $0x9fa5,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1191 <xml_ideographic+0x91>
cmpl   $0x3007,-0x8(%rbp)
jg     1167 <xml_ideographic+0x67>
cmpl   $0x3007,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1191 <xml_ideographic+0x91>
xor    %eax,%eax
cmpl   $0x3021,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     1186 <xml_ideographic+0x86>
cmpl   $0x3029,-0x8(%rbp)
setle  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xml_ideographic>:
add    $0xffffb200,%edi
xor    %eax,%eax
cmp    $0x51a6,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @xml_ideographic(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 40869
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 19968
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 40869
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
store i32 %14, i32* %2
br label %31
15: ; preds = %1
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 12295
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 12295
%21 = zext i1 %20 to i32
store i32 %21, i32* %2
br label %31
22: ; preds = %15
%23 = load i32, i32* %3
%24 = icmp sge i32 %23, 12321
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %3
%27 = icmp sle i32 %26, 12329
br label %28
28: ; preds = %25, %22
%29 = phi i1 [ false, %22 ], [ %27, %25 ]
%30 = zext i1 %29 to i32
store i32 %30, i32* %2
br label %31
31: ; preds = %28, %18, %12
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @xml_ideographic(i32 %0) {
%2 = add i32 %0, -19968
%3 = icmp ult i32 %2, 20902
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ runtimeError(char *);
int *ivector(long nl, long nh) {
  int *v;
  v = (int *)malloc((size_t)((nh - nl + 1 + 1) * sizeof(int)));
  if (!v)
    runtimeError("allocation failure in ivector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x1,%rdi
add    $0x1,%rdi
shl    $0x2,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1164 <ivector+0x44>
lea    0xea1(%rip),%rdi
call   1040 <runtimeError@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %rdi,%rsi
lea    0x8(,%rsi,4),%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <ivector+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <runtimeError@plt>
shl    $0x2,%r14
sub    %r14,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 1
%10 = add nsw i64 %9, 1
%11 = mul i64 %10, 4
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %5
%14 = load i32*, i32** %5
%15 = icmp ne i32* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 @runtimeError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %2
%19 = load i32*, i32** %5
%20 = load i64, i64* %3
%21 = sub i64 0, %20
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = getelementptr inbounds i32, i32* %22, i64 1
ret i32* %23
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in ivector()\00"
define i32* @ivector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 2
%5 = add i64 %4, 8
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @runtimeError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to i32*
%12 = sub i64 0, %0
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = getelementptr inbounds i32, i32* %13, i64 1
ret i32* %14
}
unsigned long b_disk_write(void *mem, unsigned long start, unsigned long num,
                           unsigned long disknum) {
  unsigned long tlong = 0;
  asm volatile("call *0x00100038"
               : "=c"(tlong)
               : "a"(start), "c"(num), "d"(disknum), "S"(mem));
  return tlong;
}


x86 assembly (clang, -O0):
<b_disk_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rsi
call   *0x100038
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_disk_write>:
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rax
mov    %r8,%rdx
mov    %rdi,%rsi
call   *0x100038
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @b_disk_write(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
store i64 0, i64* %9
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i64, i64* %8
%13 = load i8*, i8** %5
%14 = call i64 asm sideeffect "call *0x00100038", "={cx},{ax},{cx},{dx},{si},~{dirflag},~{fpsr},~{flags}"(i64 %10, i64 %11, i64 %12, i8* %13)
store i64 %14, i64* %9
%15 = load i64, i64* %9
ret i64 %15
}

LLVM IR (-O2):
define i64 @b_disk_write(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i64 asm sideeffect "call *0x00100038", "={cx},{ax},{cx},{dx},{si},~{dirflag},~{fpsr},~{flags}"(i64 %1, i64 %2, i64 %3, i8* %0)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
char bar(char c) {
  printf("Input character is %c. Output is ", c);
  return 'b';
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
mov    $0x62,%al
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x62,%al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Input character is %c. Output is \00"
define signext i8 @bar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %3)
ret i8 98
}

LLVM IR (-O2):
@.str = [34 x i8] c"Input character is %c. Output is \00"
define signext i8 @bar(i8 signext %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 signext %0)
ret i8 98
}
/* Variables and functions */
int /*<<< orphan*/ displayBgInfo();
void bgRefresh(void) { displayBgInfo(); }


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

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

LLVM IR (-O0):
define void @bgRefresh() {
%1 = call i32 (...) @displayBgInfo()
ret void
}

LLVM IR (-O2):
define void @bgRefresh() {
%1 = tail call i32 (...) @displayBgInfo()
ret void
}
/* Type definitions */
struct flashctx {
  int dummy;
};

/* Variables and functions */
int printlock_regspace2_uniform_64k(struct flashctx *);
int printlock_w39v040a(struct flashctx *);
int printlock_w39v040fa(struct flashctx *flash) {
  int ret = 0;
  ret = printlock_w39v040a(flash);
  ret |= printlock_regspace2_uniform_64k(flash);
  return ret;
}


x86 assembly (clang, -O0):
<printlock_w39v040fa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <printlock_w39v040a@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <printlock_regspace2_uniform_64k@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printlock_w39v040fa>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <printlock_w39v040a@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <printlock_regspace2_uniform_64k@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.flashctx = type { i32 }
define i32 @printlock_w39v040fa(%struct.flashctx* %0) {
%2 = alloca %struct.flashctx*
%3 = alloca i32
store %struct.flashctx* %0, %struct.flashctx** %2
store i32 0, i32* %3
%4 = load %struct.flashctx*, %struct.flashctx** %2
%5 = call i32 @printlock_w39v040a(%struct.flashctx* %4)
store i32 %5, i32* %3
%6 = load %struct.flashctx*, %struct.flashctx** %2
%7 = call i32 @printlock_regspace2_uniform_64k(%struct.flashctx* %6)
%8 = load i32, i32* %3
%9 = or i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
%struct.flashctx = type { i32 }
define i32 @printlock_w39v040fa(%struct.flashctx* %0) {
%2 = tail call i32 @printlock_w39v040a(%struct.flashctx* %0)
%3 = tail call i32 @printlock_regspace2_uniform_64k(%struct.flashctx* %0)
%4 = or i32 %3, %2
ret i32 %4
}
void gpio_sensor_inactive(unsigned int csi) {}


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

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

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

LLVM IR (-O2):
define void @gpio_sensor_inactive(i32 %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void rtcp_xr_set_length(uint8_t *p_rtcp_xr_b, uint16_t length) {
  p_rtcp_xr_b[2] = length >> 8;
  p_rtcp_xr_b[3] = length & 0xff;
}


x86 assembly (clang, -O0):
<rtcp_xr_set_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtcp_xr_set_length>:
movzbl %sil,%eax
sar    $0x8,%esi
mov    %esi,0x8(%rdi)
mov    %eax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @rtcp_xr_set_length(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 8
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = and i32 %9, 255
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 3
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @rtcp_xr_set_length(i32* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %3, i32* %4
%5 = and i32 %1, 255
%6 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %5, i32* %6
ret void
}
void gsl_utils_placeholder(void) {
  int i = 0;
  i++;
}


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

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

LLVM IR (-O0):
define void @gsl_utils_placeholder() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
ret void
}

LLVM IR (-O2):
define void @gsl_utils_placeholder() {
ret void
}
void test7() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_poly1305_add(uintptr_t, uintptr_t, uintptr_t);
void fiat_poly1305_add(uint32_t out1[5], const uint32_t arg1[5],
                       const uint32_t arg2[5]) {
  internal_fiat_poly1305_add((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2);
}


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

x86 assembly (clang, -O2):
<fiat_poly1305_add>:
jmp    1030 <internal_fiat_poly1305_add@plt>

LLVM IR (-O0):
define void @fiat_poly1305_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** %4
%8 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_poly1305_add(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_poly1305_add(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_poly1305_add(i64 %4, i64 %5, i64 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
main() { echo("Main, yo!"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"Main, yo!\00"
define i32 @main() {
%1 = call i32 @echo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"Main, yo!\00"
define i32 @main() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned char inb(unsigned short port) {
  unsigned char rega;
  __asm__ __volatile__("inb %1,%0" : "=a"(rega) : "Nd"(port));
  return rega;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm sideeffect "inb $1,$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb $1,$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
tinfoclose() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @tinfoclose() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sendBit(int, int);
void sendPair(int pin, int b) {
  if (b) {
    sendBit(pin, (1 == 1));
    sendBit(pin, (!(1 == 1)));
  } else {
    sendBit(pin, (!(1 == 1)));
    sendBit(pin, (1 == 1));
  }
}


x86 assembly (clang, -O0):
<sendPair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1144 <sendPair+0x34>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <sendBit@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <sendBit@plt>
jmp    115b <sendPair+0x4b>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <sendBit@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <sendBit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendPair>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
test   %esi,%esi
sete   %bpl
setne  %al
mov    %eax,%esi
call   1030 <sendBit@plt>
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <sendBit@plt>

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

LLVM IR (-O2):
define void @sendPair(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
%6 = zext i1 %3 to i32
%7 = tail call i32 @sendBit(i32 %0, i32 %5)
%8 = tail call i32 @sendBit(i32 %0, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int execve(const char *path, char *const argv[], char *const envp[]) {
  fprintf(stderr, "ERROR: execve is unsupported!\n");
  fprintf(stderr, "Tried to execute '%s' with arg0 '%s'\n", path, *argv);
  abort();
}


x86 assembly (clang, -O0):
<execve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<execve>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2eae(%rip),%r15
mov    (%r15),%edi
lea    0xec4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
mov    (%rbx),%rcx
lea    0xecf(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"ERROR: execve is unsupported!\0A\00"
@.str.1 = [38 x i8] c"Tried to execute '%s' with arg0 '%s'\0A\00"
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %4
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %12)
%14 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"ERROR: execve is unsupported!\0A\00"
@.str.1 = [38 x i8] c"Tried to execute '%s' with arg0 '%s'\0A\00"
define i32 @execve(i8* %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %7)
%9 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ bfree(void *);
void *bmalloc(int);
int /*<<< orphan*/ print_buddy();
void test002() {
  void *p1, *p2;
  p1 = bmalloc(4);
  p2 = bmalloc(13);
  bfree(p1);
  bfree(p2);
  print_buddy();
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <bmalloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0xd,%edi
call   1030 <bmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <bfree@plt>
mov    -0x10(%rbp),%rdi
call   1040 <bfree@plt>
mov    $0x0,%al
call   1050 <print_buddy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1030 <bmalloc@plt>
mov    %rax,%r14
mov    $0xd,%edi
call   1030 <bmalloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <bfree@plt>
mov    %rbx,%rdi
call   1040 <bfree@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <print_buddy@plt>

LLVM IR (-O0):
define void @test002() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @bmalloc(i32 4)
store i8* %3, i8** %1
%4 = call i8* @bmalloc(i32 13)
store i8* %4, i8** %2
%5 = load i8*, i8** %1
%6 = call i32 @bfree(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @bfree(i8* %7)
%9 = call i32 (...) @print_buddy()
ret void
}

LLVM IR (-O2):
define void @test002() {
%1 = tail call i8* @bmalloc(i32 4)
%2 = tail call i8* @bmalloc(i32 13)
%3 = tail call i32 @bfree(i8* %1)
%4 = tail call i32 @bfree(i8* %2)
%5 = tail call i32 (...) @print_buddy()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abs(int /*<<< orphan*/);
int /*<<< orphan*/ foo();
int /*<<< orphan*/ memchr(char *, char, int /*<<< orphan*/);
int /*<<< orphan*/ prefetch();
int /*<<< orphan*/ strrchr_foo(char *, char);
void f(void) {
  foo();
  abs(0);
  strrchr_foo("", '.');
  prefetch();
  memchr("", '.', 0);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <foo@plt>
lea    0xeae(%rip),%rdi
mov    $0x2e,%esi
call   1050 <strrchr_foo@plt>
mov    $0x0,%al
call   1060 <prefetch@plt>
lea    0xe96(%rip),%rdi
mov    $0x2e,%esi
xor    %edx,%edx
call   1030 <memchr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
xor    %eax,%eax
call   1040 <foo@plt>
lea    0xeb1(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1050 <strrchr_foo@plt>
xor    %eax,%eax
call   1060 <prefetch@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
xor    %edx,%edx
pop    %rbx
jmp    1030 <memchr@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @f() {
%1 = call i32 (...) @foo()
%2 = call i32 @abs(i32 0)
%3 = call i32 @strrchr_foo(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8 signext 46)
%4 = call i32 (...) @prefetch()
%5 = call i32 @memchr(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8 signext 46, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @f() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 @strrchr_foo(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8 signext 46)
%3 = tail call i32 (...) @prefetch()
%4 = tail call i32 @memchr(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8 signext 46, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mcal_cpu_nop();
void __usage_fault_handler() {
  for (;;) {
    mcal_cpu_nop();
  }
}


x86 assembly (clang, -O0):
<__usage_fault_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <__usage_fault_handler+0x9>
mov    $0x0,%al
call   1030 <mcal_cpu_nop@plt>
jmp    1119 <__usage_fault_handler+0x9>

x86 assembly (clang, -O2):
<__usage_fault_handler>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <mcal_cpu_nop@plt>
jmp    1120 <__usage_fault_handler+0x10>

LLVM IR (-O0):
define void @__usage_fault_handler() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @mcal_cpu_nop()
br label %1
}

LLVM IR (-O2):
define void @__usage_fault_handler() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @mcal_cpu_nop()
br label %1
}
int HashString(const char *s) {
  int hval = 0;
  while (*s) {
    hval = (hval * 13507 + *s * 197) ^ (hval >> 2);
    s++;
  }
  return hval & 0x7fffffff;
}


x86 assembly (clang, -O0):
<HashString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <HashString+0x4e>
imul   $0x34c3,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
imul   $0xc5,%ecx,%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x2,%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <HashString+0xf>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HashString>:
mov    (%rdi),%cl
test   %cl,%cl
je     1137 <HashString+0x37>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x34c3,%eax,%edx
movsbl %cl,%ecx
imul   $0xc5,%ecx,%ecx
add    %edx,%ecx
sar    $0x2,%eax
xor    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <HashString+0x10>
and    $0x7fffffff,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @HashString(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 13507
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = mul nsw i32 %13, 197
%15 = add nsw i32 %10, %14
%16 = load i32, i32* %3
%17 = ashr i32 %16, 2
%18 = xor i32 %15, %17
store i32 %18, i32* %3
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %4
21: ; preds = %4
%22 = load i32, i32* %3
%23 = and i32 %22, 2147483647
ret i32 %23
}

LLVM IR (-O2):
define i32 @HashString(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %15, %4 ], [ %2, %1 ]
%6 = phi i32 [ %13, %4 ], [ 0, %1 ]
%7 = phi i8* [ %14, %4 ], [ %0, %1 ]
%8 = mul nsw i32 %6, 13507
%9 = sext i8 %5 to i32
%10 = mul nsw i32 %9, 197
%11 = add nsw i32 %10, %8
%12 = ashr i32 %6, 2
%13 = xor i32 %11, %12
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4
%18 = and i32 %13, 2147483647
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 0, %1 ], [ %18, %17 ]
ret i32 %20
}
int isWhitespace(int c) {
  switch (c) {
  case '\t':
  case '\n':
  case '\v':
  case '\f':
  case '\r':
  case ' ':
    return 1;
  }
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @isWhitespace(i32 %0) {
switch i32 %0, label %2 [
i32 9, label %3
i32 10, label %3
i32 11, label %3
i32 12, label %3
i32 13, label %3
i32 32, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
int aa_pro_gen_not(int chan, unsigned char *buf, int len) { return (0); }


x86 assembly (clang, -O0):
<aa_pro_gen_not>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @aa_pro_gen_not(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @aa_pro_gen_not(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int get16(int);
int mcb_size(int mcb) {
  if (mcb < 0)
    return 0;
  return get16(mcb * 16 + 3);
}


x86 assembly (clang, -O0):
<mcb_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1131 <mcb_size+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1142 <mcb_size+0x32>
mov    -0x8(%rbp),%edi
shl    $0x4,%edi
add    $0x3,%edi
call   1030 <get16@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcb_size>:
test   %edi,%edi
js     111f <mcb_size+0xf>
shl    $0x4,%edi
or     $0x3,%edi
jmp    1030 <get16@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @mcb_size(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = shl nsw i32 %0, 4
%5 = or i32 %4, 3
%6 = tail call i32 @get16(i32 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
__attribute__((always_)) uint64_t detexPixel64GetA16(uint64_t pixel) {
  return (pixel & 0xFFFF000000000000) >> 48;
}


x86 assembly (clang, -O0):
<detexPixel64GetA16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xffff000000000000,%rcx
and    %rcx,%rax
shr    $0x30,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<detexPixel64GetA16>:
movslq %edi,%rax
shr    $0x30,%rax
ret

LLVM IR (-O0):
define i32 @detexPixel64GetA16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = and i64 %4, -281474976710656
%6 = lshr i64 %5, 48
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @detexPixel64GetA16(i32 %0) {
%2 = sext i32 %0 to i64
%3 = lshr i64 %2, 48
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void OnLose(void) { printf("You lose!\n"); }


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"You lose!\00"
define void @OnLose() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned char get_Operator_Version(void) { return 0; }


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

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

LLVM IR (-O0):
define zeroext i8 @get_Operator_Version() {
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @get_Operator_Version() {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ do_something();
int /*<<< orphan*/ do_something_else();
int foo(int op) {
  switch (op) {
  case 1: {
    do_something();
    return 0;
  }
  case 2:
    do_something_else();
    return 1;
  case 3:
  case 4:
    break;
  case 5:
    return 3;
  default:
    break;
  }
  return -1;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     118b <foo+0x6b>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <do_something@plt>
movl   $0x0,-0x4(%rbp)
jmp    1197 <foo+0x77>
mov    $0x0,%al
call   1040 <do_something_else@plt>
movl   $0x1,-0x4(%rbp)
jmp    1197 <foo+0x77>
jmp    1190 <foo+0x70>
movl   $0x3,-0x4(%rbp)
jmp    1197 <foo+0x77>
jmp    1190 <foo+0x70>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
cmp    $0x5,%edi
je     113b <foo+0x1b>
cmp    $0x2,%edi
je     1142 <foo+0x22>
cmp    $0x1,%edi
jne    1150 <foo+0x30>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <do_something@plt>
jmp    1155 <foo+0x35>
mov    $0x3,%ebx
jmp    1155 <foo+0x35>
xor    %eax,%eax
call   1040 <do_something_else@plt>
mov    $0x1,%ebx
jmp    1155 <foo+0x35>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %2
i32 2, label %4
i32 5, label %7
]
2: ; preds = %1
%3 = tail call i32 (...) @do_something()
br label %7
4: ; preds = %1
%5 = tail call i32 (...) @do_something_else()
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %4, %2
%8 = phi i32 [ -1, %6 ], [ 1, %4 ], [ 0, %2 ], [ 3, %1 ]
ret i32 %8
}
void set1(int *a) { *a = 1; }


x86 assembly (clang, -O0):
<set1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set1>:
movl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @set1(i32* nocapture writeonly %0) {
store i32 1, i32* %0
ret void
}