xunge/DecIR huggingface dataset:
/* Type definitions */
struct Cyc_AP_T {
  int dummy;
};

/* Variables and functions */
struct Cyc_AP_T *Cyc_AP_mod(struct Cyc_AP_T *, struct Cyc_AP_T *);
struct Cyc_AP_T *Cyc_AP_mul(struct Cyc_AP_T *, struct Cyc_AP_T *);
struct Cyc_AP_T *Cyc_mulmod(struct Cyc_AP_T *x, struct Cyc_AP_T *y,
                            struct Cyc_AP_T *p) {
  struct Cyc_AP_T *_T0;
  struct Cyc_AP_T *z;
  struct Cyc_AP_T *xy = Cyc_AP_mul(x, y);
  z = Cyc_AP_mod(xy, p);
  _T0 = z;
  return _T0;
}


x86 assembly (clang, -O0):
<Cyc_mulmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <Cyc_AP_mul@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <Cyc_AP_mod@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_mulmod>:
push   %rbx
mov    %rdx,%rbx
call   1030 <Cyc_AP_mul@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <Cyc_AP_mod@plt>

LLVM IR (-O0):
%struct.Cyc_AP_T = type { i32 }
define %struct.Cyc_AP_T* @Cyc_mulmod(%struct.Cyc_AP_T* %0, %struct.Cyc_AP_T* %1, %struct.Cyc_AP_T* %2) {
%4 = alloca %struct.Cyc_AP_T*
%5 = alloca %struct.Cyc_AP_T*
%6 = alloca %struct.Cyc_AP_T*
%7 = alloca %struct.Cyc_AP_T*
%8 = alloca %struct.Cyc_AP_T*
%9 = alloca %struct.Cyc_AP_T*
store %struct.Cyc_AP_T* %0, %struct.Cyc_AP_T** %4
store %struct.Cyc_AP_T* %1, %struct.Cyc_AP_T** %5
store %struct.Cyc_AP_T* %2, %struct.Cyc_AP_T** %6
%10 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %4
%11 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %5
%12 = call %struct.Cyc_AP_T* @Cyc_AP_mul(%struct.Cyc_AP_T* %10, %struct.Cyc_AP_T* %11)
store %struct.Cyc_AP_T* %12, %struct.Cyc_AP_T** %9
%13 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %9
%14 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %6
%15 = call %struct.Cyc_AP_T* @Cyc_AP_mod(%struct.Cyc_AP_T* %13, %struct.Cyc_AP_T* %14)
store %struct.Cyc_AP_T* %15, %struct.Cyc_AP_T** %8
%16 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %8
store %struct.Cyc_AP_T* %16, %struct.Cyc_AP_T** %7
%17 = load %struct.Cyc_AP_T*, %struct.Cyc_AP_T** %7
ret %struct.Cyc_AP_T* %17
}

LLVM IR (-O2):
%struct.Cyc_AP_T = type { i32 }
define %struct.Cyc_AP_T* @Cyc_mulmod(%struct.Cyc_AP_T* %0, %struct.Cyc_AP_T* %1, %struct.Cyc_AP_T* %2) {
%4 = tail call %struct.Cyc_AP_T* @Cyc_AP_mul(%struct.Cyc_AP_T* %0, %struct.Cyc_AP_T* %1)
%5 = tail call %struct.Cyc_AP_T* @Cyc_AP_mod(%struct.Cyc_AP_T* %4, %struct.Cyc_AP_T* %2)
ret %struct.Cyc_AP_T* %5
}
/* Type definitions */
struct xa_switch_t {
  int dummy;
};

/* Variables and functions */
struct xa_switch_t *db2xacicst_std();
struct xa_switch_t *lixa_get_xa_switch() {
  return db2xacicst_std();
}


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

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

LLVM IR (-O0):
%struct.xa_switch_t = type { i32 }
define %struct.xa_switch_t* @lixa_get_xa_switch() {
%1 = call %struct.xa_switch_t* (...) @db2xacicst_std()
ret %struct.xa_switch_t* %1
}

LLVM IR (-O2):
%struct.xa_switch_t = type { i32 }
define %struct.xa_switch_t* @lixa_get_xa_switch() {
%1 = tail call %struct.xa_switch_t* (...) @db2xacicst_std()
ret %struct.xa_switch_t* %1
}
int divi(int a, int b) { return a / b; }


