xunge/DecIR huggingface dataset:
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ do_select(int);
int /*<<< orphan*/ listen(int, int);
int socket_bind(char *, int);
int main(int argc, char *argv[]) {
  int listenfd, connfd, sockfd;
  struct sockaddr_in cliaddr;
  socklen_t cliaddrlen;
  listenfd = socket_bind("127.0.0.1", 8787);
  listen(listenfd, 5);
  do_select(listenfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x2253,%esi
call   1030 <socket_bind@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   1050 <listen@plt>
mov    -0x14(%rbp),%edi
call   1040 <do_select@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x2253,%esi
call   1030 <socket_bind@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    $0x5,%esi
call   1050 <listen@plt>
mov    %ebx,%edi
call   1040 <do_select@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
@.str = [10 x i8] c"127.0.0.1\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @socket_bind(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 8787)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = call i32 @listen(i32 %12, i32 5)
%14 = load i32, i32* %6
%15 = call i32 @do_select(i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @socket_bind(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 8787)
%4 = tail call i32 @listen(i32 %3, i32 5)
%5 = tail call i32 @do_select(i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ systm;

/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
int /*<<< orphan*/ STDOUT_FILENO;
void *dlopen(char *, int /*<<< orphan*/);
void *dlsym(void *, char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, void **, int);
void do_get_libc_system() {
  void *libc = dlopen("libc.so.6", RTLD_LAZY);
  void *systm = dlsym(libc, "__libc_system");
  write(STDOUT_FILENO, &systm, sizeof(systm));
}


x86 assembly (clang, -O0):
<do_get_libc_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
call   1040 <dlopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <dlsym@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_get_libc_system>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0xebf(%rip),%rdi
call   1040 <dlopen@plt>
lea    0xebd(%rip),%rsi
mov    %rax,%rdi
call   1050 <dlsym@plt>
mov    %rax,(%rsp)
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"libc.so.6\00"
@RTLD_LAZY = global i32 0
@.str.1 = [14 x i8] c"__libc_system\00"
@STDOUT_FILENO = global i32 0
define void @do_get_libc_system() {
%1 = alloca i8*
%2 = alloca i8*
%3 = load i32, i32* @RTLD_LAZY
%4 = call i8* @dlopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = call i8* @dlsym(i8* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i8* %6, i8** %2
%7 = load i32, i32* @STDOUT_FILENO
%8 = call i32 @write(i32 %7, i8** %2, i32 8)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"libc.so.6\00"
@RTLD_LAZY = global i32 0
@.str.1 = [14 x i8] c"__libc_system\00"
@STDOUT_FILENO = global i32 0
define void @do_get_libc_system() {
%1 = alloca i8*
%2 = load i32, i32* @RTLD_LAZY
%3 = tail call i8* @dlopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = bitcast i8** %1 to i8*
%5 = tail call i8* @dlsym(i8* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i8* %5, i8** %1
%6 = load i32, i32* @STDOUT_FILENO
%7 = call i32 @write(i32 %6, i8** %1, i32 8)
ret void
}
void die(val) int val;
{
  static unsigned char *leds = (unsigned char *)0x02000003;
  *leds = val;
  while (1)
    ;
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    0x2f0d(%rip),%rax
mov    %cl,(%rax)
jmp    1115 <die+0x15>

x86 assembly (clang, -O2):
<die>:
mov    %dil,0x2000003
02
nopl   0x0(%rax,%rax,1)
jmp    1110 <die+0x10>

LLVM IR (-O0):
@die.leds = internal global i8* inttoptr (i64 33554435 to i8*)
define void @die(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = load i8*, i8** @die.leds
store i8 %4, i8* %5
br label %6
6: ; preds = %1, %6
br label %6
}

LLVM IR (-O2):
define void @die(i32 %0) {
%2 = trunc i32 %0 to i8
store i8 %2, i8* inttoptr (i64 33554435 to i8*)
br label %3
3: ; preds = %1, %3
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ camera_update();
int /*<<< orphan*/ msleep(int);
void update_wait() {
  while (!camera_update())
    msleep(1);
}


x86 assembly (clang, -O0):
<update_wait>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <update_wait+0x9>
mov    $0x0,%al
call   1030 <camera_update@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1145 <update_wait+0x25>
jmp    1154 <update_wait+0x34>
mov    $0x1,%edi
call   1040 <msleep@plt>
jmp    1129 <update_wait+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_wait>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <camera_update@plt>
test   %eax,%eax
jne    1147 <update_wait+0x27>
mov    $0x1,%edi
call   1040 <msleep@plt>
jmp    1130 <update_wait+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @update_wait() {
br label %1
1: ; preds = %5, %0
%2 = call i32 (...) @camera_update()
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @msleep(i32 1)
br label %1
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @update_wait() {
%1 = tail call i32 (...) @camera_update()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0, %3
%4 = tail call i32 @msleep(i32 1)
%5 = tail call i32 (...) @camera_update()
%6 = icmp eq i32 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3, %0
ret void
}
/* Type definitions */
struct item {
  int dummy;
};

/* Variables and functions */
struct item *create_data_item_from_int(int);
struct item *get_int(int data) {
  return create_data_item_from_int(data);
}


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

x86 assembly (clang, -O2):
<get_int>:
jmp    1030 <create_data_item_from_int@plt>

LLVM IR (-O0):
%struct.item = type { i32 }
define %struct.item* @get_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call %struct.item* @create_data_item_from_int(i32 %3)
ret %struct.item* %4
}

LLVM IR (-O2):
%struct.item = type { i32 }
define %struct.item* @get_int(i32 %0) {
%2 = tail call %struct.item* @create_data_item_from_int(i32 %0)
ret %struct.item* %2
}
void screen_on(void) {}


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

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

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

LLVM IR (-O2):
define void @screen_on() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ deleteln();
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *, char);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
helpmessage() {
  move(20 + 2, 0);
  printw("Press ? for help.%c", '\007');
  refresh();
  sleep(2);
  move(20 + 2, 0);
  deleteln();
  refresh();
}


x86 assembly (clang, -O0):
<helpmessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x16,%edi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe95(%rip),%rdi
mov    $0x7,%esi
call   1030 <printw@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    $0x16,%edi
xor    %esi,%esi
call   1070 <move@plt>
mov    $0x0,%al
call   1040 <deleteln@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helpmessage>:
push   %rax
mov    $0x16,%edi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe9c(%rip),%rdi
mov    $0x7,%esi
call   1030 <printw@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    $0x16,%edi
xor    %esi,%esi
call   1070 <move@plt>
xor    %eax,%eax
call   1040 <deleteln@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <refresh@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Press ? for help.%c\00"
define i32 @helpmessage() {
%1 = alloca i32
%2 = call i32 @move(i32 22, i32 0)
%3 = call i32 @printw(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext 7)
%4 = call i32 (...) @refresh()
%5 = call i32 @sleep(i32 2)
%6 = call i32 @move(i32 22, i32 0)
%7 = call i32 (...) @deleteln()
%8 = call i32 (...) @refresh()
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [20 x i8] c"Press ? for help.%c\00"
define i32 @helpmessage() {
%1 = tail call i32 @move(i32 22, i32 0)
%2 = tail call i32 @printw(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext 7)
%3 = tail call i32 (...) @refresh()
%4 = tail call i32 @sleep(i32 2)
%5 = tail call i32 @move(i32 22, i32 0)
%6 = tail call i32 (...) @deleteln()
%7 = tail call i32 (...) @refresh()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, double *, int);
void dCopy(int n, double *s, double *d) {
  if (n)
    memcpy(d, s, n * sizeof(double));
}


x86 assembly (clang, -O0):
<dCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <dCopy+0x34>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dCopy>:
test   %edi,%edi
je     1123 <dCopy+0x13>
mov    %edi,%eax
shl    $0x3,%eax
mov    %rdx,%rdi
mov    %eax,%edx
jmp    1030 <memcpy@plt>
ret

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

LLVM IR (-O2):
define void @dCopy(i32 %0, double* %1, double* %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = shl i32 %0, 3
%7 = tail call i32 @memcpy(double* %2, double* %1, i32 %6)
br label %8
8: ; preds = %5, %3
ret void
}
void rop3_89_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = *D ^ stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_89_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_89_0_1>:
mov    %esi,%eax
not    %eax
mov    %eax,%ecx
or     %edx,%ecx
movzbl (%rdi),%r8d
xor    %r8d,%ecx
and    %ecx,%esi
and    %edx,%eax
not    %edx
and    %ecx,%edx
and    %r8d,%eax
or     %esi,%eax
or     %edx,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_89_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = xor i32 %11, -1
%13 = trunc i32 %12 to i8
store i8 %13, i8* %9
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = load i8, i8* %9
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = xor i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = and i32 %28, %30
%32 = load i8, i8* %7
%33 = zext i8 %32 to i32
%34 = load i8, i8* %6
%35 = zext i8 %34 to i32
%36 = xor i32 %35, -1
%37 = and i32 %33, %36
%38 = or i32 %31, %37
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = load i8, i8* %5
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = and i32 %44, %47
%49 = or i32 %38, %48
%50 = trunc i32 %49 to i8
%51 = load i8*, i8** %4
store i8 %50, i8* %51
ret void
}

LLVM IR (-O2):
define void @rop3_89_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %1 to i32
%5 = xor i32 %4, -1
%6 = zext i8 %2 to i32
%7 = trunc i32 %5 to i8
%8 = or i8 %7, %2
%9 = load i8, i8* %0
%10 = zext i8 %9 to i32
%11 = xor i8 %9, %8
%12 = zext i8 %11 to i32
%13 = and i8 %11, %1
%14 = zext i8 %13 to i32
%15 = xor i32 %6, -1
%16 = and i32 %12, %15
%17 = and i32 %6, %5
%18 = and i32 %17, %10
%19 = or i32 %18, %14
%20 = or i32 %19, %16
%21 = trunc i32 %20 to i8
store i8 %21, i8* %0
ret void
}
double bfield_scale_factor(double x, int dim) {
  if (dim == 0)
    return 1.0 / x;
  else
    return 1.0;
}


x86 assembly (clang, -O0):
<bfield_scale_factor>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    112d <bfield_scale_factor+0x2d>
movsd  0xee2(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    113a <bfield_scale_factor+0x3a>
movsd  0xecb(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bfield_scale_factor>:
test   %edi,%edi
je     110d <bfield_scale_factor+0xd>
movsd  0xef4(%rip),%xmm0
ret
movapd %xmm0,%xmm1
movsd  0xee7(%rip),%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @bfield_scale_factor(double %0, i32 %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load double, double* %4
%10 = fdiv double 1.000000e+00, %9
store double %10, double* %3
br label %12
11: ; preds = %2
store double 1.000000e+00, double* %3
br label %12
12: ; preds = %11, %8
%13 = load double, double* %3
ret double %13
}

LLVM IR (-O2):
define double @bfield_scale_factor(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = fdiv double 1.000000e+00, %0
%5 = select i1 %3, double %4, double 1.000000e+00
ret double %5
}
/* Variables and functions */
scalar_t__ strlen(char *);
int input_overflow(char *string, char *input) {
  if (strlen(input) > strlen(string))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<input_overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jle    1152 <input_overflow+0x42>
movl   $0x1,-0x4(%rbp)
jmp    1159 <input_overflow+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_overflow>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %ecx,%ecx
cmp    %rax,%r14
setg   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @input_overflow(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = icmp sgt i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *myself) {
  printf("Usage: %s <bootblock> <disk> <partition or '*'>\n", myself);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"Usage: %s <bootblock> <disk> <partition or '*'>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"Usage: %s <bootblock> <disk> <partition or '*'>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
size_t strnlen(const char *str, size_t len) {
  register const char *ptr;
  for (ptr = str; *ptr && len--; ++ptr)
    ;
  return (ptr - str);
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1142 <strnlen+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1152 <strnlen+0x52>
jmp    1168 <strnlen+0x68>
jmp    1157 <strnlen+0x57>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strnlen+0x14>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
cmpb   $0x0,(%rdi)
mov    %rdi,%rax
je     1135 <strnlen+0x35>
mov    %rdi,%rax
test   %rsi,%rsi
je     1135 <strnlen+0x35>
add    $0xffffffffffffffff,%rsi
mov    %rdi,%rax
nopw   0x0(%rax,%rax,1)
sub    $0x1,%rsi
setb   %cl
cmpb   $0x0,0x1(%rax)
lea    0x1(%rax),%rax
je     1135 <strnlen+0x35>
test   %cl,%cl
je     1120 <strnlen+0x20>
sub    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @strnlen(i8* %0, i64 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
%5 = icmp eq i64 %1, 0
%6 = or i1 %4, %5
br i1 %6, label %16, label %7
7: ; preds = %2, %7
%8 = phi i8* [ %11, %7 ], [ %0, %2 ]
%9 = phi i64 [ %10, %7 ], [ %1, %2 ]
%10 = add i64 %9, -1
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = icmp eq i64 %10, 0
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %7
16: ; preds = %7, %2
%17 = phi i8* [ %0, %2 ], [ %11, %7 ]
%18 = ptrtoint i8* %17 to i64
%19 = ptrtoint i8* %0 to i64
%20 = sub i64 %18, %19
ret i64 %20
}
float obdConvert_43(unsigned int A, unsigned int B, unsigned int C,
                    unsigned int D) {
  return ((float)A * 256.0f + (float)B) * 100.0f / 255.0f;
}


x86 assembly (clang, -O0):
<obdConvert_43>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2ss %rax,%xmm0
mov    -0x8(%rbp),%eax
cvtsi2ss %rax,%xmm1
movss  0xee0(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xecc(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xebc(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obdConvert_43>:
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
mov    %esi,%eax
cvtsi2ss %rax,%xmm1
mulss  0xeea(%rip),%xmm0
addss  %xmm1,%xmm0
mulss  0xee2(%rip),%xmm0
divss  0xede(%rip),%xmm0
ret

LLVM IR (-O0):
define float @obdConvert_43(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = uitofp i32 %9 to float
%11 = load i32, i32* %6
%12 = uitofp i32 %11 to float
%13 = call float @llvm.fmuladd.f32(float %10, float 2.560000e+02, float %12)
%14 = fmul float %13, 1.000000e+02
%15 = fdiv float %14, 2.550000e+02
ret float %15
}

LLVM IR (-O2):
define float @obdConvert_43(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = uitofp i32 %0 to float
%6 = uitofp i32 %1 to float
%7 = tail call float @llvm.fmuladd.f32(float %5, float 2.560000e+02, float %6)
%8 = fmul float %7, 1.000000e+02
%9 = fdiv float %8, 2.550000e+02
ret float %9
}
__attribute__((always_)) int
unregister_mem_sect_under_nodes(struct memory_block *mem_blk) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.memory_block = type opaque
define i32 @unregister_mem_sect_under_nodes(%struct.memory_block* nocapture readnone %0) {
ret i32 0
}
int graytobi(int n) {
  int tmp = n;
  while (n >>= 1) {
    tmp ^= n;
  }
  return tmp;
}


x86 assembly (clang, -O0):
<graytobi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     112d <graytobi+0x2d>
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110d <graytobi+0xd>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<graytobi>:
mov    %edi,%ecx
mov    %edi,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%eax
sar    %edx
xor    %edx,%ecx
cmp    $0x1,%edi
mov    %edx,%edi
ja     1110 <graytobi+0x10>
ret

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

LLVM IR (-O2):
define i32 @graytobi(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %5, %2 ]
%4 = phi i32 [ %0, %1 ], [ %7, %2 ]
%5 = ashr i32 %3, 1
%6 = icmp ult i32 %3, 2
%7 = xor i32 %4, %5
br i1 %6, label %8, label %2
8: ; preds = %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ hook_signal_send(char *, char *, int /*<<< orphan*/ *);
void gui_hotlist_changed_signal() {
  hook_signal_send("hotlist_changed", "string", NULL);
}


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

x86 assembly (clang, -O2):
<gui_hotlist_changed_signal>:
lea    0xee9(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %edx,%edx
jmp    1030 <hook_signal_send@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"hotlist_changed\00"
@.str.1 = [7 x i8] c"string\00"
define void @gui_hotlist_changed_signal() {
%1 = call i32 @hook_signal_send(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"hotlist_changed\00"
@.str.1 = [7 x i8] c"string\00"
define void @gui_hotlist_changed_signal() {
%1 = tail call i32 @hook_signal_send(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
/* Variables and functions */
char *DES_fcrypt(char const *, char const *, char *);
char *DES_crypt(const char *buf, const char *salt) {
  static char buff[14];
  return (DES_fcrypt(buf, salt, buff));
}


x86 assembly (clang, -O0):
<DES_crypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0x2efa(%rip),%rdx
call   1030 <DES_fcrypt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DES_crypt>:
lea    0x2f12(%rip),%rdx
jmp    1030 <DES_fcrypt@plt>

LLVM IR (-O0):
@DES_crypt.buff = internal global [14 x i8] zeroinitializer
define i8* @DES_crypt(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 i8* @DES_fcrypt(i8* %5, i8* %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @DES_crypt.buff, i64 0, i64 0))
ret i8* %7
}

LLVM IR (-O2):
@DES_crypt.buff = internal global [14 x i8] zeroinitializer
define i8* @DES_crypt(i8* %0, i8* %1) {
%3 = tail call i8* @DES_fcrypt(i8* %0, i8* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @DES_crypt.buff, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ f(char *, char *);
int main(int ac, char *av[]) {
  f("%s", "str");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"str\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @f(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"str\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @f(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ adc08d1020_calrun_stat();
int /*<<< orphan*/ adc08d1020_write_reg(int, int);
void cal_adc08d1020() {
  adc08d1020_write_reg(0x9, 0x43FF);
  adc08d1020_write_reg(0x0, 0xFFFF);
  adc08d1020_write_reg(0x0, 0x7FFF);
  adc08d1020_write_reg(0x9, 0x03FF);
  while (adc08d1020_calrun_stat())
    ;
}


x86 assembly (clang, -O0):
<cal_adc08d1020>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
mov    $0x43ff,%esi
call   1030 <adc08d1020_write_reg@plt>
xor    %edi,%edi
mov    $0xffff,%esi
call   1030 <adc08d1020_write_reg@plt>
xor    %edi,%edi
mov    $0x7fff,%esi
call   1030 <adc08d1020_write_reg@plt>
mov    $0x9,%edi
mov    $0x3ff,%esi
call   1030 <adc08d1020_write_reg@plt>
mov    $0x0,%al
call   1040 <adc08d1020_calrun_stat@plt>
cmp    $0x0,%rax
je     1170 <cal_adc08d1020+0x50>
jmp    115a <cal_adc08d1020+0x3a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_adc08d1020>:
push   %rax
mov    $0x9,%edi
mov    $0x43ff,%esi
call   1030 <adc08d1020_write_reg@plt>
xor    %edi,%edi
mov    $0xffff,%esi
call   1030 <adc08d1020_write_reg@plt>
xor    %edi,%edi
mov    $0x7fff,%esi
call   1030 <adc08d1020_write_reg@plt>
mov    $0x9,%edi
mov    $0x3ff,%esi
call   1030 <adc08d1020_write_reg@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <adc08d1020_calrun_stat@plt>
test   %rax,%rax
jne    1160 <cal_adc08d1020+0x40>
pop    %rax
ret

LLVM IR (-O0):
define void @cal_adc08d1020() {
%1 = call i32 @adc08d1020_write_reg(i32 9, i32 17407)
%2 = call i32 @adc08d1020_write_reg(i32 0, i32 65535)
%3 = call i32 @adc08d1020_write_reg(i32 0, i32 32767)
%4 = call i32 @adc08d1020_write_reg(i32 9, i32 1023)
br label %5
5: ; preds = %8, %0
%6 = call i64 (...) @adc08d1020_calrun_stat()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
br label %5
9: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @cal_adc08d1020() {
%1 = tail call i32 @adc08d1020_write_reg(i32 9, i32 17407)
%2 = tail call i32 @adc08d1020_write_reg(i32 0, i32 65535)
%3 = tail call i32 @adc08d1020_write_reg(i32 0, i32 32767)
%4 = tail call i32 @adc08d1020_write_reg(i32 9, i32 1023)
br label %5
5: ; preds = %5, %0
%6 = tail call i64 (...) @adc08d1020_calrun_stat()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %5
8: ; preds = %5
ret void
}
/* Variables and functions */
int max(int, int);
int max3(int i, int j, int k) { return max(max(i, j), k); }


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

x86 assembly (clang, -O2):
<max3>:
push   %rbx
mov    %edx,%ebx
call   1030 <max@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <max@plt>

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

LLVM IR (-O2):
define i32 @max3(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @max(i32 %0, i32 %1)
%5 = tail call i32 @max(i32 %4, i32 %2)
ret i32 %5
}
/* Variables and functions */
int CHAR_BIT;
unsigned setbits(unsigned x, int p, int n, unsigned y) {
  return x |
         ((y << (sizeof(int) * CHAR_BIT - n)) >> (sizeof(int) * CHAR_BIT - n))
             << (p + 1 - n);
}


x86 assembly (clang, -O0):
<setbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%edx
mov    0x2ec3(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
movslq -0xc(%rbp),%rsi
sub    %rsi,%rcx
shl    %cl,%edx
mov    0x2eac(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x2,%rcx
movslq -0xc(%rbp),%rsi
sub    %rsi,%rcx
shr    %cl,%edx
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbits>:
mov    %ecx,%eax
mov    0x2ed7(%rip),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
sub    %edx,%ecx
shl    %cl,%eax
shr    %cl,%eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shl    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %8
%11 = load i32, i32* @CHAR_BIT
%12 = sext i32 %11 to i64
%13 = mul i64 4, %12
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = sub i64 %13, %15
%17 = trunc i64 %16 to i32
%18 = shl i32 %10, %17
%19 = load i32, i32* @CHAR_BIT
%20 = sext i32 %19 to i64
%21 = mul i64 4, %20
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = sub i64 %21, %23
%25 = trunc i64 %24 to i32
%26 = lshr i32 %18, %25
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %7
%30 = sub nsw i32 %28, %29
%31 = shl i32 %26, %30
%32 = or i32 %9, %31
ret i32 %32
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @CHAR_BIT
%6 = shl i32 %5, 2
%7 = sub i32 %6, %2
%8 = lshr i32 -1, %7
%9 = and i32 %8, %3
%10 = add nsw i32 %1, 1
%11 = sub i32 %10, %2
%12 = shl i32 %9, %11
%13 = or i32 %12, %0
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ inputs_equal_ref_minus_k_times_states();
int /*<<< orphan*/ states_equals_A_states_plus_B_inputs();
fxp_ss_closed_loop_quantization_error() {
  inputs_equal_ref_minus_k_times_states();
  states_equals_A_states_plus_B_inputs();
}


x86 assembly (clang, -O0):
<fxp_ss_closed_loop_quantization_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <inputs_equal_ref_minus_k_times_states@plt>
mov    $0x0,%al
call   1030 <states_equals_A_states_plus_B_inputs@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fxp_ss_closed_loop_quantization_error>:
push   %rax
xor    %eax,%eax
call   1040 <inputs_equal_ref_minus_k_times_states@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <states_equals_A_states_plus_B_inputs@plt>

LLVM IR (-O0):
define i32 @fxp_ss_closed_loop_quantization_error() {
%1 = alloca i32
%2 = call i32 (...) @inputs_equal_ref_minus_k_times_states()
%3 = call i32 (...) @states_equals_A_states_plus_B_inputs()
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @fxp_ss_closed_loop_quantization_error() {
%1 = tail call i32 (...) @inputs_equal_ref_minus_k_times_states()
%2 = tail call i32 (...) @states_equals_A_states_plus_B_inputs()
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ perror(char *);
void armFinalizationCode(FILE *fp) {
  fprintf(fp, "; finalization\nb beginning\nandeq r0, r0, r0\n");
  if (ferror(fp)) {
    perror("fprintf error in armFinalizationCode\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<armFinalizationCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1189 <armFinalizationCode+0x49>
lea    0xeb7(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<armFinalizationCode>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    116c <armFinalizationCode+0x2c>
pop    %rbx
ret
lea    0xeba(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"; finalization\0Ab beginning\0Aandeq r0, r0, r0\0A\00"
@.str.1 = [38 x i8] c"fprintf error in armFinalizationCode\0A\00"
@EXIT_FAILURE = global i32 0
define void @armFinalizationCode(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i64 @ferror(i32* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"; finalization\0Ab beginning\0Aandeq r0, r0, r0\0A\00"
@.str.1 = [38 x i8] c"fprintf error in armFinalizationCode\0A\00"
@EXIT_FAILURE = global i32 0
define void @armFinalizationCode(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 44, i64 1, i32* %0)
%3 = tail call i64 @ferror(i32* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret void
}
int deinit(void) {
  debug_printf(3,
               "[INFO] %s:%d (%s): "
               "Deregistering module %s"
               "\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/rpedde/evgopherd/refs/heads/"
               "master/src/plugin-dir.c",
               31, __FUNCTION__, "dir");
  return 1;
}


x86 assembly (clang, -O0):
<deinit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
lea    0xee0(%rip),%rsi
lea    0xf05(%rip),%rdx
mov    $0x1f,%ecx
lea    0xf87(%rip),%r8
lea    0xf87(%rip),%r9
mov    $0x0,%al
call   1030 <debug_printf@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<deinit>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xf0d(%rip),%rdx
lea    0xf94(%rip),%r8
lea    0xf94(%rip),%r9
mov    $0x3,%edi
mov    $0x1f,%ecx
xor    %eax,%eax
call   1030 <debug_printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"[INFO] %s:%d (%s): Deregistering module %s\0A\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rpedde/evgopherd/refs/heads/master/src/plugin-dir.c\00"
@__FUNCTION__.deinit = [7 x i8] c"deinit\00"
@.str.2 = [4 x i8] c"dir\00"
define i32 @deinit() {
%1 = call i32 (i32, i8*, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @debug_printf to i32 (i32, i8*, i8*, i32, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.deinit, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [44 x i8] c"[INFO] %s:%d (%s): Deregistering module %s\0A\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rpedde/evgopherd/refs/heads/master/src/plugin-dir.c\00"
@__FUNCTION__.deinit = [7 x i8] c"deinit\00"
@.str.2 = [4 x i8] c"dir\00"
define i32 @deinit() {
%1 = tail call i32 (i32, i8*, i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @debug_printf to i32 (i32, i8*, i8*, i32, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__FUNCTION__.deinit, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double square(int);
int main() {
  int a = 13;
  double b = square(a);
  printf("%f\n", b);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call double @square(i32 13)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
/* Variables and functions */
double drnd();
double dpn1() { return ((drnd() * 2.0) - 1.0); }


x86 assembly (clang, -O0):
<dpn1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <drnd@plt>
addsd  %xmm0,%xmm0
movsd  0xed9(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpn1>:
push   %rax
xor    %eax,%eax
call   1030 <drnd@plt>
addsd  %xmm0,%xmm0
addsd  0xedc(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @dpn1() {
%1 = call double (...) @drnd()
%2 = call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double -1.000000e+00)
ret double %2
}

LLVM IR (-O2):
define double @dpn1() {
%1 = tail call double (...) @drnd()
%2 = tail call double @llvm.fmuladd.f64(double %1, double 2.000000e+00, double -1.000000e+00)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
void sprint_movx_atRi(char *str, unsigned char i) {
  sprintf(str, "MOVX  A, @R%X                    ", i);
}


x86 assembly (clang, -O0):
<sprint_movx_atRi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
movzbl -0x9(%rbp),%edx
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_movx_atRi>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"MOVX A, @R%X \00"
define void @sprint_movx_atRi(i8* %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 = load i8, i8* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"MOVX A, @R%X \00"
define void @sprint_movx_atRi(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
void error_buffer_index(void *client_state) {}


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

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

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

LLVM IR (-O2):
define void @error_buffer_index(i8* nocapture %0) {
ret void
}
/* Variables and functions */
double erf(double);
int /*<<< orphan*/ printf(char *, double);
double sqrt(int);
int main(int argc, char const *argv[]) {
  printf("The integral of a Normal(0, 1) distribution between -1.96 and 1.96 "
         "is: %g\n",
         erf(1.96 * sqrt(1 / 2.)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xea8(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <erf@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <sqrt@plt>
mulsd  0xec0(%rip),%xmm0
call   1050 <erf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [75 x i8] c"The integral of a Normal(0, 1) distribution between -1.96 and 1.96 is: %g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call double @sqrt(i32 0)
%7 = fmul double 1.960000e+00, %6
%8 = call double @erf(double %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [75 x i8] c"The integral of a Normal(0, 1) distribution between -1.96 and 1.96 is: %g\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @sqrt(i32 0)
%4 = fmul double %3, 1.960000e+00
%5 = tail call double @erf(double %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), double %5)
ret i32 0
}
/* Variables and functions */
scalar_t__ unknown();
scalar_t__ unknown_nohalt();
int test19() { (void)(unknown_nohalt() && unknown()); }


x86 assembly (clang, -O0):
<test19>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <unknown_nohalt@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
je     1152 <test19+0x32>
mov    $0x0,%al
call   1030 <unknown@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test19>:
push   %rax
xor    %eax,%eax
call   1040 <unknown_nohalt@plt>
test   %rax,%rax
je     1134 <test19+0x14>
xor    %eax,%eax
call   1030 <unknown@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test19() {
%1 = alloca i32
%2 = call i64 (...) @unknown_nohalt()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i64 (...) @unknown()
%6 = icmp ne i64 %5, 0
br label %7
7: ; preds = %4, %0
%8 = phi i1 [ false, %0 ], [ %6, %4 ]
%9 = zext i1 %8 to i32
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @test19() {
%1 = tail call i64 (...) @unknown_nohalt()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i64 (...) @unknown()
br label %5
5: ; preds = %3, %0
ret i32 undef
}
/* Variables and functions */
bool compare_int(int a, int b) { return a == b; }


x86 assembly (clang, -O0):
<compare_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_int>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @compare_int(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 eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @compare_int(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}