xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void PrintUsage(void) {
  printf("Options:\n");
  printf("  -display <display-name>  specify X display name\n");
  printf("  -t                       print in tabular format\n");
  printf("  -v                       print in verbose format\n");
  printf("  -help                    print this information\n");
}


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

x86 assembly (clang, -O2):
<PrintUsage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf32(%rip),%rdi
call   1030 <puts@plt>
lea    0xf59(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Options:\0A\00"
@.str.1 = [51 x i8] c" -display <display-name> specify X display name\0A\00"
@.str.2 = [52 x i8] c" -t print in tabular format\0A\00"
@.str.3 = [52 x i8] c" -v print in verbose format\0A\00"
@.str.4 = [51 x i8] c" -help print this information\0A\00"
define void @PrintUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c"Options:\00"
@str.5 = [50 x i8] c" -display <display-name> specify X display name\00"
@str.6 = [51 x i8] c" -t print in tabular format\00"
@str.7 = [51 x i8] c" -v print in verbose format\00"
@str.8 = [50 x i8] c" -help print this information\00"
define void @PrintUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.8, i64 0, i64 0))
ret void
}
void proc42() {}


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

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

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

LLVM IR (-O2):
define void @proc42() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getpagesize();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("Size of page on this system: %d bytes\n", getpagesize());
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getpagesize@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getpagesize@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"Size of page on this system: %d bytes\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getpagesize()
%3 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@.str = [39 x i8] c"Size of page on this system: %d bytes\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getpagesize()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void foo350(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo350(i32 %0) {
ret void
}
int is_err(int x) { return x < 0 && x > -0x1000; }


x86 assembly (clang, -O0):
<is_err>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jge    1123 <is_err+0x23>
cmpl   $0xfffff000,-0x4(%rbp)
setg   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_err>:
xor    %eax,%eax
cmp    $0xfffff001,%edi
setae  %al
ret

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

LLVM IR (-O2):
define i32 @is_err(i32 %0) {
%2 = icmp ugt i32 %0, -4096
%3 = zext i1 %2 to i32
ret i32 %3
}
void color_text(int fg) {}


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

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

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

LLVM IR (-O2):
define void @color_text(i32 %0) {
ret void
}
void __set_bit(int nr, volatile void *addr) {
  __asm__ volatile("btsl %1,%0"
                   : "+m"(*(volatile long *)addr)
                   : "dIr"(nr)
                   : "memory");
}


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

x86 assembly (clang, -O2):
<__set_bit>:
bts    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @__set_bit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i64*
%7 = load i32, i32* %3
ret void
}

LLVM IR (-O2):
define void @__set_bit(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i64*
tail call void asm sideeffect "btsl $1,$0", "=*m,{dx}Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %3, i32 %0, i64* elementtype(i64) %3)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t __SSUB16(uint32_t op1, uint32_t op2) {
  return ((op1 & 0xFFFF0000) - (op2 & 0xFFFF0000)) | ((op1 - op2) & 0xFFFF);
}