x86 assembly (clang, -O0):
<divi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<divi>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @divi(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 = sdiv i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @divi(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
void kill_usage() {}


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

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

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

LLVM IR (-O2):
define void @kill_usage() {
ret void
}
/* Type definitions */
struct linger {
  scalar_t__ l_linger;
  scalar_t__ l_onoff;
};

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_LINGER;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, struct linger *,
               int);
int fnet_set_linger(int fd) {
  struct linger optval;
  optval.l_onoff = 0;
  optval.l_linger = 0;
  return setsockopt(fd, SOL_SOCKET, SO_LINGER, &optval, sizeof(struct linger));
}


x86 assembly (clang, -O0):
<fnet_set_linger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnet_set_linger>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.linger = type { i64, i64 }
@SOL_SOCKET = global i32 0
@SO_LINGER = global i32 0
define i32 @fnet_set_linger(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.linger
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.linger, %struct.linger* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.linger, %struct.linger* %3, i32 0, i32 0
store i64 0, i64* %5
%6 = load i32, i32* %2
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_LINGER
%9 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, %struct.linger* %3, i32 16)
ret i32 %9
}

LLVM IR (-O2):
%struct.linger = type { i64, i64 }
@SOL_SOCKET = global i32 0
@SO_LINGER = global i32 0
define i32 @fnet_set_linger(i32 %0) {
%2 = alloca %struct.linger
%3 = bitcast %struct.linger* %2 to i8*
%4 = bitcast %struct.linger* %2 to i8*
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_LINGER
%7 = call i32 @setsockopt(i32 %0, i32 %5, i32 %6, %struct.linger* %2, i32 16)
ret i32 %7
}
/* Variables and functions */
char *calloc(int, int);
int rand();
int /*<<< orphan*/ strcpy(char *, char *);
char *fn101() {
  char *result;
  result = calloc(5 + rand() % 5, 4);
  strcpy((char *)result, "fn101");
  return result;
}


