xunge/DecIR huggingface dataset:
char next_non_whitespace(const char *s) {
  int i;
  for (i = 0; s[i] == ' '; i++)
    ;
  return s[i];
}


x86 assembly (clang, -O0):
<next_non_whitespace>:
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    $0x20,%eax
jne    1137 <next_non_whitespace+0x37>
jmp    1129 <next_non_whitespace+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <next_non_whitespace+0xf>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_non_whitespace>:
movzbl (%rdi),%eax
add    $0x1,%rdi
cmp    $0x20,%al
je     1100 <next_non_whitespace>
ret

LLVM IR (-O0):
define signext i8 @next_non_whitespace(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %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 eq i32 %10, 32
br i1 %11, label %12, label %16
12: ; preds = %4
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @next_non_whitespace(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, 32
%7 = add nuw i64 %3, 1
br i1 %6, label %2, label %8
8: ; preds = %2
ret i8 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ getpid();
int main(int argc, char **argv) { pid_t pid = getpid(); }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int im_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) {
  int count = -1;
  count = vsnprintf(outBuf, size, format, ap);
  return count;
}


x86 assembly (clang, -O0):
<im_vsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<im_vsnprintf>:
jmp    1030 <vsnprintf@plt>

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

LLVM IR (-O2):
define i32 @im_vsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ handle_59(int /*<<< orphan*/);
int gen_59() {
  handle_59(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_59>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_59@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_59() {
%1 = call i32 @handle_59(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_59() {
%1 = tail call i32 @handle_59(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("Hello, Wordl!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, Wordl!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, Wordl!\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timeval {
  long tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
void xsleep(long sec) {
  struct timeval tv;
  tv.tv_sec = sec;
  tv.tv_usec = 0;
  select(0, NULL, NULL, NULL, &tv);
}


x86 assembly (clang, -O0):
<xsleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x18(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsleep>:
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @xsleep(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timeval
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i64 %4, i64* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i64 0, i64* %6
%7 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @xsleep(i64 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i64 %0, i64* %4
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 0, i64* %5
%6 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret void
}
int utf8_getchars(char *buf, int c) {
  *buf = c;
  return 1;
}


x86 assembly (clang, -O0):
<utf8_getchars>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_getchars>:
mov    %sil,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @utf8_getchars(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 = trunc i32 %5 to i8
%7 = load i8*, i8** %3
store i8 %6, i8* %7
ret i32 1
}

LLVM IR (-O2):
define i32 @utf8_getchars(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void myReshape(int w, int h) { glViewport(0, 0, w, h); }


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

x86 assembly (clang, -O2):
<myReshape>:
mov    %esi,%ecx
mov    %edi,%edx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <glViewport@plt>

LLVM IR (-O0):
define void @myReshape(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 @glViewport(i32 0, i32 0, i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @myReshape(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
ret void
}
int do_681() { return 681; }


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

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

LLVM IR (-O0):
define i32 @do_681() {
ret i32 681
}

LLVM IR (-O2):
define i32 @do_681() {
ret i32 681
}
int isblank(const int c) { return c == ' ' || c == '\t'; }


x86 assembly (clang, -O0):
<isblank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <isblank+0x20>
cmpl   $0x9,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isblank>:
cmp    $0x20,%edi
sete   %al
cmp    $0x9,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isblank(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 9
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isblank(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = icmp eq i32 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int MAXPATHLEN;
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int);
int openRecordFile(const char *path, int nr) {
  char fileName[MAXPATHLEN];
  snprintf(fileName, MAXPATHLEN, "%s/%03d.vdr", path, nr);
  return open(fileName, O_RDONLY);
}


x86 assembly (clang, -O0):
<openRecordFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
lea    0xe8d(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x28(%rbp),%rdi
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openRecordFile>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %esi,%r8d
mov    %rdi,%rcx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xeb0(%rip),%rdx
mov    %rbx,%rdi
call   1030 <snprintf@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <open@plt>
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@MAXPATHLEN = global i32 0
@.str = [12 x i8] c"%s/%03d.vdr\00"
@O_RDONLY = global i32 0
define i32 @openRecordFile(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* @MAXPATHLEN
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca i8, i64 %8
store i64 %8, i64* %6
%11 = load i32, i32* @MAXPATHLEN
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = call i32 @snprintf(i8* %10, i32 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13)
%15 = load i32, i32* @O_RDONLY
%16 = call i32 @open(i8* %10, i32 %15)
%17 = load i8*, i8** %5
ret i32 %16
}

LLVM IR (-O2):
@MAXPATHLEN = global i32 0
@.str = [12 x i8] c"%s/%03d.vdr\00"
@O_RDONLY = global i32 0
define i32 @openRecordFile(i8* %0, i32 %1) {
%3 = load i32, i32* @MAXPATHLEN
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @snprintf(i8* %5, i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%7 = load i32, i32* @O_RDONLY
%8 = call i32 @open(i8* %5, i32 %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ i2send(int);
int /*<<< orphan*/ i2start(unsigned char);
int /*<<< orphan*/ i2stop();
void i2cd(unsigned char addr, unsigned char reg, unsigned char dat) {
  i2start(addr);
  i2send((int)reg);
  i2send((int)dat);
  i2stop();
}


x86 assembly (clang, -O0):
<i2cd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%edi
call   1050 <i2start@plt>
movzbl -0x2(%rbp),%edi
call   1030 <i2send@plt>
movzbl -0x3(%rbp),%edi
call   1030 <i2send@plt>
mov    $0x0,%al
call   1040 <i2stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2cd>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
call   1050 <i2start@plt>
mov    %ebp,%edi
call   1030 <i2send@plt>
mov    %ebx,%edi
call   1030 <i2send@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <i2stop@plt>

LLVM IR (-O0):
define void @i2cd(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %4
%8 = call i32 @i2start(i8 zeroext %7)
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = call i32 @i2send(i32 %10)
%12 = load i8, i8* %6
%13 = zext i8 %12 to i32
%14 = call i32 @i2send(i32 %13)
%15 = call i32 (...) @i2stop()
ret void
}

LLVM IR (-O2):
define void @i2cd(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = tail call i32 @i2start(i8 zeroext %0)
%5 = zext i8 %1 to i32
%6 = tail call i32 @i2send(i32 %5)
%7 = zext i8 %2 to i32
%8 = tail call i32 @i2send(i32 %7)
%9 = tail call i32 (...) @i2stop()
ret void
}
void mdp4_dsi_cmd_wait4vsync(int cndx, long long *vtime) {}


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

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

LLVM IR (-O0):
define void @mdp4_dsi_cmd_wait4vsync(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
ret void
}

LLVM IR (-O2):
define void @mdp4_dsi_cmd_wait4vsync(i32 %0, i64* nocapture %1) {
ret void
}
int fun1(int a, int b) { return a * a + 2 * a * b + b * b; }


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

x86 assembly (clang, -O2):
<fun1>:
lea    (%rsi,%rdi,2),%eax
mov    %edi,%ecx
imul   %edi,%ecx
imul   %esi,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fun1(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* %3
%7 = mul nsw i32 %5, %6
%8 = load i32, i32* %3
%9 = mul nsw i32 2, %8
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
%12 = add nsw i32 %7, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
%16 = add nsw i32 %12, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @fun1(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, %0
%4 = shl i32 %0, 1
%5 = add i32 %4, %1
%6 = mul i32 %5, %1
%7 = add i32 %6, %3
ret i32 %7
}
void FFTABLEIN(unsigned char *tab, int g, unsigned char *data) {
  *(((long long *)tab) + g) = *((long long *)data);
}


x86 assembly (clang, -O0):
<FFTABLEIN>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<FFTABLEIN>:
mov    (%rdx),%rax
movslq %esi,%rcx
mov    %rax,(%rdi,%rcx,8)
ret

LLVM IR (-O0):
define void @FFTABLEIN(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i64, i64* %11, i64 %13
store i64 %9, i64* %14
ret void
}

LLVM IR (-O2):
define void @FFTABLEIN(i8* nocapture writeonly %0, i32 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i64*
%5 = load i64, i64* %4
%6 = bitcast i8* %0 to i64*
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i64, i64* %6, i64 %7
store i64 %5, i64* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("bluemoon - Bluemoon configuration utility\n"
         "Usage:\n");
  printf("\tbluemoon [options]\n");
  printf("Options:\n"
         "\t-A, --bdaddr [addr]    Set Bluetooth address\n"
         "\t-F, --firmware [file]  Load firmware\n"
         "\t-C, --check <file>     Check firmware image\n"
         "\t-R, --reset            Reset controller\n"
         "\t-B, --coldboot         Cold boot controller\n"
         "\t-E, --exception        Trigger exception\n"
         "\t-i, --index <num>      Use specified controller\n"
         "\t-h, --help             Show help options\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf15(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"bluemoon - Bluemoon configuration utility\0AUsage:\0A\00"
@.str.1 = [21 x i8] c"\09bluemoon [options]\0A\00"
@.str.2 = [358 x i8] c"Options:\0A\09-A, --bdaddr [addr] Set Bluetooth address\0A\09-F, --firmware [file] Load firmware\0A\09-C, --check <file> Check firmware image\0A\09-R, --reset Reset controller\0A\09-B, --coldboot Cold boot controller\0A\09-E, --exception Trigger exception\0A\09-i, --index <num> Use specified controller\0A\09-h, --help Show help options\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([358 x i8], [358 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [49 x i8] c"bluemoon - Bluemoon configuration utility\0AUsage:\00"
@str.3 = [20 x i8] c"\09bluemoon [options]\00"
@str.4 = [357 x i8] c"Options:\0A\09-A, --bdaddr [addr] Set Bluetooth address\0A\09-F, --firmware [file] Load firmware\0A\09-C, --check <file> Check firmware image\0A\09-R, --reset Reset controller\0A\09-B, --coldboot Cold boot controller\0A\09-E, --exception Trigger exception\0A\09-i, --index <num> Use specified controller\0A\09-h, --help Show help options\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([357 x i8], [357 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FatalError(char *, unsigned long);
void *malloc(unsigned long);
void *SnortMalloc(unsigned long size) {
  void *pv = malloc(size);
  if (pv)
    return pv;
  FatalError("Unable to allocate memory!  (%lu requested)\n", size);
  return NULL;
}


x86 assembly (clang, -O0):
<SnortMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1151 <SnortMalloc+0x31>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <SnortMalloc+0x49>
mov    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1040 <FatalError@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SnortMalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <SnortMalloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <FatalError@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Unable to allocate memory! (%lu requested)\0A\00"
define i8* @SnortMalloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %4
store i8* %10, i8** %2
br label %14
11: ; preds = %1
%12 = load i64, i64* %3
%13 = call i32 @FatalError(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 %12)
store i8* null, i8** %2
br label %14
14: ; preds = %11, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [45 x i8] c"Unable to allocate memory! (%lu requested)\0A\00"
define noalias i8* @SnortMalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @FatalError(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
char *aeApiName();
char *catAeGetApiName(void) { return aeApiName(); }


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

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

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

LLVM IR (-O2):
define i8* @catAeGetApiName() {
%1 = tail call i8* (...) @aeApiName()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ test_params(int, int);
int main() {
  int local = 42;
  printf("%d\n", local);
  int a;
  a = 100;
  printf("%d\n", a);
  test_params(5, 7);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2a,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
movl   $0x64,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   1030 <test_params@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <printf@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   1030 <test_params@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 100)
%3 = tail call i32 @test_params(i32 5, i32 7)
ret i32 0
}
int __attribute__((visibility("default"))) func(int x) { return 42; }


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

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

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

LLVM IR (-O2):
define i32 @func(i32 %0) {
ret i32 42
}
void glmQuaternionFromVectorAndScalard(double q[4], const double v[3],
                                       const double w) {
  q[0] = w;
  q[1] = v[0];
  q[2] = v[1];
  q[3] = v[2];
}


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

x86 assembly (clang, -O2):
<glmQuaternionFromVectorAndScalard>:
movsd  %xmm0,(%rdi)
movsd  (%rsi),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x18(%rdi)
ret

LLVM IR (-O0):
define void @glmQuaternionFromVectorAndScalard(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* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 2
store double %17, double* %19
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 3
store double %22, double* %24
ret void
}

LLVM IR (-O2):
define void @glmQuaternionFromVectorAndScalard(double* nocapture writeonly %0, double* nocapture %1, double %2) {
store double %2, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
store double %4, double* %5
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 2
store double %7, double* %8
%9 = getelementptr inbounds double, double* %1, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %0, i64 3
store double %10, double* %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int **, int **);
int main(void) {
  int a;
  int *p1 = &a, *p2 = &a;
  foo(&p1, &p2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    %rax,(%rsp)
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32** %2 to i8*
store i32* %1, i32** %2
%6 = bitcast i32** %3 to i8*
store i32* %1, i32** %3
%7 = call i32 @foo(i32** %2, i32** %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __gnuc_va_list;

/* Variables and functions */
int /*<<< orphan*/ stdout;
int vfprintf(int /*<<< orphan*/, char const *, int /*<<< orphan*/);
int wprintf(__const char *__restrict __fmt, __gnuc_va_list __arg) {
  return vfprintf(stdout, __fmt, __arg);
}


x86 assembly (clang, -O0):
<wprintf>:
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 <vfprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stdout = global i32 0
define i32 @wprintf(i8* noalias %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vfprintf(i32 %5, i8* %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @wprintf(i8* noalias %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @vfprintf(i32 %3, i8* %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int strcmp(char *, char *);
int TreeStringCompare(void *a, void *b, int content) {
  return strcmp((char *)a, (char *)b);
}


x86 assembly (clang, -O0):
<TreeStringCompare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TreeStringCompare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @TreeStringCompare(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int main(void) {
  FILE *fp = popen("mail admin backup", "w");
  fprintf(fp, "Error with backup!\n");
  pclose(fp);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <pclose@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1040 <popen@plt>
mov    %rax,%rbx
lea    0xec6(%rip),%rdi
mov    $0x13,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <pclose@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"mail admin backup\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [20 x i8] c"Error with backup!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @popen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32*, i32** %2
%7 = call i32 @pclose(i32* %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@.str = [18 x i8] c"mail admin backup\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [20 x i8] c"Error with backup!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32* @popen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i64 19, i64 1, i32* %1)
%3 = tail call i32 @pclose(i32* %1)
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
int ap_list_init(struct hostapd_iface *iface) { return 0; }


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

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

LLVM IR (-O0):
%struct.hostapd_iface = type opaque
define i32 @ap_list_init(%struct.hostapd_iface* %0) {
%2 = alloca %struct.hostapd_iface*
store %struct.hostapd_iface* %0, %struct.hostapd_iface** %2
ret i32 0
}

LLVM IR (-O2):
%struct.hostapd_iface = type opaque
define i32 @ap_list_init(%struct.hostapd_iface* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void do_end() { puts("\tjmp exit"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"\09jmp exit\00"
define void @do_end() {
%1 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"\09jmp exit\00"
define void @do_end() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
long iabs(x)
long x;
{
  if (x >= 0)
    return (long)x;
  return -((long)x);
}


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

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

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

LLVM IR (-O2):
define i64 @iabs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
void StartFrame() {}


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

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

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

LLVM IR (-O2):
define void @StartFrame() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef void const *b;
typedef void *a;

/* Variables and functions */
int /*<<< orphan*/ cpy1(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int cpy4(void *, void const *);
void cpy5(void *a, const void *b) {
  cpy4(a, b), cpy1((uint8_t *)a + 4, (uint8_t *)b + 4);
}


x86 assembly (clang, -O0):
<cpy5>:
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 <cpy4@plt>
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1040 <cpy1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpy5>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <cpy4@plt>
add    $0x10,%rbx
add    $0x10,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cpy1@plt>

LLVM IR (-O0):
define void @cpy5(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 @cpy4(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds i32, i32* %9, i64 4
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 4
%14 = call i32 @cpy1(i32* %10, i32* %13)
ret void
}

LLVM IR (-O2):
define void @cpy5(i8* %0, i8* %1) {
%3 = tail call i32 @cpy4(i8* %0, i8* %1)
%4 = getelementptr inbounds i8, i8* %0, i64 16
%5 = bitcast i8* %4 to i32*
%6 = getelementptr inbounds i8, i8* %1, i64 16
%7 = bitcast i8* %6 to i32*
%8 = tail call i32 @cpy1(i32* %5, i32* %7)
ret void
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
long timeval_to_usec(const struct timeval *tv) {
  return ((long)tv->tv_usec) + ((long)tv->tv_sec * 1000000L);
}


x86 assembly (clang, -O0):
<timeval_to_usec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%rcx
imul   $0xf4240,(%rcx),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_to_usec>:
imul   $0xf4240,(%rdi),%rax
add    0x8(%rdi),%rax
ret

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

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @timeval_to_usec(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000000
%7 = add nsw i64 %6, %3
ret i64 %7
}
unsigned char readPort1(unsigned short int port) { return 0; }


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

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

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

LLVM IR (-O2):
define zeroext i8 @readPort1(i16 zeroext %0) {
ret i8 0
}
int luaU_endianess(void) {
  int x = 1;
  return *(char *)&x;
}


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

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

LLVM IR (-O0):
define i32 @luaU_endianess() {
%1 = alloca i32
store i32 1, i32* %1
%2 = bitcast i32* %1 to i8*
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @luaU_endianess() {
ret i32 1
}
void bar() {
#pragma omp declare reduction(foo                                              \
                              : struct A                                       \
                              : foo(&omp_out, &omp_in))                        \
    initializer(omp_priv = {0})
}


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

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

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

LLVM IR (-O2):
define void @bar() {
ret void
}
/* Variables and functions */
int ftk_hex_to_int(char const);
int ftk_parse_color_1(const char *value) {
  return ftk_hex_to_int(value[0]) * 16 + ftk_hex_to_int(value[1]);
}


x86 assembly (clang, -O0):
<ftk_parse_color_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ftk_hex_to_int@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <ftk_hex_to_int@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftk_parse_color_1>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <ftk_hex_to_int@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <ftk_hex_to_int@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ftk_parse_color_1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = call i32 @ftk_hex_to_int(i8 signext %5)
%7 = mul nsw i32 %6, 16
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = call i32 @ftk_hex_to_int(i8 signext %10)
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ftk_parse_color_1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @ftk_hex_to_int(i8 signext %2)
%4 = shl nsw i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @ftk_hex_to_int(i8 signext %6)
%8 = add nsw i32 %7, %4
ret i32 %8
}
void sedb_duplicate(void) {}


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

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

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

LLVM IR (-O2):
define void @sedb_duplicate() {
ret void
}
unsigned int rightrot(unsigned int x, int n) {
  unsigned int tmp = x & (~(~0 << n));
  x = x >> n;
  x = x | (tmp << (sizeof(x) * 8 - n));
  return x;
}


x86 assembly (clang, -O0):
<rightrot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%edx
movslq -0x8(%rbp),%rsi
mov    $0x20,%ecx
sub    %rsi,%rcx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rightrot>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @rightrot(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = shl i32 -1, %7
%9 = xor i32 %8, -1
%10 = and i32 %6, %9
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = lshr i32 %11, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = sub i64 32, %17
%19 = trunc i64 %18 to i32
%20 = shl i32 %15, %19
%21 = or i32 %14, %20
store i32 %21, i32* %3
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @rightrot(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
int FastIntNegAbs(int x) { return (x < 0) ? x : -x; }


x86 assembly (clang, -O0):
<FastIntNegAbs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111c <FastIntNegAbs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <FastIntNegAbs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @FastIntNegAbs(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 %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @FastIntNegAbs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 false)
%3 = sub i32 0, %2
ret i32 %3
}
int test_imm_51uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x51 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_51uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x51,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_51uint64_midword_reg>:
test   $0x510000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_51uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 5308416
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
double OP_BitAnd(double op1, double op2) {
  return (double)((long int)op1 & (long int)op2);
}


x86 assembly (clang, -O0):
<OP_BitAnd>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
cvttsd2si -0x8(%rbp),%rax
cvttsd2si -0x10(%rbp),%rcx
and    %rcx,%rax
cvtsi2sd %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP_BitAnd>:
cvttsd2si %xmm0,%rax
cvttsd2si %xmm1,%rcx
and    %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
ret

LLVM IR (-O0):
define double @OP_BitAnd(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 = fptosi double %5 to i64
%7 = load double, double* %4
%8 = fptosi double %7 to i64
%9 = and i64 %6, %8
%10 = sitofp i64 %9 to double
ret double %10
}

LLVM IR (-O2):
define double @OP_BitAnd(double %0, double %1) {
%3 = fptosi double %0 to i64
%4 = fptosi double %1 to i64
%5 = and i64 %4, %3
%6 = sitofp i64 %5 to double
ret double %6
}