xunge/DecIR huggingface dataset:
int gca_search_int(const void *aa, void *bb) {
  const int a = *(const int *)aa;
  const int b = *(int *)bb;
  return (((a) > (b)) - ((b) > (a)));
}


x86 assembly (clang, -O0):
<gca_search_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%ecx
cmp    -0x14(%rbp),%ecx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gca_search_int>:
mov    (%rdi),%ecx
mov    (%rsi),%edx
xor    %eax,%eax
xor    %esi,%esi
cmp    %edx,%ecx
setg   %al
setl   %sil
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gca_search_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
%16 = zext i1 %15 to i32
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @gca_search_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = zext i1 %7 to i32
%9 = icmp sgt i32 %6, %4
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
char *strrchr(char *, char);
char *tcc_basename(char *name) {
  char *p;
  p = strrchr(name, '/');
  if (!p)
    p = name;
  else
    p++;
  return p;
}


x86 assembly (clang, -O0):
<tcc_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <tcc_basename+0x36>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <tcc_basename+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @tcc_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 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
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void die(const char *s) {
  fprintf(stderr, "dmenu_path: %s\n", s);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"dmenu_path: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"dmenu_path: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void setFgcolor(int a) {
  printf("\033[1;%dm", a);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<setFgcolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setFgcolor>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[1;%dm\00"
@stdout = global i32 0
define void @setFgcolor(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[1;%dm\00"
@stdout = global i32 0
define void @setFgcolor(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
int lin_rsk_lo_create();
int init_loopback_raw_socket() { return lin_rsk_lo_create(); }


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

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

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

LLVM IR (-O2):
define i32 @init_loopback_raw_socket() {
%1 = tail call i32 (...) @lin_rsk_lo_create()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ *_mktemp(char *, int /*<<< orphan*/, int *, int);
int mkostemp(char *template, int flags) {
  int fd = -1;
  if (_mktemp(template, 0, &fd, flags) == NULL)
    return -1;
  return fd;
}


x86 assembly (clang, -O0):
<mkostemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
xor    %esi,%esi
lea    -0x18(%rbp),%rdx
call   1030 <_mktemp@plt>
cmp    $0x0,%rax
jne    114e <mkostemp+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <mkostemp+0x44>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkostemp>:
push   %rax
mov    %esi,%ecx
movl   $0xffffffff,0x4(%rsp)
ff
lea    0x4(%rsp),%rdx
xor    %esi,%esi
call   1030 <_mktemp@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @mkostemp(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%5 = call i32* @_mktemp(i8* %0, i32 0, i32* %3, i32 %1)
%6 = icmp eq i32* %5, null
%7 = load i32, i32* %3
%8 = select i1 %6, i32 -1, i32 %7
ret i32 %8
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
struct timespec snap_time() {
  struct timespec t;
  clock_gettime(CLOCK_REALTIME, &t);
  return t;
}


x86 assembly (clang, -O0):
<snap_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snap_time>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @snap_time() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @snap_time() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int respond_with_string(int, char *);
int respond_with_500(int connfd) {
  return respond_with_string(connfd,
                             "<html><body><h3>500 - Error<h3></body></html>");
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <respond_with_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [46 x i8] c"<html><body><h3>500 - Error<h3></body></html>\00"
define i32 @respond_with_500(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @respond_with_string(i32 %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [46 x i8] c"<html><body><h3>500 - Error<h3></body></html>\00"
define i32 @respond_with_500(i32 %0) {
%2 = tail call i32 @respond_with_string(i32 %0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
int iabs(int n) {
  if (n < 0) {
    n *= -1;
  }
  return n;
}


x86 assembly (clang, -O0):
<iabs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1118 <iabs+0x18>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iabs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @iabs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
scalar_t__ fEqual(double, double);
double sin(double);
double sinc(double x) {
  return fEqual(x, 0.0)
             ? 1.0
             : sin(x * 3.14159265358979323846) / (x * 3.14159265358979323846);
}


x86 assembly (clang, -O0):
<sinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1030 <fEqual@plt>
cmp    $0x0,%rax
je     1156 <sinc+0x36>
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    117e <sinc+0x5e>
movsd  0xea2(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movsd  0xe90(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinc>:
push   %rax
xorps  %xmm1,%xmm1
movsd  %xmm0,(%rsp)
call   1030 <fEqual@plt>
test   %rax,%rax
je     113d <sinc+0x1d>
movsd  0xec5(%rip),%xmm0
pop    %rax
ret
movsd  (%rsp),%xmm0
mulsd  0xebe(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sinc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @fEqual(double %3, double 0.000000e+00)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %14
7: ; preds = %1
%8 = load double, double* %2
%9 = fmul double %8, 0x400921FB54442D18
%10 = call double @sin(double %9)
%11 = load double, double* %2
%12 = fmul double %11, 0x400921FB54442D18
%13 = fdiv double %10, %12
br label %14
14: ; preds = %7, %6
%15 = phi double [ 1.000000e+00, %6 ], [ %13, %7 ]
ret double %15
}

LLVM IR (-O2):
define double @sinc(double %0) {
%2 = tail call i64 @fEqual(double %0, double 0.000000e+00)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = fmul double %0, 0x400921FB54442D18
%6 = tail call double @sin(double %5)
%7 = fdiv double %6, %5
br label %8
8: ; preds = %1, %4
%9 = phi double [ %7, %4 ], [ 1.000000e+00, %1 ]
ret double %9
}
void gtk_combo_box_set_wrap_width() {}


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

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

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

LLVM IR (-O2):
define void @gtk_combo_box_set_wrap_width() {
ret void
}
/* Variables and functions */
int bitcount(unsigned int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  unsigned x = 5438;
  printf("b = %d\n", bitcount(x));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"b = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5438, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @bitcount(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"b = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @bitcount(i32 5438)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scrputs(char *);
void csrhome(void) { scrputs("\033[H"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[H\00"
define void @csrhome() {
%1 = call i32 @scrputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[H\00"
define void @csrhome() {
%1 = tail call i32 @scrputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int __aeabi_idivmod(int, int);
int __aeabi_idiv(int a, int b) { return __aeabi_idivmod(a, b); }


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

x86 assembly (clang, -O2):
<__aeabi_idiv>:
jmp    1030 <__aeabi_idivmod@plt>

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

LLVM IR (-O2):
define i32 @__aeabi_idiv(i32 %0, i32 %1) {
%3 = tail call i32 @__aeabi_idivmod(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
char *dtoa(float, int, char *);
char *ftoa(float f, int ndig, char *s) { return dtoa(f, ndig, s); }


x86 assembly (clang, -O0):
<ftoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <dtoa@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftoa>:
jmp    1030 <dtoa@plt>

LLVM IR (-O0):
define i8* @ftoa(float %0, i32 %1, i8* %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i8*
store float %0, float* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load float, float* %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i8* @dtoa(float %7, i32 %8, i8* %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @ftoa(float %0, i32 %1, i8* %2) {
%4 = tail call i8* @dtoa(float %0, i32 %1, i8* %2)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ console_printf(char *, int);
int /*<<< orphan*/ console_show();
int /*<<< orphan*/ msleep(int);
void exit(int code) {
  console_printf("exit(%d)\n", code);
  console_show();
  while (1)
    msleep(100);
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1040 <console_printf@plt>
mov    $0x0,%al
call   1050 <console_show@plt>
mov    $0x64,%edi
call   1030 <msleep@plt>
jmp    1151 <exit+0x21>

x86 assembly (clang, -O2):
<exit>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1040 <console_printf@plt>
xor    %eax,%eax
call   1050 <console_show@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1030 <msleep@plt>
jmp    1150 <exit+0x20>

LLVM IR (-O0):
@.str = [10 x i8] c"exit(%d)\0A\00"
define void @exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @console_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @console_show()
br label %6
6: ; preds = %1, %6
%7 = call i32 @msleep(i32 100)
br label %6
}

LLVM IR (-O2):
@.str = [10 x i8] c"exit(%d)\0A\00"
define void @exit(i32 %0) {
%2 = tail call i32 @console_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @console_show()
br label %4
4: ; preds = %1, %4
%5 = tail call i32 @msleep(i32 100)
br label %4
}
/* Variables and functions */
int IPC_CREAT;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int semget(int, int, int);
int sem_get(int sem_key) {
  int sem_id = semget(sem_key, 1, IPC_CREAT | 0666);
  if (sem_id == -1) {
    printf("sem get failed.\n");
    exit(-1);
  } else {
    printf("sem_id = %d\n", sem_id);
    return sem_id;
  }
}


x86 assembly (clang, -O0):
<sem_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%edx
or     $0x1b6,%edx
mov    $0x1,%esi
call   1030 <semget@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    117c <sem_get+0x4c>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_get>:
push   %rbx
mov    0x2e98(%rip),%rax
mov    $0x1b6,%edx
or     (%rax),%edx
mov    $0x1,%esi
call   1030 <semget@plt>
cmp    $0xffffffff,%eax
je     1174 <sem_get+0x34>
mov    %eax,%ebx
lea    0xe99(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@IPC_CREAT = global i32 0
@.str = [17 x i8] c"sem get failed.\0A\00"
@.str.1 = [13 x i8] c"sem_id = %d\0A\00"
define i32 @sem_get(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @IPC_CREAT
%6 = or i32 %5, 438
%7 = call i32 @semget(i32 %4, i32 1, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %1
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@IPC_CREAT = global i32 0
@.str.1 = [13 x i8] c"sem_id = %d\0A\00"
@str = [16 x i8] c"sem get failed.\00"
define i32 @sem_get(i32 %0) {
%2 = load i32, i32* @IPC_CREAT
%3 = or i32 %2, 438
%4 = tail call i32 @semget(i32 %0, i32 1, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 %4
}
int strleng(char *string) {
  int i = 0;
  while (string[i] != '\0') {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<strleng>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <strleng+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strleng+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strleng>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strleng+0x10>
ret

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

LLVM IR (-O2):
define i32 @strleng(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int xen_must_unplug_nics(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @xen_must_unplug_nics() {
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int);
int set_gamma_constant(double regamma, double imgamma, int precision, int vrb) {
  int fail = 1;
  int *b;
  double c[2];
  c[0] = regamma;
  c[1] = imgamma;
  fail = _ada_use_c2phc(996, &precision, b, c, vrb);
  return fail;
}


x86 assembly (clang, -O0):
<set_gamma_constant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    -0x18(%rbp),%r8d
mov    $0x3e4,%edi
lea    -0x14(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_gamma_constant>:
sub    $0x28,%rsp
mov    %esi,%r8d
mov    %edi,0xc(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rcx
mov    $0x3e4,%edi
call   1030 <_ada_use_c2phc@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @set_gamma_constant(double %0, double %1, i32 %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca [2 x double]
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 1, i32* %9
%12 = load double, double* %5
%13 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
store double %12, double* %13
%14 = load double, double* %6
%15 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 1
store double %14, double* %15
%16 = load i32*, i32** %10
%17 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%18 = load i32, i32* %8
%19 = call i32 @_ada_use_c2phc(i32 996, i32* %7, i32* %16, double* %17, i32 %18)
store i32 %19, i32* %9
%20 = load i32, i32* %9
ret i32 %20
}

LLVM IR (-O2):
define i32 @set_gamma_constant(double %0, double %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca [2 x double]
store i32 %2, i32* %5
%7 = bitcast [2 x double]* %6 to i8*
%8 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
store double %0, double* %8
%9 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 1
store double %1, double* %9
%10 = call i32 @_ada_use_c2phc(i32 996, i32* %5, i32* undef, double* %8, i32 %3)
ret i32 %10
}
/* Type definitions */
struct mm_block {
  int dummy;
};

/* Variables and functions */
void *mm_block_create_insertion(struct mm_block *, int /*<<< orphan*/, size_t);
void *mm_block_create_front(struct mm_block *mb, size_t count) {
  return mm_block_create_insertion(mb, 0, count);
}


x86 assembly (clang, -O0):
<mm_block_create_front>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <mm_block_create_insertion@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_block_create_front>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <mm_block_create_insertion@plt>

LLVM IR (-O0):
%struct.mm_block = type { i32 }
define i8* @mm_block_create_front(%struct.mm_block* %0, i64 %1) {
%3 = alloca %struct.mm_block*
%4 = alloca i64
store %struct.mm_block* %0, %struct.mm_block** %3
store i64 %1, i64* %4
%5 = load %struct.mm_block*, %struct.mm_block** %3
%6 = load i64, i64* %4
%7 = call i8* @mm_block_create_insertion(%struct.mm_block* %5, i32 0, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.mm_block = type { i32 }
define i8* @mm_block_create_front(%struct.mm_block* %0, i64 %1) {
%3 = tail call i8* @mm_block_create_insertion(%struct.mm_block* %0, i32 0, i64 %1)
ret i8* %3
}
/* Type definitions */
typedef int dev_t;

/* Variables and functions */
int major(dev_t dev) { return (dev >> 8) & 0xff; }


x86 assembly (clang, -O0):
<major>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<major>:
mov    %edi,%eax
movzbl %ah,%eax
ret

LLVM IR (-O0):
define i32 @major(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 8
%5 = and i32 %4, 255
ret i32 %5
}

LLVM IR (-O2):
define i32 @major(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 255
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
int /*<<< orphan*/ byte_swap_int(int *, int /*<<< orphan*/);
void byte_swap_uint(uint *buffer, uint number_of_swaps) {
  byte_swap_int((int *)buffer, number_of_swaps);
}


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

x86 assembly (clang, -O2):
<byte_swap_uint>:
jmp    1030 <byte_swap_int@plt>

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

LLVM IR (-O2):
define void @byte_swap_uint(i32* %0, i32 %1) {
%3 = tail call i32 @byte_swap_int(i32* %0, i32 %1)
ret void
}
int main() {
  int a;
  a = 5;
  int b;
  b = 0;
  return a << b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ haraka256_4x(unsigned char *, unsigned char const *);
void haraka256_8x(unsigned char *out, const unsigned char *in) {
  haraka256_4x(out, in);
  haraka256_4x(out + 128, in + 128);
}


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

x86 assembly (clang, -O2):
<haraka256_8x>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <haraka256_4x@plt>
sub    $0xffffffffffffff80,%rbx
sub    $0xffffffffffffff80,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <haraka256_4x@plt>

LLVM IR (-O0):
define void @haraka256_8x(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @haraka256_4x(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 128
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 128
%12 = call i32 @haraka256_4x(i8* %9, i8* %11)
ret void
}

LLVM IR (-O2):
define void @haraka256_8x(i8* %0, i8* %1) {
%3 = tail call i32 @haraka256_4x(i8* %0, i8* %1)
%4 = getelementptr inbounds i8, i8* %0, i64 128
%5 = getelementptr inbounds i8, i8* %1, i64 128
%6 = tail call i32 @haraka256_4x(i8* %4, i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_strcpy(char *, char const *, size_t);
void path_parse(char *buf, size_t max, const char *file) {
  my_strcpy(buf, file, max);
}


x86 assembly (clang, -O0):
<path_parse>:
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    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <my_strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_parse>:
mov    %rsi,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <my_strcpy@plt>

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

LLVM IR (-O2):
define void @path_parse(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 @my_strcpy(i8* %0, i8* %2, i64 %1)
ret void
}
int rand() { return 4; }


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

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

LLVM IR (-O0):
define i32 @rand() {
ret i32 4
}

LLVM IR (-O2):
define i32 @rand() {
ret i32 4
}
void copy_mc_inject_dst(void *addr) {}


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

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

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

LLVM IR (-O2):
define void @copy_mc_inject_dst(i8* nocapture %0) {
ret void
}
/* Variables and functions */
char const *out_get_errormsg();
const char *pmemlog_errormsg(void) { return out_get_errormsg(); }


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

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

LLVM IR (-O0):
define i8* @pmemlog_errormsg() {
%1 = call i8* (...) @out_get_errormsg()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pmemlog_errormsg() {
%1 = tail call i8* (...) @out_get_errormsg()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ inb(int);
int /*<<< orphan*/ outb(int, int);
void reassert_nmi(void) {
  outb(0x8f, 0x70);
  inb(0x71);
  outb(0x0f, 0x70);
  inb(0x71);
}


x86 assembly (clang, -O0):
<reassert_nmi>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8f,%edi
mov    $0x70,%esi
call   1030 <outb@plt>
mov    $0x71,%edi
call   1040 <inb@plt>
mov    $0xf,%edi
mov    $0x70,%esi
call   1030 <outb@plt>
mov    $0x71,%edi
call   1040 <inb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reassert_nmi>:
push   %rax
mov    $0x8f,%edi
mov    $0x70,%esi
call   1030 <outb@plt>
mov    $0x71,%edi
call   1040 <inb@plt>
mov    $0xf,%edi
mov    $0x70,%esi
call   1030 <outb@plt>
mov    $0x71,%edi
pop    %rax
jmp    1040 <inb@plt>

LLVM IR (-O0):
define void @reassert_nmi() {
%1 = call i32 @outb(i32 143, i32 112)
%2 = call i32 @inb(i32 113)
%3 = call i32 @outb(i32 15, i32 112)
%4 = call i32 @inb(i32 113)
ret void
}

LLVM IR (-O2):
define void @reassert_nmi() {
%1 = tail call i32 @outb(i32 143, i32 112)
%2 = tail call i32 @inb(i32 113)
%3 = tail call i32 @outb(i32 15, i32 112)
%4 = tail call i32 @inb(i32 113)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void mailimf_quoted_string_free(char *quoted_string) { free(quoted_string); }


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

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

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

LLVM IR (-O2):
define void @mailimf_quoted_string_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int fls_long(unsigned long);
__attribute__((always_)) __attribute__((const)) unsigned long
__rounddown_pow_of_two(unsigned long n) {
  return 1UL << (fls_long(n) - 1);
}


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

x86 assembly (clang, -O2):
<__rounddown_pow_of_two>:
push   %rax
call   1030 <fls_long@plt>
lea    -0x1(%rax),%ecx
mov    $0x1,%eax
shl    %cl,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @__rounddown_pow_of_two(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @fls_long(i64 %3)
%5 = sub nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = shl i64 1, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @__rounddown_pow_of_two(i64 %0) {
%2 = tail call i32 @fls_long(i64 %0)
%3 = add nsw i32 %2, -1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
ret i64 %5
}
void f4(int *arg) { (*arg)++; }


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

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

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

LLVM IR (-O2):
define void @f4(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void testDec() {
  int a, b;
  a = 3;
  b = a--;
  printf("3-- = %d %d\n", b, a);
}


x86 assembly (clang, -O0):
<testDec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDec>:
lea    0xee9(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"3-- = %d %d\0A\00"
define void @testDec() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 3, i32 2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
unsigned char is_big_endian(void) {
  union {
    uint16_t i;
    char c[2];
  } foo = {0x0100};
  return foo.c[0];
}


x86 assembly (clang, -O0):
<is_big_endian>:
push   %rbp
mov    %rsp,%rbp
mov    0xef6(%rip),%eax
mov    %eax,-0x8(%rbp)
movzbl -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
@__const.is_big_endian.foo = %union.anon { i32 256 }
define zeroext i8 @is_big_endian() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i8*
%3 = bitcast %union.anon* %1 to [2 x i8]*
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %4
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @is_big_endian() {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ print_month_name(int);
int main() {
  int i;
  for (i = 1; i <= 12; i++) {
    print_month_name(i);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xc,-0x8(%rbp)
jg     1146 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <print_month_name@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <print_month_name@plt>
mov    $0x2,%edi
call   1030 <print_month_name@plt>
mov    $0x3,%edi
call   1030 <print_month_name@plt>
mov    $0x4,%edi
call   1030 <print_month_name@plt>
mov    $0x5,%edi
call   1030 <print_month_name@plt>
mov    $0x6,%edi
call   1030 <print_month_name@plt>
mov    $0x7,%edi
call   1030 <print_month_name@plt>
mov    $0x8,%edi
call   1030 <print_month_name@plt>
mov    $0x9,%edi
call   1030 <print_month_name@plt>
mov    $0xa,%edi
call   1030 <print_month_name@plt>
mov    $0xb,%edi
call   1030 <print_month_name@plt>
mov    $0xc,%edi
call   1030 <print_month_name@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_month_name(i32 1)
%2 = tail call i32 @print_month_name(i32 2)
%3 = tail call i32 @print_month_name(i32 3)
%4 = tail call i32 @print_month_name(i32 4)
%5 = tail call i32 @print_month_name(i32 5)
%6 = tail call i32 @print_month_name(i32 6)
%7 = tail call i32 @print_month_name(i32 7)
%8 = tail call i32 @print_month_name(i32 8)
%9 = tail call i32 @print_month_name(i32 9)
%10 = tail call i32 @print_month_name(i32 10)
%11 = tail call i32 @print_month_name(i32 11)
%12 = tail call i32 @print_month_name(i32 12)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ vsyslog(int /*<<< orphan*/, char const *,
                           int /*<<< orphan*/);
void wmlog_syslog(const char *fmt, va_list va) { vsyslog(LOG_INFO, fmt, va); }


x86 assembly (clang, -O0):
<wmlog_syslog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vsyslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmlog_syslog>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vsyslog@plt>

LLVM IR (-O0):
@LOG_INFO = global i32 0
define void @wmlog_syslog(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @LOG_INFO
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vsyslog(i32 %5, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@LOG_INFO = global i32 0
define void @wmlog_syslog(i8* %0, i32 %1) {
%3 = load i32, i32* @LOG_INFO
%4 = tail call i32 @vsyslog(i32 %3, i8* %0, i32 %1)
ret void
}
void UI_set_method(void) {}


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

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

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

LLVM IR (-O2):
define void @UI_set_method() {
ret void
}
unsigned short inw_p(unsigned short port) {
  unsigned short _v;
  __asm__ __volatile__("in"
                       "w"
                       " %"
                       "w"
                       "1,%"
                       ""
                       "0"
                       : "=a"(_v)
                       : "Nd"(port));
  slow_down_io();
  return _v;
}


x86 assembly (clang, -O0):
<inw_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <slow_down_io@plt>
movzwl -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw_p>:
push   %rbx
mov    %edi,%edx
in     (%dx),%ax
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <slow_down_io@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define zeroext i16 @inw_p(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
%3 = tail call i32 (...) @slow_down_io()
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long long,
                           unsigned long long);
int /*<<< orphan*/ stderr;
void docheck(unsigned long long a, unsigned long long expect) {
  if (a != expect) {
    fprintf(stderr, "check failed: expected 0x%llx, got 0x%llx\n", expect, a);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<docheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1165 <docheck+0x45>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<docheck>:
cmp    %rsi,%rdi
jne    1126 <docheck+0x6>
ret
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rcx
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"check failed: expected 0x%llx, got 0x%llx\0A\00"
define void @docheck(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i64, i64* %4
%11 = load i64, i64* %3
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i64 %10, i64 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"check failed: expected 0x%llx, got 0x%llx\0A\00"
define void @docheck(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i64 %1, i64 %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
unsigned short _ushort(unsigned short x) { return x; }


x86 assembly (clang, -O0):
<_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ushort>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define zeroext i16 @_ushort(i16 returned zeroext %0) {
ret i16 %0
}
/* Variables and functions */
char const *name_get(int, int);
const char *srv_name(int task, int cpu) { return name_get(task, cpu); }


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

x86 assembly (clang, -O2):
<srv_name>:
jmp    1030 <name_get@plt>

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

LLVM IR (-O2):
define i8* @srv_name(i32 %0, i32 %1) {
%3 = tail call i8* @name_get(i32 %0, i32 %1)
ret i8* %3
}