x86 assembly (clang, -O0):
<fn101>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn101>:
push   %rbx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"fn101\00"
define i8* @fn101() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 5
%4 = add nsw i32 5, %3
%5 = call i8* @calloc(i32 %4, i32 4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"fn101\00"
define i8* @fn101() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 5
%3 = add nsw i32 %2, 5
%4 = tail call i8* @calloc(i32 %3, i32 4)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}
int ibs_parse_and_set_um_fetch(char const *str) {
  if (!str)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<ibs_parse_and_set_um_fetch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <ibs_parse_and_set_um_fetch+0x1f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1126 <ibs_parse_and_set_um_fetch+0x26>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ibs_parse_and_set_um_fetch>:
cmp    $0x1,%rdi
sbb    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ibs_parse_and_set_um_fetch(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct sk_buff {
  int dummy;
};
struct nf_conn {
  int dummy;
};
typedef enum ip_conntrack_info {
  ____Placeholder_ip_conntrack_info
} ip_conntrack_info;

/* Variables and functions */
void nfqnl_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
                         enum ip_conntrack_info ctinfo, int diff) {}


x86 assembly (clang, -O0):
<nfqnl_ct_seq_adjust>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sk_buff = type { i32 }
%struct.nf_conn = type { i32 }
define void @nfqnl_ct_seq_adjust(%struct.sk_buff* %0, %struct.nf_conn* %1, i32 %2, i32 %3) {
%5 = alloca %struct.sk_buff*
%6 = alloca %struct.nf_conn*
%7 = alloca i32
%8 = alloca i32
store %struct.sk_buff* %0, %struct.sk_buff** %5
store %struct.nf_conn* %1, %struct.nf_conn** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
%struct.sk_buff = type { i32 }
%struct.nf_conn = type { i32 }
define void @nfqnl_ct_seq_adjust(%struct.sk_buff* nocapture %0, %struct.nf_conn* nocapture %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ spg_niggli_reduce(double **, double);
void spg_niggli_reduce_(double lattice[3][3], double *symprec) {
  spg_niggli_reduce(lattice, *symprec);
}


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

x86 assembly (clang, -O2):
<spg_niggli_reduce_>:
movsd  (%rsi),%xmm0
jmp    1030 <spg_niggli_reduce@plt>

LLVM IR (-O0):
define void @spg_niggli_reduce_([3 x double]* %0, double* %1) {
%3 = alloca [3 x double]*
%4 = alloca double*
store [3 x double]* %0, [3 x double]** %3
store double* %1, double** %4
%5 = load [3 x double]*, [3 x double]** %3
%6 = bitcast [3 x double]* %5 to double**
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = call i32 @spg_niggli_reduce(double** %6, double %8)
ret void
}

LLVM IR (-O2):
define void @spg_niggli_reduce_([3 x double]* %0, double* nocapture %1) {
%3 = bitcast [3 x double]* %0 to double**
%4 = load double, double* %1
%5 = tail call i32 @spg_niggli_reduce(double** %3, double %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uLong;
typedef int /*<<< orphan*/ uInt;
typedef int /*<<< orphan*/ Bytef;

/* Variables and functions */
int /*<<< orphan*/ crc32(int /*<<< orphan*/, int /*<<< orphan*/ const *,
                         int /*<<< orphan*/);
__attribute__((__visibility__("default"))) uLong
kz_crc32(uLong crc, const Bytef *buf, uInt len) {
  return crc32(crc, buf, len);
}


x86 assembly (clang, -O0):
<kz_crc32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <crc32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kz_crc32>:
jmp    1030 <crc32@plt>

LLVM IR (-O0):
define i32 @kz_crc32(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 = load i32, i32* %6
%10 = call i32 @crc32(i32 %7, i32* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @kz_crc32(i32 %0, i32* %1, i32 %2) {
%4 = tail call i32 @crc32(i32 %0, i32* %1, i32 %2)
ret i32 %4
}
unsigned int abs(int n) {
  if (n < 0)
    return -n;
  else
    return n;
}


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

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int RAND_MAX;
int rand();
double random_zero_to_one() { return rand() / (RAND_MAX + 1.); }


x86 assembly (clang, -O0):
<random_zero_to_one>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %eax,%xmm0
mov    0x2ec2(%rip),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xece(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_zero_to_one>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %eax,%xmm0
mov    0x2ec5(%rip),%rax
cvtsi2sdl (%rax),%xmm1
addsd  0xed1(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define double @random_zero_to_one() {
%1 = call i32 (...) @rand()
%2 = sitofp i32 %1 to double
%3 = load i32, i32* @RAND_MAX
%4 = sitofp i32 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
ret double %6
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define double @random_zero_to_one() {
%1 = tail call i32 (...) @rand()
%2 = sitofp i32 %1 to double
%3 = load i32, i32* @RAND_MAX
%4 = sitofp i32 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
ret double %6
}
int cmd_wait(void) {
  char ch;
  return -1;
}


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

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

LLVM IR (-O0):
define i32 @cmd_wait() {
%1 = alloca i8
ret i32 -1
}

LLVM IR (-O2):
define i32 @cmd_wait() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ brk(void *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  char cmd[32];
  brk((void *)0x8051000);
  sprintf(cmd, "cat /proc/self/maps");
  system(cmd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x8051000,%edi
call   1040 <brk@plt>
lea    -0x30(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    $0x8051000,%edi
call   1040 <brk@plt>
movups 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x737061,0x10(%rsp)
mov    %rsp,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"cat /proc/self/maps\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
store i32 0, i32* %1
%3 = call i32 @brk(i8* inttoptr (i64 134549504 to i8*))
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%7 = call i32 @system(i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"cat /proc/self/maps\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @brk(i8* inttoptr (i64 134549504 to i8*))
%4 = call i32 @system(i8* %2)
ret i32 0
}
int nvram_set(const char *name, const char *value) { return -1; }


x86 assembly (clang, -O0):
<nvram_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @nvram_set(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
int compare_ints(const void *pa, const void *pb, void *param) {
  const int *a = pa;
  const int *b = pb;
  if (*a < *b)
    return -1;
  else if (*a > *b)
    return +1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compare_ints>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%eax
jge    113e <compare_ints+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <compare_ints+0x63>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%eax
jle    115c <compare_ints+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1163 <compare_ints+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_ints>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_ints(i8* nocapture %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = bitcast i8* %0 to i32*
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = icmp slt i32 %6, %7
%9 = icmp sgt i32 %6, %7
%10 = zext i1 %9 to i32
%11 = select i1 %8, i32 -1, i32 %10
ret i32 %11
}
/* Variables and functions */
size_t strlen(char *d) {
  char *tmp = d;
  while ('\0' != *d)
    d++;
  return d - tmp;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1132 <strlen+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
long phi_n(long p, long q) { return (p - 1) * (q - 1); }


x86 assembly (clang, -O0):
<phi_n>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
imul   %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<phi_n>:
lea    -0x1(%rdi),%rcx
lea    -0x1(%rsi),%rax
imul   %rcx,%rax
ret

LLVM IR (-O0):
define i64 @phi_n(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = sub nsw i64 %5, 1
%7 = load i64, i64* %4
%8 = sub nsw i64 %7, 1
%9 = mul nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @phi_n(i64 %0, i64 %1) {
%3 = add nsw i64 %0, -1
%4 = add nsw i64 %1, -1
%5 = mul nsw i64 %4, %3
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  int j;
  int z;
  int res;
  res = 0;
  i = 1;
  j = 0;
  if (i) {
    if (j) {
    } else {
      res = 1;
    }
  } else {
    if (z) {
    } else {
    }
  }
  assert(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1159 <main+0x49>
cmpl   $0x0,-0xc(%rbp)
je     114d <main+0x3d>
jmp    1154 <main+0x44>
movl   $0x1,-0x14(%rbp)
jmp    1172 <main+0x62>
cmpl   $0x0,-0x10(%rbp)
je     1168 <main+0x58>
jmp    116d <main+0x5d>
jmp    116d <main+0x5d>
jmp    1172 <main+0x62>
mov    -0x14(%rbp),%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ g(int *);
void f(void) {
  int tabs[8], tabcount;
  for (tabcount = 1; tabcount <= 8; tabcount += 7) {
    int i;
    for (i = 0; i < 8; i++)
      tabs[i] = i * 2;
    g(tabs);
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x1,-0x24(%rbp)
cmpl   $0x8,-0x24(%rbp)
jg     116d <f+0x5d>
movl   $0x0,-0x28(%rbp)
cmpl   $0x8,-0x28(%rbp)
jge    1156 <f+0x46>
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1130 <f+0x20>
lea    -0x20(%rbp),%rdi
call   1030 <g@plt>
mov    -0x24(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x24(%rbp)
jmp    111f <f+0xf>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x20,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <g@plt>
movaps 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
call   1030 <g@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @f() {
%1 = alloca [8 x i32]
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %2
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 8
br i1 %6, label %7, label %26
7: ; preds = %4
store i32 0, i32* %3
br label %8
8: ; preds = %17, %7
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 8
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %3
%13 = mul nsw i32 %12, 2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %8
20: ; preds = %8
%21 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%22 = call i32 @g(i32* %21)
br label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 7
store i32 %25, i32* %2
br label %4
26: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @f() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = bitcast [8 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 2, i32 4, i32 6>, <4 x i32>* %4
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 8, i32 10, i32 12, i32 14>, <4 x i32>* %6
%7 = call i32 @g(i32* %3)
%8 = bitcast [8 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 2, i32 4, i32 6>, <4 x i32>* %8
%9 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 8, i32 10, i32 12, i32 14>, <4 x i32>* %9
%10 = call i32 @g(i32* %3)
ret void
}
int ifloor(int x, int y) { return x / y; }


x86 assembly (clang, -O0):
<ifloor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifloor>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @ifloor(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 = sdiv i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @ifloor(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
void dbg_print_null(const char *f, int line, const char *format, ...) {
  (void)f;
  (void)line;
  (void)format;
}


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

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

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

LLVM IR (-O2):
define void @dbg_print_null(i8* nocapture %0, i32 %1, i8* nocapture %2, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_ldhio(unsigned short *);
void test_ldhio(unsigned short *p1, unsigned short *p2) {
  __builtin_ldhio(p1);
  __builtin_ldhio(p2);
  __builtin_ldhio(p2 + 1);
  __builtin_ldhio(p2 + 2);
  __builtin_ldhio(p2 + 1023);
  __builtin_ldhio(p2 + 1024);
}


x86 assembly (clang, -O0):
<test_ldhio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__builtin_ldhio@plt>
mov    -0x10(%rbp),%rdi
call   1030 <__builtin_ldhio@plt>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
call   1030 <__builtin_ldhio@plt>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
call   1030 <__builtin_ldhio@plt>
mov    -0x10(%rbp),%rdi
add    $0x7fe,%rdi
call   1030 <__builtin_ldhio@plt>
mov    -0x10(%rbp),%rdi
add    $0x800,%rdi
call   1030 <__builtin_ldhio@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ldhio>:
push   %rbx
mov    %rsi,%rbx
call   1030 <__builtin_ldhio@plt>
mov    %rbx,%rdi
call   1030 <__builtin_ldhio@plt>
lea    0x2(%rbx),%rdi
call   1030 <__builtin_ldhio@plt>
lea    0x4(%rbx),%rdi
call   1030 <__builtin_ldhio@plt>
lea    0x7fe(%rbx),%rdi
call   1030 <__builtin_ldhio@plt>
add    $0x800,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <__builtin_ldhio@plt>

LLVM IR (-O0):
define void @test_ldhio(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
store i16* %0, i16** %3
store i16* %1, i16** %4
%5 = load i16*, i16** %3
%6 = call i32 @__builtin_ldhio(i16* %5)
%7 = load i16*, i16** %4
%8 = call i32 @__builtin_ldhio(i16* %7)
%9 = load i16*, i16** %4
%10 = getelementptr inbounds i16, i16* %9, i64 1
%11 = call i32 @__builtin_ldhio(i16* %10)
%12 = load i16*, i16** %4
%13 = getelementptr inbounds i16, i16* %12, i64 2
%14 = call i32 @__builtin_ldhio(i16* %13)
%15 = load i16*, i16** %4
%16 = getelementptr inbounds i16, i16* %15, i64 1023
%17 = call i32 @__builtin_ldhio(i16* %16)
%18 = load i16*, i16** %4
%19 = getelementptr inbounds i16, i16* %18, i64 1024
%20 = call i32 @__builtin_ldhio(i16* %19)
ret void
}

LLVM IR (-O2):
define void @test_ldhio(i16* %0, i16* %1) {
%3 = tail call i32 @__builtin_ldhio(i16* %0)
%4 = tail call i32 @__builtin_ldhio(i16* %1)
%5 = getelementptr inbounds i16, i16* %1, i64 1
%6 = tail call i32 @__builtin_ldhio(i16* %5)
%7 = getelementptr inbounds i16, i16* %1, i64 2
%8 = tail call i32 @__builtin_ldhio(i16* %7)
%9 = getelementptr inbounds i16, i16* %1, i64 1023
%10 = tail call i32 @__builtin_ldhio(i16* %9)
%11 = getelementptr inbounds i16, i16* %1, i64 1024
%12 = tail call i32 @__builtin_ldhio(i16* %11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ KDSETMODE;
int /*<<< orphan*/ KD_GRAPHICS;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
void c_graphics_mode(char *tty_file) {
  int tty_fd = open(tty_file, O_RDWR);
  ioctl(tty_fd, KDSETMODE, KD_GRAPHICS);
  close(tty_fd);
}


x86 assembly (clang, -O0):
<c_graphics_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
call   1030 <ioctl@plt>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_graphics_mode>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,%ebx
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
mov    0x2e77(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
call   1030 <ioctl@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
@KDSETMODE = global i32 0
@KD_GRAPHICS = global i32 0
define void @c_graphics_mode(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDWR
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = load i32, i32* @KDSETMODE
%9 = load i32, i32* @KD_GRAPHICS
%10 = call i32 @ioctl(i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = call i32 @close(i32 %11)
ret void
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@KDSETMODE = global i32 0
@KD_GRAPHICS = global i32 0
define void @c_graphics_mode(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = load i32, i32* @KDSETMODE
%5 = load i32, i32* @KD_GRAPHICS
%6 = tail call i32 @ioctl(i32 %3, i32 %4, i32 %5)
%7 = tail call i32 @close(i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
int open(char const *, int, int /*<<< orphan*/);
__attribute__((__nonnull__)) int xopen(const char *path, int flags,
                                       mode_t mode) {
  int fd;
  do {
    fd = open(path, flags, mode);
  } while (fd < 0 && errno == EINTR);
  return fd;
}


x86 assembly (clang, -O0):
<xopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    115d <xopen+0x4d>
mov    0x2e96(%rip),%rax
mov    (%rax),%rax
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1122 <xopen+0x12>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xopen>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <open@plt>
test   %eax,%eax
jns    114a <xopen+0x3a>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <xopen+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @xopen(i8* nocapture %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i32 @open(i8* %0, i32 %1, i32 %2)
%6 = icmp slt i32 %5, 0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i32 %5
}
int npCParseIsWhitespace(char c) {
  return c == '\n' || c == ' ' || c == '\t' || c == '\r';
}


x86 assembly (clang, -O0):
<npCParseIsWhitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     114d <npCParseIsWhitespace+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     114d <npCParseIsWhitespace+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     114d <npCParseIsWhitespace+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<npCParseIsWhitespace>:
cmp    $0x20,%dil
ja     1120 <npCParseIsWhitespace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <npCParseIsWhitespace+0x20>
ret
xor    %eax,%eax
cmp    $0xd,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @npCParseIsWhitespace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 10
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 32
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 9
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 13
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @npCParseIsWhitespace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 10, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 13
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int INT_MIN;
int /*<<< orphan*/ heap_increase_key(int *, int, int);
int max_heap_insert(int *a, int key) {
  a[0]++;
  a[a[0]] = INT_MIN;
  heap_increase_key(a, a[0], key);
}


x86 assembly (clang, -O0):
<max_heap_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
call   1030 <heap_increase_key@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_heap_insert>:
mov    %esi,%edx
movslq (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rdi)
mov    0x2ec6(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4(%rdi,%rax,4)
mov    (%rdi),%esi
jmp    1030 <heap_increase_key@plt>

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @max_heap_insert(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
%10 = load i32, i32* @INT_MIN
%11 = load i32*, i32** %4
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %11, i64 %15
store i32 %10, i32* %16
%17 = load i32*, i32** %4
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 0
%20 = load i32, i32* %19
%21 = load i32, i32* %5
%22 = call i32 @heap_increase_key(i32* %17, i32 %20, i32 %21)
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @max_heap_insert(i32* %0, i32 %1) {
%3 = load i32, i32* %0
%4 = add nsw i32 %3, 1
store i32 %4, i32* %0
%5 = load i32, i32* @INT_MIN
%6 = sext i32 %4 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 %5, i32* %7
%8 = load i32, i32* %0
%9 = tail call i32 @heap_increase_key(i32* %0, i32 %8, i32 %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ append_string_test();
int /*<<< orphan*/ create_empty_test();
int /*<<< orphan*/ from_various_test();
int /*<<< orphan*/ insert_test();
int main() {
  create_empty_test();
  from_various_test();
  append_string_test();
  insert_test();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <create_empty_test@plt>
mov    $0x0,%al
call   1040 <from_various_test@plt>
mov    $0x0,%al
call   1050 <append_string_test@plt>
mov    $0x0,%al
call   1030 <insert_test@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <create_empty_test@plt>
xor    %eax,%eax
call   1040 <from_various_test@plt>
xor    %eax,%eax
call   1050 <append_string_test@plt>
xor    %eax,%eax
call   1030 <insert_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @create_empty_test()
%2 = call i32 (...) @from_various_test()
%3 = call i32 (...) @append_string_test()
%4 = call i32 (...) @insert_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @create_empty_test()
%2 = tail call i32 (...) @from_various_test()
%3 = tail call i32 (...) @append_string_test()
%4 = tail call i32 (...) @insert_test()
ret i32 0
}
void fn_test3(void) { printf("%s\n", __func__); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@__func__.fn_test3 = [9 x i8] c"fn_test3\00"
define void @fn_test3() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.fn_test3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.fn_test3 = [9 x i8] c"fn_test3\00"
define void @fn_test3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.fn_test3, i64 0, i64 0))
ret void
}
void FlashTX_LED() {}


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

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

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

LLVM IR (-O2):
define void @FlashTX_LED() {
ret void
}
/* Variables and functions */
double log(double);
double math_log(double x) { return log(x); }


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

x86 assembly (clang, -O2):
<math_log>:
jmp    1030 <log@plt>

LLVM IR (-O0):
define double @math_log(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log(double %3)
ret double %4
}

LLVM IR (-O2):
define double @math_log(double %0) {
%2 = tail call double @log(double %0)
ret double %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ myWrite(int, int *, int);
void sendDemo(int fd, int which) {
  uint8_t data[2] = {136, which};
  myWrite(fd, data, 2);
}


x86 assembly (clang, -O0):
<sendDemo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x88,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1030 <myWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendDemo>:
push   %rax
movl   $0x88,(%rsp)
mov    %esi,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edx
call   1030 <myWrite@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @sendDemo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 136, i32* %6
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %4
store i32 %8, i32* %7
%9 = load i32, i32* %3
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%11 = call i32 @myWrite(i32 %9, i32* %10, i32 2)
ret void
}

LLVM IR (-O2):
define void @sendDemo(i32 %0, i32 %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 136, i32* %5
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %1, i32* %6
%7 = call i32 @myWrite(i32 %0, i32* %5, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int panic(char *message, char *object_name) {
  fflush(stdout);
  fprintf(stderr, "%s: %s.\n", object_name, message);
  abort();
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<panic>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [9 x i8] c"%s: %s.\0A\00"
define i32 @panic(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [9 x i8] c"%s: %s.\0A\00"
define i32 @panic(i8* %0, i8* %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%7 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) { printf("Hello world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello world!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}