xunge/DecIR huggingface dataset:
void parse_message(struct TCPRECORD *sess, struct NetFrame *frame,
                   const unsigned char *px, unsigned length) {
  sess = (sess);
  frame = (frame);
  px = (px);
  length = (length);
}


x86 assembly (clang, -O0):
<parse_message>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.TCPRECORD = type opaque
%struct.NetFrame = type opaque
define void @parse_message(%struct.TCPRECORD* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = alloca %struct.TCPRECORD*
%6 = alloca %struct.NetFrame*
%7 = alloca i8*
%8 = alloca i32
store %struct.TCPRECORD* %0, %struct.TCPRECORD** %5
store %struct.NetFrame* %1, %struct.NetFrame** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct.TCPRECORD*, %struct.TCPRECORD** %5
store %struct.TCPRECORD* %9, %struct.TCPRECORD** %5
%10 = load %struct.NetFrame*, %struct.NetFrame** %6
store %struct.NetFrame* %10, %struct.NetFrame** %6
%11 = load i8*, i8** %7
store i8* %11, i8** %7
%12 = load i32, i32* %8
store i32 %12, i32* %8
ret void
}

LLVM IR (-O2):
%struct.TCPRECORD = type opaque
%struct.NetFrame = type opaque
define void @parse_message(%struct.TCPRECORD* nocapture %0, %struct.NetFrame* nocapture %1, i8* nocapture %2, i32 %3) {
ret void
}
OP(ed, d1) { illegal_2(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Type definitions */
typedef int fpu_control_t;
typedef int /*<<< orphan*/ fenv_t;

/* Variables and functions */
int FE_ALL_EXCEPT;
int /*<<< orphan*/ _FPU_GETCW(int);
int /*<<< orphan*/ feraiseexcept(int);
int /*<<< orphan*/ fesetenv(int /*<<< orphan*/ const *);
int feupdateenv(const fenv_t *envp) {
  fpu_control_t temp;
  _FPU_GETCW(temp);
  temp = (temp & FE_ALL_EXCEPT);
  fesetenv(envp);
  feraiseexcept((int)temp);
  return 0;
}


x86 assembly (clang, -O0):
<feupdateenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <_FPU_GETCW@plt>
mov    -0xc(%rbp),%eax
mov    0x2e92(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fesetenv@plt>
mov    -0xc(%rbp),%edi
call   1040 <feraiseexcept@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<feupdateenv>:
push   %rbx
mov    %rdi,%rbx
call   1030 <_FPU_GETCW@plt>
mov    %rbx,%rdi
call   1050 <fesetenv@plt>
xor    %edi,%edi
call   1040 <feraiseexcept@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@FE_ALL_EXCEPT = global i32 0
define i32 @feupdateenv(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @_FPU_GETCW(i32 %4)
%6 = load i32, i32* %3
%7 = load i32, i32* @FE_ALL_EXCEPT
%8 = and i32 %6, %7
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = call i32 @fesetenv(i32* %9)
%11 = load i32, i32* %3
%12 = call i32 @feraiseexcept(i32 %11)
ret i32 0
}

LLVM IR (-O2):
@FE_ALL_EXCEPT = global i32 0
define i32 @feupdateenv(i32* %0) {
%2 = tail call i32 @_FPU_GETCW(i32 undef)
%3 = tail call i32 @fesetenv(i32* %0)
%4 = tail call i32 @feraiseexcept(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(int *, int, int /*<<< orphan*/);
int main() {
  int *p;
  p = (int *)malloc(1000000 * sizeof(int));
  memset(p, 1000000 * sizeof(int), 0);
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3d0900,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3d0900,%esi
xor    %edx,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3d0900,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x3d0900,%esi
xor    %edx,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 4000000)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @memset(i32* %5, i32 4000000, i32 0)
%7 = load i32*, i32** %2
%8 = call i32 @free(i32* %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 4000000)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 @memset(i32* %2, i32 4000000, i32 0)
%4 = tail call i32 @free(i32* %2)
ret i32 0
}
/* Variables and functions */
int *f();
int main(void) {
  int *p = f();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* (...) @f()
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ Airton(int, int, int, int);
int main(int arc, char **argv) {
  uint8_t power = 0x24;
  uint8_t mode = 0x02;
  uint8_t temperature = 0x07;
  uint8_t flowControl = 0x38;
  Airton(power, mode, temperature, flowControl);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x24,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0x7,-0x1c(%rbp)
movl   $0x38,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1030 <Airton@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x24,%edi
mov    $0x2,%esi
mov    $0x7,%edx
mov    $0x38,%ecx
call   1030 <Airton@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 36, i32* %6
store i32 2, i32* %7
store i32 7, i32* %8
store i32 56, i32* %9
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = load i32, i32* %9
%14 = call i32 @Airton(i32 %10, i32 %11, i32 %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @Airton(i32 36, i32 2, i32 7, i32 56)
ret i32 0
}
/* Variables and functions */
char *pipe2string(char *);
char *timlib_tmpfile(void) { return pipe2string("tmpfile.py"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"tmpfile.py\00"
define i8* @timlib_tmpfile() {
%1 = call i8* @pipe2string(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [11 x i8] c"tmpfile.py\00"
define i8* @timlib_tmpfile() {
%1 = tail call i8* @pipe2string(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
double ILLutil_zeit(void) { return 0.0; }


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

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

LLVM IR (-O0):
define double @ILLutil_zeit() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @ILLutil_zeit() {
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, char *argv[]) {
  unsigned int arc4random();
  int i;
  for (i = 0; i < 50; i++) {
    printf("%u\n", arc4random());
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jge    116a <main+0x4a>
mov    $0x0,%al
call   1030 <arc4random@plt>
mov    %eax,%esi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x32,%ebp
lea    0xed1(%rip),%rbx
nop
xor    %eax,%eax
call   1030 <arc4random@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %7, %3 ]
%5 = tail call i32 (...) @arc4random()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 50
br i1 %8, label %9, label %3
9: ; preds = %3
ret i32 0
}
void gp2x_init() {}


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

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

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

LLVM IR (-O2):
define void @gp2x_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int send_to_server(int sockfd, char *irc_message) {
  int nbytes;
  if ((nbytes = send(sockfd, irc_message, strlen(irc_message), 0)) < 0) {
    perror("send_to_server");
    exit(EXIT_FAILURE);
  }
  return nbytes;
}


x86 assembly (clang, -O0):
<send_to_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    119c <send_to_server+0x5c>
lea    0xe77(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_to_server>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
test   %eax,%eax
js     1169 <send_to_server+0x29>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe90(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"send_to_server\00"
@EXIT_FAILURE = global i32 0
define i32 @send_to_server(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @send(i32 %6, i8* %7, i32 %9, i32 0)
store i32 %10, i32* %5
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@.str = [15 x i8] c"send_to_server\00"
@EXIT_FAILURE = global i32 0
define i32 @send_to_server(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i32 %4
}
unsigned long b_file_open(const unsigned char *name) {
  unsigned long tlong;
  asm volatile("call *0x00100070" : "=a"(tlong) : "S"(name));
  return tlong;
}


x86 assembly (clang, -O0):
<b_file_open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
call   *0x100070
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_file_open>:
mov    %rdi,%rsi
call   *0x100070
ret

LLVM IR (-O0):
define i64 @b_file_open(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 asm sideeffect "call *0x00100070", "={ax},{si},~{dirflag},~{fpsr},~{flags}"(i8* %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @b_file_open(i8* %0) {
%2 = tail call i64 asm sideeffect "call *0x00100070", "={ax},{si},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i64 %2
}
/* Variables and functions */
int LongNoSwap(int l) { return l; }


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

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

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

LLVM IR (-O2):
define i32 @LongNoSwap(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
struct rq_currency_flow {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rq_currency_flow *);
int /*<<< orphan*/ rq_currency_flow_clear(struct rq_currency_flow *);
void rq_currency_flow_free(struct rq_currency_flow *p) {
  rq_currency_flow_clear(p);
  free(p);
}


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

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

LLVM IR (-O0):
%struct.rq_currency_flow = type { i32 }
define void @rq_currency_flow_free(%struct.rq_currency_flow* %0) {
%2 = alloca %struct.rq_currency_flow*
store %struct.rq_currency_flow* %0, %struct.rq_currency_flow** %2
%3 = load %struct.rq_currency_flow*, %struct.rq_currency_flow** %2
%4 = call i32 @rq_currency_flow_clear(%struct.rq_currency_flow* %3)
%5 = load %struct.rq_currency_flow*, %struct.rq_currency_flow** %2
%6 = call i32 @free(%struct.rq_currency_flow* %5)
ret void
}

LLVM IR (-O2):
%struct.rq_currency_flow = type { i32 }
define void @rq_currency_flow_free(%struct.rq_currency_flow* %0) {
%2 = tail call i32 @rq_currency_flow_clear(%struct.rq_currency_flow* %0)
%3 = tail call i32 @free(%struct.rq_currency_flow* %0)
ret void
}
/* Variables and functions */
int foo(int);
int bar(int a) { return 1 + 1 + foo(a); }


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

x86 assembly (clang, -O2):
<bar>:
push   %rax
call   1030 <foo@plt>
add    $0x2,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = tail call i32 @foo(i32 %0)
%3 = add nsw i32 %2, 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ CommonFree(void *);
void HoloStor_TableFree(void *p) { CommonFree(p); }


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

x86 assembly (clang, -O2):
<HoloStor_TableFree>:
jmp    1030 <CommonFree@plt>

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

LLVM IR (-O2):
define void @HoloStor_TableFree(i8* %0) {
%2 = tail call i32 @CommonFree(i8* %0)
ret void
}
double scaling_math(double input, double origin, double factor) {
  return origin + (input - origin) * factor;
}


x86 assembly (clang, -O0):
<scaling_math>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<scaling_math>:
subsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @scaling_math(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fsub double %8, %9
%11 = load double, double* %6
%12 = call double @llvm.fmuladd.f64(double %10, double %11, double %7)
ret double %12
}

LLVM IR (-O2):
define double @scaling_math(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %1)
ret double %5
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ socketcall_cp(int /*<<< orphan*/ (*)(int, void *, size_t,
                                                        int, struct sockaddr *,
                                                        int /*<<< orphan*/ *),
                                 int, void *, size_t, int, struct sockaddr *,
                                 int /*<<< orphan*/ *);
ssize_t recvfrom(int fd, void *buf, size_t len, int flags,
                 struct sockaddr *addr, socklen_t *alen) {
  return socketcall_cp(recvfrom, fd, buf, len, flags, addr, alen);
}


x86 assembly (clang, -O0):
<recvfrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    0x2e9c(%rip),%rdi
mov    %rax,(%rsp)
call   1030 <socketcall_cp@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recvfrom>:
push   %rax
mov    %r8,%rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    %r9,(%rsp)
mov    0x2ebe(%rip),%rdi
mov    %rax,%r9
call   1030 <socketcall_cp@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @recvfrom(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.sockaddr*
%12 = alloca i32*
store i32 %0, i32* %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store %struct.sockaddr* %4, %struct.sockaddr** %11
store i32* %5, i32** %12
%13 = load i32, i32* %7
%14 = load i8*, i8** %8
%15 = load i64, i64* %9
%16 = load i32, i32* %10
%17 = load %struct.sockaddr*, %struct.sockaddr** %11
%18 = load i32*, i32** %12
%19 = call i32 @socketcall_cp(i32 (i32, i8*, i64, i32, %struct.sockaddr*, i32*)* @recvfrom, i32 %13, i8* %14, i64 %15, i32 %16, %struct.sockaddr* %17, i32* %18)
ret i32 %19
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @recvfrom(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5) {
%7 = tail call i32 @socketcall_cp(i32 (i32, i8*, i64, i32, %struct.sockaddr*, i32*)* @recvfrom, i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32* %5)
ret i32 %7
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ w_abort(char *, char *);
void *ckalloc(size_t amount) {
  void *p;
  if ((p = (void *)malloc((size_t)amount)) == NULL)
    w_abort("Ran out of memory.", "");
  return (p);
}


x86 assembly (clang, -O0):
<ckalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1156 <ckalloc+0x36>
lea    0xeb6(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1040 <w_abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <ckalloc+0x21>
lea    0xecb(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1040 <w_abort@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Ran out of memory.\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @ckalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @malloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @w_abort(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [19 x i8] c"Ran out of memory.\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @ckalloc(i64 %0) {
%2 = tail call i64 @malloc(i64 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @w_abort(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = inttoptr i64 %2 to i8*
ret i8* %7
}
void Toggle(int *x) {
  if (*x == 0) {
    *x = 1;
  } else {
    *x = 0;
  }
  return;
}


x86 assembly (clang, -O0):
<Toggle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1124 <Toggle+0x24>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    112e <Toggle+0x2e>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Toggle>:
xor    %eax,%eax
cmpl   $0x0,(%rdi)
sete   %al
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @Toggle(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
store i32 %4, i32* %0
ret void
}
int mod(int a, int b) {
  if (b < 0) {
    a = -a;
    b = -b;
  }
  int ret = a % b;
  return (ret < 0) ? ret + b : ret;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1124 <mod+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1146 <mod+0x46>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    114c <mod+0x4c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
mov    %edi,%eax
neg    %eax
mov    %esi,%ecx
neg    %ecx
cmovs  %esi,%ecx
test   %esi,%esi
cmovns %edi,%eax
cltd
idiv   %ecx
mov    %edx,%eax
sar    $0x1f,%eax
and    %ecx,%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 0
%4 = sub nsw i32 0, %0
%5 = sub nsw i32 0, %1
%6 = select i1 %3, i32 %5, i32 %1
%7 = select i1 %3, i32 %4, i32 %0
%8 = srem i32 %7, %6
%9 = icmp slt i32 %8, 0
%10 = select i1 %9, i32 %6, i32 0
%11 = add nsw i32 %10, %8
ret i32 %11
}
int scan_ppa_idx(int row, int blkid) { return (row * 2) + blkid; }


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

x86 assembly (clang, -O2):
<scan_ppa_idx>:
lea    (%rsi,%rdi,2),%eax
ret

LLVM IR (-O0):
define i32 @scan_ppa_idx(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 = mul nsw i32 %5, 2
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @scan_ppa_idx(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = add nsw i32 %3, %1
ret i32 %4
}
int config_CS_CACHEEX(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @config_CS_CACHEEX() {
ret i32 0
}
float _fmin(float a, float b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<_fmin>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <_fmin+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <_fmin+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fmin>:
minss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @_fmin(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @_fmin(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
float cycle_constrain_angle(float x, float xmin, float xmax) {
  while (x < xmin) {
    x = x + xmax;
  }
  while (x >= xmax) {
    x = x - xmax;
  }
  return x;
}


x86 assembly (clang, -O0):
<cycle_constrain_angle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    113a <cycle_constrain_angle+0x3a>
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1113 <cycle_constrain_angle+0x13>
jmp    113f <cycle_constrain_angle+0x3f>
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     1162 <cycle_constrain_angle+0x62>
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    113f <cycle_constrain_angle+0x3f>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cycle_constrain_angle>:
ucomiss %xmm0,%xmm1
jbe    1124 <cycle_constrain_angle+0x24>
cs nopw 0x0(%rax,%rax,1)
nop
addss  %xmm2,%xmm0
ucomiss %xmm0,%xmm1
ja     1110 <cycle_constrain_angle+0x10>
jmp    1124 <cycle_constrain_angle+0x24>
nopl   0x0(%rax,%rax,1)
subss  %xmm2,%xmm0
ucomiss %xmm2,%xmm0
jae    1120 <cycle_constrain_angle+0x20>
ret

LLVM IR (-O0):
define float @cycle_constrain_angle(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
br label %7
7: ; preds = %11, %3
%8 = load float, float* %4
%9 = load float, float* %5
%10 = fcmp olt float %8, %9
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load float, float* %4
%13 = load float, float* %6
%14 = fadd float %12, %13
store float %14, float* %4
br label %7
15: ; preds = %7
br label %16
16: ; preds = %20, %15
%17 = load float, float* %4
%18 = load float, float* %6
%19 = fcmp oge float %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load float, float* %4
%22 = load float, float* %6
%23 = fsub float %21, %22
store float %23, float* %4
br label %16
24: ; preds = %16
%25 = load float, float* %4
ret float %25
}

LLVM IR (-O2):
define float @cycle_constrain_angle(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
br i1 %4, label %8, label %5
5: ; preds = %8, %3
%6 = phi float [ %0, %3 ], [ %10, %8 ]
%7 = fcmp ult float %6, %2
br i1 %7, label %16, label %12
8: ; preds = %3, %8
%9 = phi float [ %10, %8 ], [ %0, %3 ]
%10 = fadd float %9, %2
%11 = fcmp olt float %10, %1
br i1 %11, label %8, label %5
12: ; preds = %5, %12
%13 = phi float [ %14, %12 ], [ %6, %5 ]
%14 = fsub float %13, %2
%15 = fcmp ult float %14, %2
br i1 %15, label %16, label %12
16: ; preds = %12, %5
%17 = phi float [ %6, %5 ], [ %14, %12 ]
ret float %17
}
int fun204() { return 204; }


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

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

LLVM IR (-O0):
define i32 @fun204() {
ret i32 204
}

LLVM IR (-O2):
define i32 @fun204() {
ret i32 204
}
void ndb_osdep_init() { ; }


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

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

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

LLVM IR (-O2):
define void @ndb_osdep_init() {
ret void
}
int bsp_get_pintrl(unsigned int type, unsigned int gpio, unsigned int *value) {
  return -1;
}


x86 assembly (clang, -O0):
<bsp_get_pintrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bsp_get_pintrl(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
ret i32 -1
}

LLVM IR (-O2):
define i32 @bsp_get_pintrl(i32 %0, i32 %1, i32* nocapture readnone %2) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int help(char *bin, int e) {
  if (e == 1)
    fprintf(stderr, "usage: %s [rpn syntax calculation]\n", bin);
  else if (e == 2)
    fprintf(stderr, "%s: invalid stack\n", bin);
  return e;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1147 <help+0x37>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
jmp    116f <help+0x5f>
cmpl   $0x2,-0xc(%rbp)
jne    116a <help+0x5a>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
jmp    116f <help+0x5f>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
cmp    $0x1,%esi
je     1129 <help+0x19>
cmp    $0x2,%ebx
jne    113e <help+0x2e>
lea    0xefd(%rip),%rsi
jmp    1130 <help+0x20>
lea    0xed0(%rip),%rsi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"usage: %s [rpn syntax calculation]\0A\00"
@.str.1 = [19 x i8] c"%s: invalid stack\0A\00"
define i32 @help(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %3
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %19
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %14, %11
br label %19
19: ; preds = %18, %7
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"usage: %s [rpn syntax calculation]\0A\00"
@.str.1 = [19 x i8] c"%s: invalid stack\0A\00"
define i32 @help(i8* %0, i32 returned %1) {
switch i32 %1, label %8 [
i32 1, label %4
i32 2, label %3
]
3: ; preds = %2
br label %4
4: ; preds = %2, %3
%5 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %2 ]
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* %5, i8* %0)
br label %8
8: ; preds = %4, %2
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3_int64;
typedef int /*<<< orphan*/ sqlite3_file;

/* Variables and functions */
int SQLITE_OK;
int memUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage) {
  return SQLITE_OK;
}


x86 assembly (clang, -O0):
<memUnfetch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@SQLITE_OK = global i32 0
define i32 @memUnfetch(i32* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @SQLITE_OK
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void do_regular_work(void) {
  printf("SuperSleep version 1.0 Running - License Software\n");
  sleep(10);
}


x86 assembly (clang, -O0):
<do_regular_work>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_regular_work>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"SuperSleep version 1.0 Running - License Software\0A\00"
define void @do_regular_work() {
%1 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @sleep(i32 10)
ret void
}

LLVM IR (-O2):
@str = [50 x i8] c"SuperSleep version 1.0 Running - License Software\00"
define void @do_regular_work() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @sleep(i32 10)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t ts_get_pid(const uint8_t *p_ts) {
  return ((p_ts[1] & 0x1f) << 8) | p_ts[2];
}


x86 assembly (clang, -O0):
<ts_get_pid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x1f,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x8(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_get_pid>:
mov    0x4(%rdi),%eax
and    $0x1f,%eax
shl    $0x8,%eax
or     0x8(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @ts_get_pid(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = and i32 %4, 7936
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = or i32 %5, %7
ret i32 %8
}
char HexChar(int i) { return (i < 10) ? '0' + i : 'a' + i - 10; }


x86 assembly (clang, -O0):
<HexChar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    111f <HexChar+0x1f>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    112b <HexChar+0x2b>
mov    -0x4(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HexChar>:
lea    0x57(%rdi),%ecx
lea    0x30(%rdi),%eax
cmp    $0xa,%edi
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @HexChar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = add nsw i32 48, %6
br label %12
8: ; preds = %1
%9 = load i32, i32* %2
%10 = add nsw i32 97, %9
%11 = sub nsw i32 %10, 10
br label %12
12: ; preds = %8, %5
%13 = phi i32 [ %7, %5 ], [ %11, %8 ]
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @HexChar(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = select i1 %2, i32 48, i32 87
%4 = add nsw i32 %3, %0
%5 = trunc i32 %4 to i8
ret i8 %5
}
char trailing_escape(const char *const s, int len) {
  char parity = 0;
  while (--len >= 0 && s[len] == '\\')
    parity = !parity;
  return parity;
}


x86 assembly (clang, -O0):
<trailing_escape>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
mov    -0xc(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xe(%rbp)
jl     113b <trailing_escape+0x3b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
sete   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    114b <trailing_escape+0x4b>
jmp    1161 <trailing_escape+0x61>
cmpb   $0x0,-0xd(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0xd(%rbp)
jmp    110f <trailing_escape+0xf>
movsbl -0xd(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trailing_escape>:
test   %esi,%esi
jle    1128 <trailing_escape+0x28>
mov    %esi,%ecx
add    $0x1,%rcx
add    $0xffffffff,%esi
xor    %eax,%eax
nop
mov    %esi,%edx
cmpb   $0x5c,(%rdi,%rdx,1)
jne    1127 <trailing_escape+0x27>
xor    $0x1,%al
add    $0xffffffffffffffff,%rcx
add    $0xffffffff,%esi
cmp    $0x1,%rcx
jg     1110 <trailing_escape+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @trailing_escape(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8 0, i8* %5
br label %6
6: ; preds = %20, %2
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 92
br label %18
18: ; preds = %10, %6
%19 = phi i1 [ false, %6 ], [ %17, %10 ]
br i1 %19, label %20, label %26
20: ; preds = %18
%21 = load i8, i8* %5
%22 = icmp ne i8 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
%25 = trunc i32 %24 to i8
store i8 %25, i8* %5
br label %6
26: ; preds = %18
%27 = load i8, i8* %5
ret i8 %27
}

LLVM IR (-O2):
define signext i8 @trailing_escape(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %15
%7 = phi i64 [ %5, %4 ], [ %18, %15 ]
%8 = phi i32 [ %1, %4 ], [ %10, %15 ]
%9 = phi i8 [ 0, %4 ], [ %16, %15 ]
%10 = add nsw i32 %8, -1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 92
br i1 %14, label %15, label %19
15: ; preds = %6
%16 = xor i8 %9, 1
%17 = icmp sgt i64 %7, 1
%18 = add nsw i64 %7, -1
br i1 %17, label %6, label %19
19: ; preds = %6, %15, %2
%20 = phi i8 [ 0, %2 ], [ %16, %15 ], [ %9, %6 ]
ret i8 %20
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ free(float *);
float *malloc(int);
int main(void) {
  float *ptr;
  ptr = malloc(sizeof(float));
  free(ptr);
  free(NULL);
  ptr = NULL;
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1030 <free@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca float*
store i32 0, i32* %1
%3 = call float* @malloc(i32 4)
store float* %3, float** %2
%4 = load float*, float** %2
%5 = call i32 @free(float* %4)
%6 = call i32 @free(float* null)
store float* null, float** %2
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call float* @malloc(i32 4)
%2 = tail call i32 @free(float* %1)
%3 = tail call i32 @free(float* null)
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
void input_Pb_N(int8_t *p) {
  int temp;
  scanf("%d", &temp);
  *p = temp;
}


x86 assembly (clang, -O0):
<input_Pb_N>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_Pb_N>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @input_Pb_N(i32* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
store i32 %5, i32* %0
ret void
}
int test_any_LSB_one(unsigned x) {
  unsigned char LSB = (unsigned char)x;
  return (LSB != 0);
}


x86 assembly (clang, -O0):
<test_any_LSB_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_any_LSB_one>:
xor    %eax,%eax
test   %dil,%dil
setne  %al
ret

LLVM IR (-O0):
define i32 @test_any_LSB_one(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = trunc i32 %4 to i8
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_any_LSB_one(i32 %0) {
%2 = and i32 %0, 255
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
float flt_neg_mul_add(float a, float c) { return (-(a * a)) + c; }


x86 assembly (clang, -O0):
<flt_neg_mul_add>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt_neg_mul_add>:
mulss  %xmm0,%xmm0
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @flt_neg_mul_add(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %3
%7 = fmul float %5, %6
%8 = fneg float %7
%9 = load float, float* %4
%10 = fadd float %8, %9
ret float %10
}

LLVM IR (-O2):
define float @flt_neg_mul_add(float %0, float %1) {
%3 = fmul float %0, %0
%4 = fsub float %1, %3
ret float %4
}
double percentComplete(double bytes, double totalBytes) {
  return (bytes / totalBytes * 100);
}


x86 assembly (clang, -O0):
<percentComplete>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<percentComplete>:
divsd  %xmm1,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @percentComplete(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fdiv double %5, %6
%8 = fmul double %7, 1.000000e+02
ret double %8
}

LLVM IR (-O2):
define double @percentComplete(double %0, double %1) {
%3 = fdiv double %0, %1
%4 = fmul double %3, 1.000000e+02
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ _main();
int32_t main(int32_t argc, char **argv) { return _main(); }


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @_main()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @_main()
ret i32 %3
}