x86 assembly (clang, -O0):
<__SSUB16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
mov    -0x8(%rbp),%ecx
and    $0xffff0000,%ecx
sub    %ecx,%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
and    $0xffff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__SSUB16>:
mov    %edi,%ecx
and    $0xffff0000,%ecx
sub    %esi,%edi
and    $0xffff0000,%esi
sub    %esi,%ecx
movzwl %di,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @__SSUB16(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 = and i32 %5, -65536
%7 = load i32, i32* %4
%8 = and i32 %7, -65536
%9 = sub i32 %6, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sub nsw i32 %10, %11
%13 = and i32 %12, 65535
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @__SSUB16(i32 %0, i32 %1) {
%3 = and i32 %0, -65536
%4 = and i32 %1, -65536
%5 = sub i32 %3, %4
%6 = sub nsw i32 %0, %1
%7 = and i32 %6, 65535
%8 = or i32 %5, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char greeting[6] = {'H', 'e', 'l', 'l', 'o', '\0'};
  printf("greeting message: %s \n", greeting);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xa(%rbp),%rsi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x6f,0x4(%rsp)
movl   $0x6c6c6548,(%rsp)
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.greeting = [6 x i8] c"Hello\00"
@.str = [23 x i8] c"greeting message: %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
store i32 0, i32* %1
%3 = bitcast [6 x i8]* %2 to i8*
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.greeting = [6 x i8] c"Hello\00"
@.str = [23 x i8] c"greeting message: %s \0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ BroadcastMessage();
void Time_BroadcastTime() { BroadcastMessage(); }


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

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

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

LLVM IR (-O2):
define void @Time_BroadcastTime() {
%1 = tail call i32 (...) @BroadcastMessage()
ret void
}
unsigned force_estimator(unsigned flags) {
  flags &= ~((0U) | (1U << 5) | (1U << 3));
  return (flags | (1U << 6));
}


x86 assembly (clang, -O0):
<force_estimator>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffd7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x40,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<force_estimator>:
and    $0xffffff97,%edi
lea    0x40(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @force_estimator(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -41
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = or i32 %5, 64
ret i32 %6
}

LLVM IR (-O2):
define i32 @force_estimator(i32 %0) {
%2 = and i32 %0, -105
%3 = or i32 %2, 64
ret i32 %3
}
void XcmsQueryColors() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int endmntent(FILE *streamp) {
  fclose(streamp);
  return 1;
}


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

x86 assembly (clang, -O2):
<endmntent>:
push   %rax
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @endmntent(i32* nocapture %0) {
%2 = tail call i32 @fclose(i32* %0)
ret i32 1
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
scalar_t__ waitpid(scalar_t__, int *, int);
pid_t util_waitpid(pid_t pid, int *status, int options) {
  pid_t n;
  do {
    n = waitpid(pid, status, options);
  } while (n < 0 && errno == EINTR);
  return n;
}


x86 assembly (clang, -O0):
<util_waitpid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <waitpid@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
jge    1161 <util_waitpid+0x51>
mov    0x2e92(%rip),%rax
mov    (%rax),%rax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1123 <util_waitpid+0x13>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_waitpid>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x2eb8(%rip),%r15
mov    0x2ea9(%rip),%r12
nop
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <waitpid@plt>
test   %rax,%rax
jns    114c <util_waitpid+0x3c>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <util_waitpid+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i64 @util_waitpid(i64 %0, i32* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
store i64 %0, i64* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
br label %8
8: ; preds = %20, %3
%9 = load i64, i64* %4
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = call i64 @waitpid(i64 %9, i32* %10, i32 %11)
store i64 %12, i64* %7
br label %13
13: ; preds = %8
%14 = load i64, i64* %7
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i64, i64* @errno
%18 = load i64, i64* @EINTR
%19 = icmp eq i64 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ false, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
%23 = load i64, i64* %7
ret i64 %23
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i64 @util_waitpid(i64 %0, i32* %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i64 @waitpid(i64 %0, i32* %1, i32 %2)
%6 = icmp slt i64 %5, 0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i64 %5
}
void insw(int port, void *addr, unsigned long count) {
  __asm__ __volatile__("rep; ins"
                       "w"
                       : "+D"(addr), "+c"(count)
                       : "d"(port));
}


x86 assembly (clang, -O0):
<insw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%edx
rep insw (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insw>:
mov    %rdx,%rcx
mov    %edi,%edx
mov    %rsi,%rdi
rep insw (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insw(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32, i32* %4
%10 = call { i8*, i64 } asm sideeffect "rep; insw", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %9, i8* %7, i64 %8)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @insw(i32 %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep; insw", "={di},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(char *);
void rebuild_sos_index(void) {
  fatal_error("rebuild_sos_index not implemented for given_selection");
}


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

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

LLVM IR (-O0):
@.str = [54 x i8] c"rebuild_sos_index not implemented for given_selection\00"
define void @rebuild_sos_index() {
%1 = call i32 @fatal_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"rebuild_sos_index not implemented for given_selection\00"
define void @rebuild_sos_index() {
%1 = tail call i32 @fatal_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_9Buint16_reg(unsigned short val) {
  return ((val) & (0x9B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_9Buint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x9b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_9Buint16_reg>:
test   $0x9b,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_9Buint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 155
%6 = icmp ne i32 %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_9Buint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 155
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int bbm_bulk_read(void *, unsigned short, unsigned char *, unsigned short);
signed int bbm_com_bulk_read(void *handle, unsigned short addr,
                             unsigned char *data, unsigned short size) {
  signed int res;
  res = bbm_bulk_read(handle, addr, data, size);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_bulk_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x18(%rbp),%rdx
movzwl %ax,%esi
movzwl -0x1a(%rbp),%ecx
call   1030 <bbm_bulk_read@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_bulk_read>:
jmp    1030 <bbm_bulk_read@plt>

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

LLVM IR (-O2):
define i32 @bbm_com_bulk_read(i8* %0, i16 zeroext %1, i8* %2, i16 zeroext %3) {
%5 = tail call i32 @bbm_bulk_read(i8* %0, i16 zeroext %1, i8* %2, i16 zeroext %3)
ret i32 %5
}
int KAPI_GetXVersion_MINOR() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @KAPI_GetXVersion_MINOR() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  int x1 = 4294967295;
  unsigned int y1 = 4294967295;
  unsigned int y2 = y1 - 16 - 8;
  unsigned int y3 = y2 ^ y1;
  printf("x1 = %d\n", x1);
  printf("y1 = %u\n", y1);
  printf("y3 = %u\n", y3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
sub    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x18,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"x1 = %d\0A\00"
@.str.1 = [9 x i8] c"y1 = %u\0A\00"
@.str.2 = [9 x i8] c"y3 = %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
store i32 -1, i32* %3
%6 = load i32, i32* %3
%7 = sub i32 %6, 16
%8 = sub i32 %7, 8
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = xor i32 %9, %10
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"x1 = %d\0A\00"
@.str.1 = [9 x i8] c"y1 = %u\0A\00"
@.str.2 = [9 x i8] c"y3 = %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 24)
ret i32 0
}
/* Type definitions */
struct stack_st_OPENSSL_BLOCK {
  int dummy;
};
typedef int /*<<< orphan*/ OPENSSL_STACK;

/* Variables and functions */
scalar_t__ OPENSSL_sk_shift(int /*<<< orphan*/ *);
void *sk_OPENSSL_BLOCK_shift(struct stack_st_OPENSSL_BLOCK *sk) {
  return (void *)OPENSSL_sk_shift((OPENSSL_STACK *)sk);
}


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

x86 assembly (clang, -O2):
<sk_OPENSSL_BLOCK_shift>:
jmp    1030 <OPENSSL_sk_shift@plt>

LLVM IR (-O0):
%struct.stack_st_OPENSSL_BLOCK = type { i32 }
define i8* @sk_OPENSSL_BLOCK_shift(%struct.stack_st_OPENSSL_BLOCK* %0) {
%2 = alloca %struct.stack_st_OPENSSL_BLOCK*
store %struct.stack_st_OPENSSL_BLOCK* %0, %struct.stack_st_OPENSSL_BLOCK** %2
%3 = load %struct.stack_st_OPENSSL_BLOCK*, %struct.stack_st_OPENSSL_BLOCK** %2
%4 = bitcast %struct.stack_st_OPENSSL_BLOCK* %3 to i32*
%5 = call i64 @OPENSSL_sk_shift(i32* %4)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
%struct.stack_st_OPENSSL_BLOCK = type { i32 }
define i8* @sk_OPENSSL_BLOCK_shift(%struct.stack_st_OPENSSL_BLOCK* %0) {
%2 = getelementptr %struct.stack_st_OPENSSL_BLOCK, %struct.stack_st_OPENSSL_BLOCK* %0, i64 0, i32 0
%3 = tail call i64 @OPENSSL_sk_shift(i32* %2)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int cmp(const void *a, const void *b) { return *(char *)a - *(char *)b; }


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp(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* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
double exp(double);
double stdnorm_distribution(double x) {
  return (0.398942280401433 * exp((-1.0 / 2.0) * x * x));
}


x86 assembly (clang, -O0):
<stdnorm_distribution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xec1(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdnorm_distribution>:
push   %rax
movsd  0xee7(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  0xeda(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @stdnorm_distribution(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double -5.000000e-01, %3
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = call double @exp(double %6)
%8 = fmul double 0x3FD9884533D43656, %7
ret double %8
}

LLVM IR (-O2):
define double @stdnorm_distribution(double %0) {
%2 = fmul double %0, -5.000000e-01
%3 = fmul double %2, %0
%4 = tail call double @exp(double %3)
%5 = fmul double %4, 0x3FD9884533D43656
ret double %5
}
/* Variables and functions */
double rndTriangle();
double rndu();
double sqrt(int);
double rndBactrianTriangle(void) {
  double z = 0.95 + rndTriangle() * sqrt(1 - 0.95 * 0.95);
  if (rndu() < 0.5)
    z = -z;
  return (z);
}


x86 assembly (clang, -O0):
<rndBactrianTriangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rndTriangle@plt>
movsd  %xmm0,-0x10(%rbp)
xor    %edi,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rndu@plt>
movaps %xmm0,%xmm1
movsd  0xe86(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a5 <rndBactrianTriangle+0x75>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rndBactrianTriangle>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <rndTriangle@plt>
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1050 <sqrt@plt>
mulsd  (%rsp),%xmm0
addsd  0xeac(%rip),%xmm0
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <rndu@plt>
movapd 0xea8(%rip),%xmm1
cmpltsd 0xe97(%rip),%xmm0
movapd (%rsp),%xmm2
xorpd  %xmm2,%xmm1
andpd  %xmm0,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rndBactrianTriangle() {
%1 = alloca double
%2 = call double (...) @rndTriangle()
%3 = call double @sqrt(i32 0)
%4 = call double @llvm.fmuladd.f64(double %2, double %3, double 0x3FEE666666666666)
store double %4, double* %1
%5 = call double (...) @rndu()
%6 = fcmp olt double %5, 5.000000e-01
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load double, double* %1
%9 = fneg double %8
store double %9, double* %1
br label %10
10: ; preds = %7, %0
%11 = load double, double* %1
ret double %11
}

LLVM IR (-O2):
define double @rndBactrianTriangle() {
%1 = tail call double (...) @rndTriangle()
%2 = tail call double @sqrt(i32 0)
%3 = tail call double @llvm.fmuladd.f64(double %1, double %2, double 0x3FEE666666666666)
%4 = tail call double (...) @rndu()
%5 = fcmp olt double %4, 5.000000e-01
%6 = fneg double %3
%7 = select i1 %5, double %6, double %3
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ bio_write(int, int);
void t2_putcommacode(int n) {
  while (--n >= 0) {
    bio_write(1, 1);
  }
  bio_write(0, 1);
}


x86 assembly (clang, -O0):
<t2_putcommacode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jl     113e <t2_putcommacode+0x2e>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <bio_write@plt>
jmp    111b <t2_putcommacode+0xb>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <bio_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2_putcommacode>:
push   %rbx
test   %edi,%edi
jle    1137 <t2_putcommacode+0x27>
mov    %edi,%ebx
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <bio_write@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <t2_putcommacode+0x10>
xor    %edi,%edi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <bio_write@plt>

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

LLVM IR (-O2):
define void @t2_putcommacode(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @bio_write(i32 1, i32 1)
%7 = icmp ugt i32 %4, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %1
%9 = tail call i32 @bio_write(i32 0, i32 1)
ret void
}
primFun(primPass) {
  push(ap(primArg(3), primArg(1)));
  updapRoot(top(), primArg(2));
}


x86 assembly (clang, -O0):
<primFun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x3,%edi
mov    $0x0,%al
call   1060 <primArg@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
mov    $0x0,%al
call   1060 <primArg@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1070 <ap@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1050 <push@plt>
mov    $0x0,%al
call   1040 <top@plt>
mov    %eax,-0xc(%rbp)
mov    $0x2,%edi
mov    $0x0,%al
call   1060 <primArg@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   1030 <updapRoot@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primFun>:
push   %rbx
mov    $0x3,%edi
xor    %eax,%eax
call   1060 <primArg@plt>
mov    %eax,%ebx
mov    $0x1,%edi
xor    %eax,%eax
call   1060 <primArg@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <ap@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1050 <push@plt>
xor    %eax,%eax
call   1040 <top@plt>
mov    %eax,%ebx
mov    $0x2,%edi
xor    %eax,%eax
call   1060 <primArg@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <updapRoot@plt>

LLVM IR (-O0):
define i32 @primFun(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @primArg to i32 (i32, ...)*)(i32 3)
%5 = call i32 (i32, ...) bitcast (i32 (...)* @primArg to i32 (i32, ...)*)(i32 1)
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @ap to i32 (i32, i32, ...)*)(i32 %4, i32 %5)
%7 = call i32 (i32, ...) bitcast (i32 (...)* @push to i32 (i32, ...)*)(i32 %6)
%8 = call i32 (...) @top()
%9 = call i32 (i32, ...) bitcast (i32 (...)* @primArg to i32 (i32, ...)*)(i32 2)
%10 = call i32 (i32, i32, ...) bitcast (i32 (...)* @updapRoot to i32 (i32, i32, ...)*)(i32 %8, i32 %9)
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @primFun(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @primArg to i32 (i32, ...)*)(i32 3)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @primArg to i32 (i32, ...)*)(i32 1)
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @ap to i32 (i32, i32, ...)*)(i32 %2, i32 %3)
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @push to i32 (i32, ...)*)(i32 %4)
%6 = tail call i32 (...) @top()
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @primArg to i32 (i32, ...)*)(i32 2)
%8 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @updapRoot to i32 (i32, i32, ...)*)(i32 %6, i32 %7)
ret i32 undef
}
unsigned char MHal_PNL_GetDACOut() {
  unsigned char bRet = 0;
  return bRet;
}


x86 assembly (clang, -O0):
<MHal_PNL_GetDACOut>:
push   %rbp
mov    %rsp,%rbp
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @MHal_PNL_GetDACOut() {
ret i8 0
}
/* Type definitions */
struct event_base {
  int dummy;
};
typedef int /*<<< orphan*/ evutil_socket_t;

/* Variables and functions */
int /*<<< orphan*/ event_base_loopexit(struct event_base *,
                                       int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void signal_cb(evutil_socket_t fd, short what, void *arg) {
  struct event_base *base = arg;
  printf("stop\n");
  event_base_loopexit(base, NULL);
}


x86 assembly (clang, -O0):
<signal_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <event_base_loopexit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_cb>:
push   %rbx
mov    %rdx,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1040 <event_base_loopexit@plt>

LLVM IR (-O0):
%struct.event_base = type { i32 }
@.str = [6 x i8] c"stop\0A\00"
define void @signal_cb(i32 %0, i16 signext %1, i8* %2) {
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8*
%7 = alloca %struct.event_base*
store i32 %0, i32* %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to %struct.event_base*
store %struct.event_base* %9, %struct.event_base** %7
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load %struct.event_base*, %struct.event_base** %7
%12 = call i32 @event_base_loopexit(%struct.event_base* %11, i32* null)
ret void
}

LLVM IR (-O2):
%struct.event_base = type { i32 }
@str = [5 x i8] c"stop\00"
define void @signal_cb(i32 %0, i16 signext %1, i8* %2) {
%4 = bitcast i8* %2 to %struct.event_base*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @event_base_loopexit(%struct.event_base* %4, i32* null)
ret void
}
int maxint(int a, int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<maxint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <maxint+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <maxint+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxint>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @maxint(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @maxint(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void prints() {}


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

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

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

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

/* Variables and functions */
size_t fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
long strtol(char *, int /*<<< orphan*/ *, int);
long get_brightness(FILE *fp) {
  char *temp = malloc(3 * sizeof(char));
  memset(temp, 0, 3 * sizeof(char));
  size_t read = fread(temp, sizeof(char), 3, fp);
  long val = strtol(temp, NULL, 10);
  free(temp);
  return val;
}


x86 assembly (clang, -O0):
<get_brightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x3,%edx
call   1040 <fread@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_brightness>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @get_brightness(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %2
%6 = call i8* @malloc(i32 3)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 @memset(i8* %7, i32 0, i32 3)
%9 = load i8*, i8** %3
%10 = load i32*, i32** %2
%11 = call i64 @fread(i8* %9, i32 1, i32 3, i32* %10)
store i64 %11, i64* %4
%12 = load i8*, i8** %3
%13 = call i64 @strtol(i8* %12, i32* null, i32 10)
store i64 %13, i64* %5
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
%16 = load i64, i64* %5
ret i64 %16
}

LLVM IR (-O2):
define i64 @get_brightness(i32* nocapture %0) {
%2 = tail call dereferenceable_or_null(3) i8* @malloc(i32 3)
%3 = tail call i32 @memset(i8* %2, i32 0, i32 3)
%4 = tail call i64 @fread(i8* %2, i32 1, i32 3, i32* %0)
%5 = tail call i64 @strtol(i8* nocapture %2, i32* null, i32 10)
%6 = tail call i32 @free(i8* %2)
ret i64 %5
}
int length(char s[]) {
  int count = 0, i;
  for (i = 0; s[i] != '\0'; i++) {
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1142 <length+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <length+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
cmpb   $0x0,(%rdi)
je     111c <length+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <length+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %1
%13 = phi i32 [ 0, %1 ], [ %11, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void processCommandLine(int argc, char *argv[], char **device) {
  if (argc != 2) {
    printf("sniffer <interface>\n");
    exit(1);
  }
  *device = argv[1];
}


x86 assembly (clang, -O0):
<processCommandLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1153 <processCommandLine+0x33>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processCommandLine>:
push   %rax
cmp    $0x2,%edi
jne    112f <processCommandLine+0xf>
mov    0x8(%rsi),%rax
mov    %rax,(%rdx)
pop    %rax
ret
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"sniffer <interface>\0A\00"
define void @processCommandLine(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %3
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %6
store i8* %15, i8** %16
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"sniffer <interface>\00"
define void @processCommandLine(i32 %0, i8** nocapture %1, i8** nocapture writeonly %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %3
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
store i8* %10, i8** %2
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
scalar_t__ ERR;
scalar_t__ echo();
scalar_t__ noecho();
uint8_t ccbi_echo(int on) { return ((on ? echo() : noecho()) == ERR ? 0 : 1); }


x86 assembly (clang, -O0):
<ccbi_echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1145 <ccbi_echo+0x25>
mov    $0x0,%al
call   1030 <echo@plt>
mov    %rax,-0x10(%rbp)
jmp    1150 <ccbi_echo+0x30>
mov    $0x0,%al
call   1040 <noecho@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    0x2e8d(%rip),%rax
mov    (%rax),%rsi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccbi_echo>:
push   %rax
xor    %eax,%eax
test   %edi,%edi
je     112e <ccbi_echo+0xe>
call   1030 <echo@plt>
jmp    1133 <ccbi_echo+0x13>
call   1040 <noecho@plt>
mov    0x2eae(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ERR = global i64 0
define i32 @ccbi_echo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i64 (...) @echo()
br label %9
7: ; preds = %1
%8 = call i64 (...) @noecho()
br label %9
9: ; preds = %7, %5
%10 = phi i64 [ %6, %5 ], [ %8, %7 ]
%11 = load i64, i64* @ERR
%12 = icmp eq i64 %10, %11
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 0, i32 1
ret i32 %14
}

LLVM IR (-O2):
@ERR = global i64 0
define i32 @ccbi_echo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i64 (...) @echo()
br label %7
5: ; preds = %1
%6 = tail call i64 (...) @noecho()
br label %7
7: ; preds = %5, %3
%8 = phi i64 [ %4, %3 ], [ %6, %5 ]
%9 = load i64, i64* @ERR
%10 = icmp ne i64 %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ PDCWrite(int, unsigned char);
void PDCGPIODirWrite(unsigned char ucIdx, unsigned char ucValue) {
  ;
  if (ucIdx == 0) {
    PDCWrite(0x9, ucValue);
  } else if (ucIdx == 1) {
    PDCWrite(0xB, ucValue);
  } else {
    PDCWrite(0xD, ucValue);
  }
}


x86 assembly (clang, -O0):
<PDCGPIODirWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1144 <PDCGPIODirWrite+0x34>
mov    $0x9,%edi
movzbl -0x2(%rbp),%esi
call   1030 <PDCWrite@plt>
jmp    1177 <PDCGPIODirWrite+0x67>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1164 <PDCGPIODirWrite+0x54>
mov    $0xb,%edi
movzbl -0x2(%rbp),%esi
call   1030 <PDCWrite@plt>
jmp    1172 <PDCGPIODirWrite+0x62>
mov    $0xd,%edi
movzbl -0x2(%rbp),%esi
call   1030 <PDCWrite@plt>
jmp    1177 <PDCGPIODirWrite+0x67>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCGPIODirWrite>:
xor    %eax,%eax
cmp    $0x1,%dil
setne  %al
add    %eax,%eax
add    $0xb,%eax
test   %edi,%edi
mov    $0x9,%edi
cmovne %eax,%edi
jmp    1030 <PDCWrite@plt>

LLVM IR (-O0):
define void @PDCGPIODirWrite(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8, i8* %4
%10 = call i32 @PDCWrite(i32 9, i8 zeroext %9)
br label %22
11: ; preds = %2
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8, i8* %4
%17 = call i32 @PDCWrite(i32 11, i8 zeroext %16)
br label %21
18: ; preds = %11
%19 = load i8, i8* %4
%20 = call i32 @PDCWrite(i32 13, i8 zeroext %19)
br label %21
21: ; preds = %18, %15
br label %22
22: ; preds = %21, %8
ret void
}

LLVM IR (-O2):
define void @PDCGPIODirWrite(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp eq i8 %0, 1
%4 = select i1 %3, i32 11, i32 13
%5 = icmp eq i8 %0, 0
%6 = select i1 %5, i32 9, i32 %4
%7 = tail call i32 @PDCWrite(i32 %6, i8 zeroext %1)
ret void
}