xunge/DecIR huggingface dataset:
char *get_buffer(void) {
  static char buffer[4][32];
  static int bufindex = 0;
  return buffer[3 & (++bufindex)];
}


x86 assembly (clang, -O0):
<get_buffer>:
push   %rbp
mov    %rsp,%rbp
mov    0x2fa6(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f9d(%rip)
and    $0x3,%eax
movslq %eax,%rcx
lea    0x2f10(%rip),%rax
shl    $0x5,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_buffer>:
mov    0x2faa(%rip),%ecx
add    $0x1,%ecx
mov    %ecx,0x2fa1(%rip)
and    $0x3,%ecx
shl    $0x5,%rcx
lea    0x2f13(%rip),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@get_buffer.buffer = internal global [4 x [32 x i8]] zeroinitializer
@get_buffer.bufindex = internal global i32 0
define i8* @get_buffer() {
%1 = load i32, i32* @get_buffer.bufindex
%2 = add nsw i32 %1, 1
store i32 %2, i32* @get_buffer.bufindex
%3 = and i32 3, %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [4 x [32 x i8]], [4 x [32 x i8]]* @get_buffer.buffer, i64 0, i64 %4
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
ret i8* %6
}

LLVM IR (-O2):
@get_buffer.buffer = internal global [4 x [32 x i8]] zeroinitializer
@get_buffer.bufindex = internal unnamed_addr global i32 0
define i8* @get_buffer() {
%1 = load i32, i32* @get_buffer.bufindex
%2 = add nsw i32 %1, 1
store i32 %2, i32* @get_buffer.bufindex
%3 = and i32 %2, 3
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [4 x [32 x i8]], [4 x [32 x i8]]* @get_buffer.buffer, i64 0, i64 %4, i64 0
ret i8* %5
}
double epj2ep(epoch)
double epoch;
{
  double dj;
  dj = epj2jd(epoch);
  return (jd2ep(dj));
}


x86 assembly (clang, -O0):
<epj2ep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1040 <epj2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <jd2ep@plt>
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epj2ep>:
push   %rax
mov    $0x1,%al
call   1040 <epj2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0x1,%al
call   1030 <jd2ep@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @epj2ep(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 (double, ...) bitcast (i32 (...)* @epj2jd to i32 (double, ...)*)(double %4)
%6 = sitofp i32 %5 to double
store double %6, double* %3
%7 = load double, double* %3
%8 = call i32 (double, ...) bitcast (i32 (...)* @jd2ep to i32 (double, ...)*)(double %7)
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @epj2ep(double %0) {
%2 = tail call i32 (double, ...) bitcast (i32 (...)* @epj2jd to i32 (double, ...)*)(double %0)
%3 = sitofp i32 %2 to double
%4 = tail call i32 (double, ...) bitcast (i32 (...)* @jd2ep to i32 (double, ...)*)(double %3)
%5 = sitofp i32 %4 to double
ret double %5
}
long long get_and_sub(long long *ptr, long long val) {
  return __atomic_fetch_sub(ptr, val, 5);
}


x86 assembly (clang, -O0):
<get_and_sub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
neg    %rax
lock xadd %rax,(%rcx)
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_and_sub>:
mov    %rsi,%rax
neg    %rax
lock xadd %rax,(%rdi)
ret

LLVM IR (-O0):
define i64 @get_and_sub(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%7 = load i64*, i64** %3
%8 = load i64, i64* %4
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = atomicrmw sub i64* %7, i64 %9 seq_cst
store i64 %10, i64* %6
%11 = load i64, i64* %6
ret i64 %11
}

LLVM IR (-O2):
define i64 @get_and_sub(i64* nocapture %0, i64 %1) {
%3 = atomicrmw sub i64* %0, i64 %1 seq_cst
ret i64 %3
}
/* Type definitions */
typedef int mode_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
mode_t __umask(mode_t mask) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__umask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__umask>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__umask(i32 %0) {
%2 = load i32, i32* @ENOSYS
%3 = tail call i32 @__set_errno(i32 %2)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void close_term() { endwin(); }


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

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

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

LLVM IR (-O2):
define void @close_term() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMRCD_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRCD_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMRCD_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *xcam_new0(size_t size) {
  void *buf = malloc(size);
  memset(buf, 0, size);
  return buf;
}


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

x86 assembly (clang, -O2):
<xcam_new0>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xcam_new0(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i32 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @xcam_new0(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
void XFreeStringList() {}


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

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

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

LLVM IR (-O2):
define void @XFreeStringList() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int main(void) {
  unsigned int x;
  while (x < 0x0fffffff) {
    x++;
  }
  __VERIFIER_assert(x >= 0x0fffffff);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xfffffff,-0x8(%rbp)
jae    113a <main+0x2a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <main+0xf>
cmpl   $0xfffffff,-0x8(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp ult i32 %4, 268435455
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = load i32, i32* %2
%11 = icmp uge i32 %10, 268435455
%12 = zext i1 %11 to i32
%13 = call i32 @__VERIFIER_assert(i32 %12)
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @__VERIFIER_assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void prnTitles() {
  printf("UPC  | Name               |   Price   |   Tax   |   Total\n"
         "-----+--------------------+-----------+---------+----------- \n");
}


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

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

LLVM IR (-O0):
@.str = [121 x i8] c"UPC | Name | Price | Tax | Total\0A-----+--------------------+-----------+---------+----------- \0A\00"
define void @prnTitles() {
%1 = call i32 @printf(i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [120 x i8] c"UPC | Name | Price | Tax | Total\0A-----+--------------------+-----------+---------+----------- \00"
define void @prnTitles() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([120 x i8], [120 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int service_rtsp_init(char *ip, int sp, unsigned char options, char *miscptr,
                      FILE *fp, int port) {
  return 0;
}


x86 assembly (clang, -O0):
<service_rtsp_init>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @service_rtsp_init(i8* %0, i32 %1, i8 zeroext %2, i8* %3, i32* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8 %2, i8* %9
store i8* %3, i8** %10
store i32* %4, i32** %11
store i32 %5, i32* %12
ret i32 0
}

LLVM IR (-O2):
define i32 @service_rtsp_init(i8* nocapture readnone %0, i32 %1, i8 zeroext %2, i8* nocapture readnone %3, i32* nocapture readnone %4, i32 %5) {
ret i32 0
}
/* Type definitions */
struct sip_msg {
  int dummy;
};

/* Variables and functions */
int check_routing(struct sip_msg *, int /*<<< orphan*/);
int allow_routing_0(struct sip_msg *msg, char *str1, char *str2) {
  return check_routing(msg, 0);
}


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

x86 assembly (clang, -O2):
<allow_routing_0>:
xor    %esi,%esi
jmp    1030 <check_routing@plt>

LLVM IR (-O0):
%struct.sip_msg = type { i32 }
define i32 @allow_routing_0(%struct.sip_msg* %0, i8* %1, i8* %2) {
%4 = alloca %struct.sip_msg*
%5 = alloca i8*
%6 = alloca i8*
store %struct.sip_msg* %0, %struct.sip_msg** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.sip_msg*, %struct.sip_msg** %4
%8 = call i32 @check_routing(%struct.sip_msg* %7, i32 0)
ret i32 %8
}

LLVM IR (-O2):
%struct.sip_msg = type { i32 }
define i32 @allow_routing_0(%struct.sip_msg* %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @check_routing(%struct.sip_msg* %0, i32 0)
ret i32 %4
}
void rotr(int *a, int *b, int *c) {
  int temp, temp2;
  temp = *a;
  *a = *c;
  temp2 = *b;
  *b = temp;
  *c = temp2;
}


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

x86 assembly (clang, -O2):
<rotr>:
mov    (%rdi),%eax
mov    (%rdx),%ecx
mov    %ecx,(%rdi)
mov    (%rsi),%ecx
mov    %eax,(%rsi)
mov    %ecx,(%rdx)
ret

LLVM IR (-O0):
define void @rotr(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
store i32 %10, i32* %7
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = load i32*, i32** %4
store i32 %12, i32* %13
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
store i32 %15, i32* %8
%16 = load i32, i32* %7
%17 = load i32*, i32** %5
store i32 %16, i32* %17
%18 = load i32, i32* %8
%19 = load i32*, i32** %6
store i32 %18, i32* %19
ret void
}

LLVM IR (-O2):
define void @rotr(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %2
store i32 %5, i32* %0
%6 = load i32, i32* %1
store i32 %4, i32* %1
store i32 %6, i32* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
void c_pclose_(FILE **fp) { pclose(*fp); }


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

x86 assembly (clang, -O2):
<c_pclose_>:
mov    (%rdi),%rdi
jmp    1030 <pclose@plt>

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

LLVM IR (-O2):
define void @c_pclose_(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = tail call i32 @pclose(i32* %2)
ret void
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
bool less(void *left_data, void *right_data) {
  if ((int64_t)left_data < (int64_t)right_data) {
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<less>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jge    1129 <less+0x29>
movl   $0x1,-0x4(%rbp)
jmp    1130 <less+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<less>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @less(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** %4
%7 = ptrtoint i8* %6 to i64
%8 = load i8*, i8** %5
%9 = ptrtoint i8* %8 to i64
%10 = icmp slt 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 @less(i8* readnone %0, i8* readnone %1) {
%3 = icmp slt i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, size_t);
size_t write(int, char *, int);
int main() {
  size_t ret;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
  ret = write(1, "hello", 5);
#pragma clang diagnostic pop
  printf("\nret:%lu\n", ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xec5(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0x5,%edx
call   1030 <write@plt>
lea    0xec8(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [10 x i8] c"\0Aret:%lu\0A\00"
define i32 @main() {
%1 = tail call i64 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 %1)
ret i32 0
}
int exact_square(int n) {
  int i;
  if (n == 0 || n == 1)
    return 1;
  for (i = 2; i < n; i++) {
    if (i * i == n)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111b <exact_square+0x1b>
cmpl   $0x1,-0x8(%rbp)
jne    1127 <exact_square+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1170 <exact_square+0x70>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1169 <exact_square+0x69>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1156 <exact_square+0x56>
movl   $0x1,-0x4(%rbp)
jmp    1170 <exact_square+0x70>
jmp    115b <exact_square+0x5b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112e <exact_square+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1132 <exact_square+0x32>
cmp    $0x3,%edi
jl     1130 <exact_square+0x30>
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%edx
imul   %ecx,%edx
cmp    %edi,%edx
je     1132 <exact_square+0x32>
add    $0x1,%ecx
cmp    %ecx,%edi
jne    1120 <exact_square+0x20>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp sgt i32 %0, 2
br i1 %4, label %7, label %12
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = mul nsw i32 %8, %8
%10 = icmp eq i32 %9, %0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 1, %1 ], [ 0, %3 ], [ 1, %7 ], [ 0, %5 ]
ret i32 %13
}
/* Variables and functions */
int f(int /*<<< orphan*/);
int main() {
  int a, b, c;
  if (a) {
    b = 0;
    c = f(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113a <main+0x2a>
movl   $0x0,-0xc(%rbp)
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned char uchar_clamp(double clr, unsigned char max) {
  unsigned short result;
  result = (unsigned short)(short)(clr + 0.5);
  if (result > max) {
    result = (clr < 0) ? 0 : max;
  }
  return (unsigned char)result;
}


x86 assembly (clang, -O0):
<uchar_clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
movsd  %xmm0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %ax,-0xc(%rbp)
movzwl -0xc(%rbp),%eax
movzbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jle    115e <uchar_clamp+0x5e>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1150 <uchar_clamp+0x50>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <uchar_clamp+0x57>
movzbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %ax,-0xc(%rbp)
mov    -0xc(%rbp),%ax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uchar_clamp>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ecx
xor    %eax,%eax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
cmovbe %edi,%eax
cmp    %di,%cx
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @uchar_clamp(double %0, i8 zeroext %1) {
%3 = alloca double
%4 = alloca i8
%5 = alloca i16
store double %0, double* %3
store i8 %1, i8* %4
%6 = load double, double* %3
%7 = fadd double %6, 5.000000e-01
%8 = fptosi double %7 to i16
store i16 %8, i16* %5
%9 = load i16, i16* %5
%10 = zext i16 %9 to i32
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = icmp sgt i32 %10, %12
br i1 %13, label %14, label %24
14: ; preds = %2
%15 = load double, double* %3
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %14
br label %21
18: ; preds = %14
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
br label %21
21: ; preds = %18, %17
%22 = phi i32 [ 0, %17 ], [ %20, %18 ]
%23 = trunc i32 %22 to i16
store i16 %23, i16* %5
br label %24
24: ; preds = %21, %2
%25 = load i16, i16* %5
%26 = trunc i16 %25 to i8
ret i8 %26
}

LLVM IR (-O2):
define zeroext i8 @uchar_clamp(double %0, i8 zeroext %1) {
%3 = fadd double %0, 5.000000e-01
%4 = fptosi double %3 to i16
%5 = zext i8 %1 to i16
%6 = icmp ugt i16 %4, %5
%7 = fcmp olt double %0, 0.000000e+00
%8 = select i1 %7, i16 0, i16 %5
%9 = select i1 %6, i16 %8, i16 %4
%10 = trunc i16 %9 to i8
ret i8 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz8_set_int(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/, int,
                                int /*<<< orphan*/);
void mpz8_set_div(mpz_t z[8]) { mpz8_set_int(z, 0, 1, 0, 0, 0, 0, 1, 0); }


x86 assembly (clang, -O0):
<mpz8_set_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %r9d,%r9d
mov    $0x1,%edx
mov    %r9d,%esi
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <mpz8_set_int@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpz8_set_div>:
push   %rax
sub    $0x8,%rsp
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x1
push   $0x0
call   1030 <mpz8_set_int@plt>
add    $0x20,%rsp
pop    %rax
ret

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

LLVM IR (-O2):
define void @mpz8_set_div(i32* %0) {
%2 = tail call i32 @mpz8_set_int(i32* %0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ areaCircle(float, double *);
int /*<<< orphan*/ printf(char *, float, double);
int main(int argc, const char *argv[]) {
  float radius = 5;
  double area;
  areaCircle(radius, &area);
  printf("the are of %f radius circle is %f .\n", radius, area);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <areaCircle@plt>
movss  -0x14(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movss  0xed7(%rip),%xmm0
mov    %rsp,%rdi
call   1030 <areaCircle@plt>
movsd  (%rsp),%xmm1
lea    0xec7(%rip),%rdi
movss  0xebb(%rip),%xmm0
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"the are of %f radius circle is %f .\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 5.000000e+00, float* %6
%8 = load float, float* %6
%9 = call i32 @areaCircle(float %8, double* %7)
%10 = load float, float* %6
%11 = load double, double* %7
%12 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), float %10, double %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"the are of %f radius circle is %f .\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @areaCircle(float 5.000000e+00, double* %3)
%6 = load double, double* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), float 5.000000e+00, double %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *safe_free(void *ptr) {
  if (ptr == NULL)
    return NULL;
  free(ptr);
  return NULL;
}


x86 assembly (clang, -O0):
<safe_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <safe_free+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1145 <safe_free+0x35>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_free>:
test   %rdi,%rdi
je     111f <safe_free+0xf>
push   %rax
call   1030 <free@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @safe_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %1, %3
ret i8* null
}
void PS_NullCoordVMirror(void) {}


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

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

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

LLVM IR (-O2):
define void @PS_NullCoordVMirror() {
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t clamp(int32_t val, int32_t min, int32_t max) {
  return ((val < min) ? min : (val > max) ? max : val);
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    112b <clamp+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1156 <clamp+0x56>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1146 <clamp+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    114e <clamp+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
mov    %rdx,%rax
cmp    %rdx,%rdi
cmovle %rdi,%rax
cmp    %rsi,%rdi
cmovl  %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @clamp(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %0, %1
%5 = icmp sgt i64 %0, %2
%6 = select i1 %5, i64 %2, i64 %0
%7 = select i1 %4, i64 %1, i64 %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ CALC_appendString(char *);
void CALC_addLog() {
  CALC_appendString("log");
  CALC_appendString("(");
}


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

x86 assembly (clang, -O2):
<CALC_addLog>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <CALC_appendString@plt>
lea    0xee0(%rip),%rdi
pop    %rax
jmp    1030 <CALC_appendString@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"log\00"
@.str.1 = [2 x i8] c"(\00"
define void @CALC_addLog() {
%1 = tail call i32 @CALC_appendString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @CALC_appendString(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rd_write_file(int fd, void *ptr, int len) { return 0; }


x86 assembly (clang, -O0):
<rd_write_file>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @rd_write_file(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
char **openssl_get_certs();
int /*<<< orphan*/ safe_free_strs(char **);
int /*<<< orphan*/ storage_save(char *, char **);
void auth_ssl_save(int server) {
  char **str = openssl_get_certs();
  storage_save(server ? "accept" : "connect", str);
  safe_free_strs(str);
}


x86 assembly (clang, -O0):
<auth_ssl_save>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <openssl_get_certs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
lea    0xeb7(%rip),%rdi
lea    0xea9(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <storage_save@plt>
mov    -0x10(%rbp),%rdi
call   1050 <safe_free_strs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auth_ssl_save>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <openssl_get_certs@plt>
mov    %rax,%rbx
test   %ebp,%ebp
lea    0xebf(%rip),%rax
lea    0xeb1(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
call   1040 <storage_save@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <safe_free_strs@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"accept\00"
@.str.1 = [8 x i8] c"connect\00"
define void @auth_ssl_save(i32 %0) {
%2 = alloca i32
%3 = alloca i8**
store i32 %0, i32* %2
%4 = call i8** (...) @openssl_get_certs()
store i8** %4, i8*** %3
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%9 = load i8**, i8*** %3
%10 = call i32 @storage_save(i8* %8, i8** %9)
%11 = load i8**, i8*** %3
%12 = call i32 @safe_free_strs(i8** %11)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"accept\00"
@.str.1 = [8 x i8] c"connect\00"
define void @auth_ssl_save(i32 %0) {
%2 = tail call i8** (...) @openssl_get_certs()
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @storage_save(i8* %4, i8** %2)
%6 = tail call i32 @safe_free_strs(i8** %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clearfiles(char *, char *);
void remove_sockets(void) { clearfiles("isock", "/var/lib/iptraf-ng"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"isock\00"
@.str.1 = [19 x i8] c"/var/lib/iptraf-ng\00"
define void @remove_sockets() {
%1 = call i32 @clearfiles(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"isock\00"
@.str.1 = [19 x i8] c"/var/lib/iptraf-ng\00"
define void @remove_sockets() {
%1 = tail call i32 @clearfiles(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;
typedef int /*<<< orphan*/ u_int16_t;

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
u_int16_t net_read16(u_int8_t *b) {
  u_int16_t r;
  r = *(u_int16_t *)b;
  return (ntohs(r));
}


x86 assembly (clang, -O0):
<net_read16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ntohs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_read16>:
mov    (%rdi),%edi
jmp    1030 <ntohs@plt>

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

LLVM IR (-O2):
define i32 @net_read16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @ntohs(i32 %2)
ret i32 %3
}
int arch_big_cpu(int cpu) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @arch_big_cpu(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ myfree(void *);
extern void free(void *ptr) { myfree(ptr); }


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

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

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

LLVM IR (-O2):
define void @free(i8* %0) {
%2 = tail call i32 @myfree(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Delay_us(int);
int /*<<< orphan*/ PCF_WrSingle(int, int);
void PN5180A_Reset(void) {
  PCF_WrSingle(0x3F, 0b11111111);
  PCF_WrSingle(0x3F, 0b01111111);
  Delay_us(10);
  PCF_WrSingle(0x3F, 0b11111111);
}


x86 assembly (clang, -O0):
<PN5180A_Reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3f,%edi
mov    $0xff,%esi
call   1040 <PCF_WrSingle@plt>
mov    $0x3f,%edi
mov    $0x7f,%esi
call   1040 <PCF_WrSingle@plt>
mov    $0xa,%edi
call   1030 <Delay_us@plt>
mov    $0x3f,%edi
mov    $0xff,%esi
call   1040 <PCF_WrSingle@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PN5180A_Reset>:
push   %rax
mov    $0x3f,%edi
mov    $0xff,%esi
call   1040 <PCF_WrSingle@plt>
mov    $0x3f,%edi
mov    $0x7f,%esi
call   1040 <PCF_WrSingle@plt>
mov    $0xa,%edi
call   1030 <Delay_us@plt>
mov    $0x3f,%edi
mov    $0xff,%esi
pop    %rax
jmp    1040 <PCF_WrSingle@plt>

LLVM IR (-O0):
define void @PN5180A_Reset() {
%1 = call i32 @PCF_WrSingle(i32 63, i32 255)
%2 = call i32 @PCF_WrSingle(i32 63, i32 127)
%3 = call i32 @Delay_us(i32 10)
%4 = call i32 @PCF_WrSingle(i32 63, i32 255)
ret void
}

LLVM IR (-O2):
define void @PN5180A_Reset() {
%1 = tail call i32 @PCF_WrSingle(i32 63, i32 255)
%2 = tail call i32 @PCF_WrSingle(i32 63, i32 127)
%3 = tail call i32 @Delay_us(i32 10)
%4 = tail call i32 @PCF_WrSingle(i32 63, i32 255)
ret void
}
/* Type definitions */
struct mii_ioctl_data {
  int dummy;
};
struct ifreq {
  int /*<<< orphan*/ ifr_ifru;
};

/* Variables and functions */
struct mii_ioctl_data *if_mii(struct ifreq *rq) {
  return (struct mii_ioctl_data *)&rq->ifr_ifru;
}


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

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

LLVM IR (-O0):
%struct.mii_ioctl_data = type { i32 }
%struct.ifreq = type { i32 }
define %struct.mii_ioctl_data* @if_mii(%struct.ifreq* %0) {
%2 = alloca %struct.ifreq*
store %struct.ifreq* %0, %struct.ifreq** %2
%3 = load %struct.ifreq*, %struct.ifreq** %2
%4 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i32 0, i32 0
%5 = bitcast i32* %4 to %struct.mii_ioctl_data*
ret %struct.mii_ioctl_data* %5
}

LLVM IR (-O2):
%struct.mii_ioctl_data = type { i32 }
%struct.ifreq = type { i32 }
define %struct.mii_ioctl_data* @if_mii(%struct.ifreq* readnone %0) {
%2 = bitcast %struct.ifreq* %0 to %struct.mii_ioctl_data*
ret %struct.mii_ioctl_data* %2
}
char *str_append(char *dst, const char *src) {
  while ((*dst = *src++) != '\0')
    dst++;
  return dst;
}


x86 assembly (clang, -O0):
<str_append>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1140 <str_append+0x40>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <str_append+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_append>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     1122 <str_append+0x22>
add    $0x1,%rsi
nop
movzbl (%rsi),%ecx
mov    %cl,0x1(%rax)
add    $0x1,%rax
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <str_append+0x10>
ret

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

LLVM IR (-O2):
define i8* @str_append(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %1, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i8* [ %0, %2 ], [ %9, %5 ]
ret i8* %13
}
int test_imm_25uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x25 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_25uint64_highword_mem>:
testb  $0x25,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_25uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 158913789952
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int main(void) {
  int a = 3;
  int b = 2;
  __VERIFIER_assert(a == b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
store i32 2, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = icmp eq i32 %4, %5
%7 = zext i1 %6 to i32
%8 = call i32 @__VERIFIER_assert(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @__VERIFIER_assert(i32 0)
ret i32 0
}
int hexdigit(char c) {
  if (c >= 'a')
    c -= 32;
  if (c >= 'A' && c <= 'F')
    return c - 'A';
  if (c >= '0' && c <= '9')
    return c - '0';
  return 127;
}


x86 assembly (clang, -O0):
<hexdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1121 <hexdigit+0x21>
movsbl -0x5(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     114a <hexdigit+0x4a>
movsbl -0x5(%rbp),%eax
cmp    $0x46,%eax
jg     114a <hexdigit+0x4a>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <hexdigit+0x7a>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1173 <hexdigit+0x73>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1173 <hexdigit+0x73>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <hexdigit+0x7a>
movl   $0x7f,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdigit>:
lea    -0x20(%rdi),%eax
cmp    $0x61,%dil
movzbl %al,%eax
cmovl  %edi,%eax
movsbl %al,%eax
lea    -0x41(%rax),%ecx
cmp    $0x5,%cl
ja     111c <hexdigit+0x1c>
add    $0xffffffbf,%eax
ret
lea    -0x30(%rax),%ecx
add    $0xffffffd0,%eax
cmp    $0xa,%cl
mov    $0x7f,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hexdigit(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 32
%11 = trunc i32 %10 to i8
store i8 %11, i8* %3
br label %12
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 65
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 70
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 65
store i32 %23, i32* %2
br label %37
24: ; preds = %16, %12
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 48
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 57
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i8, i8* %3
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
store i32 %35, i32* %2
br label %37
36: ; preds = %28, %24
store i32 127, i32* %2
br label %37
37: ; preds = %36, %32, %20
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @hexdigit(i8 signext %0) {
%2 = icmp sgt i8 %0, 96
%3 = add i8 %0, -32
%4 = select i1 %2, i8 %3, i8 %0
%5 = sext i8 %4 to i32
%6 = add i8 %4, -65
%7 = icmp ult i8 %6, 6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = add nsw i32 %5, -65
br label %15
10: ; preds = %1
%11 = add i8 %4, -48
%12 = icmp ult i8 %11, 10
%13 = add nsw i32 %5, -48
%14 = select i1 %12, i32 %13, i32 127
br label %15
15: ; preds = %10, %8
%16 = phi i32 [ %9, %8 ], [ %14, %10 ]
ret i32 %16
}