xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strdup(char const *);
char *strrchr(char const *, char);
char *get_name_from_link(char const *link) {
  char const *s;
  if (NULL == link)
    return NULL;
  if (NULL == (s = strrchr(link, '/')))
    return NULL;
  return strdup(s + 1);
}


x86 assembly (clang, -O0):
<get_name_from_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1145 <get_name_from_link+0x25>
movq   $0x0,-0x8(%rbp)
jmp    1183 <get_name_from_link+0x63>
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    1172 <get_name_from_link+0x52>
movq   $0x0,-0x8(%rbp)
jmp    1183 <get_name_from_link+0x63>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name_from_link>:
test   %rdi,%rdi
je     1146 <get_name_from_link+0x26>
push   %rax
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     1146 <get_name_from_link+0x26>
add    $0x1,%rax
mov    %rax,%rdi
jmp    1040 <strdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @get_name_from_link(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* null, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %17
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @strrchr(i8* %9, i8 signext 47)
store i8* %10, i8** %4
%11 = icmp eq i8* null, %10
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* null, i8** %2
br label %17
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = call i8* @strdup(i8* %15)
store i8* %16, i8** %2
br label %17
17: ; preds = %13, %12, %7
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
define noalias i8* @get_name_from_link(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i8* @strrchr(i8* %0, i8 signext 47)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = tail call i8* @strdup(i8* %7)
br label %9
9: ; preds = %3, %1, %6
%10 = phi i8* [ %8, %6 ], [ null, %1 ], [ null, %3 ]
ret i8* %10
}
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ errno;
scalar_t__ read(int, void *, size_t);
ssize_t safe_read(int fd, void *buf, size_t count) {
  ssize_t n;
  do {
    n = read(fd, buf, count);
  } while (n < 0 && errno == EINTR);
  return n;
}


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

x86 assembly (clang, -O2):
<safe_read>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2eb9(%rip),%r15
mov    0x2eaa(%rip),%r12
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <read@plt>
test   %rax,%rax
jns    114b <safe_read+0x3b>
mov    (%r12),%rcx
cmp    %rcx,(%r15)
je     1130 <safe_read+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i64 @safe_read(i32 %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %4, %3
%5 = tail call i64 @read(i32 %0, i8* %1, i64 %2)
%6 = icmp slt i64 %5, 0
%7 = load i64, i64* @errno
%8 = load i64, i64* @EINTR
%9 = icmp eq i64 %7, %8
%10 = select i1 %6, i1 %9, i1 false
br i1 %10, label %4, label %11
11: ; preds = %4
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int x = 100;
  printf("x的值是:%d\n", x);
  printf("x所占空间大小是:%ld\n", sizeof x);
  int *ptr1 = &x;
  printf("x的地址是:%p\n", ptr1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"x\E7\9A\84\E5\80\BC\E6\98\AF:%d\0A\00"
@.str.1 = [28 x i8] c"x\E6\89\80\E5\8D\A0\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F\E6\98\AF:%ld\0A\00"
@.str.2 = [18 x i8] c"x\E7\9A\84\E5\9C\B0\E5\9D\80\E6\98\AF:%p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 100, i32* %1
%3 = load i32, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 4)
store i32* %1, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"x\E7\9A\84\E5\80\BC\E6\98\AF:%d\0A\00"
@.str.1 = [28 x i8] c"x\E6\89\80\E5\8D\A0\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F\E6\98\AF:%ld\0A\00"
@.str.2 = [18 x i8] c"x\E7\9A\84\E5\9C\B0\E5\9D\80\E6\98\AF:%p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 100, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 100)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 4)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32* %1)
ret i32 0
}
void _cleanupThreadSSL(void *localStorage) {}


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

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

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

LLVM IR (-O2):
define void @_cleanupThreadSSL(i8* nocapture %0) {
ret void
}
double TimesTwo(double num) { return num * 2; }


x86 assembly (clang, -O0):
<TimesTwo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimesTwo>:
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @TimesTwo(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 2.000000e+00
ret double %4
}

LLVM IR (-O2):
define double @TimesTwo(double %0) {
%2 = fmul double %0, 2.000000e+00
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun(void *arg) { printf("++++++fun++++++\n"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"++++++fun++++++\0A\00"
define void @fun(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"++++++fun++++++\00"
define void @fun(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__4__IO__makeInput();
void Msp430GpioC__0__HplGeneralIO__makeInput(void) {
  HplMsp430GeneralIOP__4__IO__makeInput();
}


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

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

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

LLVM IR (-O2):
define void @Msp430GpioC__0__HplGeneralIO__makeInput() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__4__IO__makeInput()
ret void
}
int trans_2_x(int x, int y) { return -y; }


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

x86 assembly (clang, -O2):
<trans_2_x>:
mov    %esi,%eax
neg    %eax
ret

LLVM IR (-O0):
define i32 @trans_2_x(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @trans_2_x(i32 %0, i32 %1) {
%3 = sub nsw i32 0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ myReduceLines();
int main(int argc, const char *argv[]) {
  myReduceLines();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <myReduceLines@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <myReduceLines@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @myReduceLines()
%7 = load i32, i32* @EXIT_SUCCESS
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @myReduceLines()
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int f(char *, char);
main() {
  char buf[4];
  buf[0] = 170;
  buf[1] = 5;
  if (f(buf, 'd') != 85)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xaa,-0x8(%rbp)
movb   $0x5,-0x7(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x64,%esi
call   1040 <f@plt>
cmp    $0x55,%eax
je     1165 <main+0x35>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x5aa,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x64,%esi
call   1040 <f@plt>
cmp    $0x55,%eax
jne    1153 <main+0x23>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
store i8 -86, i8* %3
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 5, i8* %4
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%6 = call i32 @f(i8* %5, i8 signext 100)
%7 = icmp ne i32 %6, 85
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %0
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
store i8 -86, i8* %2
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
store i8 5, i8* %3
%4 = call i32 @f(i8* %2, i8 signext 100)
%5 = icmp eq i32 %4, 85
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = call i32 @exit(i32 0)
unreachable
}
int fun1114() { return 1114; }


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

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

LLVM IR (-O0):
define i32 @fun1114() {
ret i32 1114
}

LLVM IR (-O2):
define i32 @fun1114() {
ret i32 1114
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ mqd_t;

/* Variables and functions */
int /*<<< orphan*/ syscall_cp(int, int /*<<< orphan*/, char *, size_t,
                              unsigned int *, struct timespec const *);
ssize_t mq_timedreceive(mqd_t mqd, char *msg, size_t len, unsigned *prio,
                        const struct timespec *at) {
  return syscall_cp(243, mqd, msg, len, prio, at);
}


x86 assembly (clang, -O0):
<mq_timedreceive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    $0xf3,%edi
call   1030 <syscall_cp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mq_timedreceive>:
mov    %r8,%r9
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0xf3,%edi
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @mq_timedreceive(i32 %0, i8* %1, i64 %2, i32* %3, %struct.timespec* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32*
%10 = alloca %struct.timespec*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i32* %3, i32** %9
store %struct.timespec* %4, %struct.timespec** %10
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = load i64, i64* %8
%14 = load i32*, i32** %9
%15 = load %struct.timespec*, %struct.timespec** %10
%16 = call i32 @syscall_cp(i32 243, i32 %11, i8* %12, i64 %13, i32* %14, %struct.timespec* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @mq_timedreceive(i32 %0, i8* %1, i64 %2, i32* %3, %struct.timespec* %4) {
%6 = tail call i32 @syscall_cp(i32 243, i32 %0, i8* %1, i64 %2, i32* %3, %struct.timespec* %4)
ret i32 %6
}
int test_imm_D2int16_mem(short *val) {
  return ((*val) & (-0xD2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D2int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff2e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D2int16_mem>:
movzwl (%rdi),%eax
test   $0xff2e,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D2int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -210
%7 = icmp ne i32 %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_D2int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -210
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int examine(char *);
int flag_check(char *str, char *flg1, char *flg2) {
  if (examine(str) == 4) {
    *flg1 = *str;
    *flg2 = *(str + 1);
    return 3;
  } else {
    *flg1 = *flg2 = 'm';
    return 4;
  }
}


x86 assembly (clang, -O0):
<flag_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <examine@plt>
cmp    $0x4,%eax
jne    115b <flag_check+0x4b>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
movl   $0x3,-0x4(%rbp)
jmp    1170 <flag_check+0x60>
mov    -0x20(%rbp),%rax
movb   $0x6d,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x6d,(%rax)
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag_check>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <examine@plt>
cmp    $0x4,%eax
jne    113a <flag_check+0x2a>
mov    (%rbx),%al
mov    %al,(%r15)
mov    0x1(%rbx),%al
mov    %al,(%r14)
mov    $0x3,%eax
jmp    1147 <flag_check+0x37>
movb   $0x6d,(%r14)
movb   $0x6d,(%r15)
mov    $0x4,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @flag_check(i8* %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = tail call i32 @examine(i8* %0)
%5 = icmp eq i32 %4, 4
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i8, i8* %0
store i8 %7, i8* %1
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
store i8 %9, i8* %2
br label %11
10: ; preds = %3
store i8 109, i8* %2
store i8 109, i8* %1
br label %11
11: ; preds = %10, %6
%12 = phi i32 [ 3, %6 ], [ 4, %10 ]
ret i32 %12
}
void uart_clock_init(void) {
  *((unsigned long *)0x01c2006c) |= 0x0001000;
  *((unsigned long *)0x01c202d8) |= 0x0001000;
}


x86 assembly (clang, -O0):
<uart_clock_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1c2006c,%eax
mov    (%rax),%rcx
or     $0x1000,%rcx
mov    $0x1c2006c,%eax
mov    %rcx,(%rax)
mov    $0x1c202d8,%eax
mov    (%rax),%rcx
or     $0x1000,%rcx
mov    $0x1c202d8,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_clock_init>:
orb    $0x10,0x1c2006d
10
orb    $0x10,0x1c202d9
10
ret

LLVM IR (-O0):
define void @uart_clock_init() {
%1 = load i64, i64* inttoptr (i64 29491308 to i64*)
%2 = or i64 %1, 4096
store i64 %2, i64* inttoptr (i64 29491308 to i64*)
%3 = load i64, i64* inttoptr (i64 29491928 to i64*)
%4 = or i64 %3, 4096
store i64 %4, i64* inttoptr (i64 29491928 to i64*)
ret void
}

LLVM IR (-O2):
define void @uart_clock_init() {
%1 = load i64, i64* inttoptr (i64 29491308 to i64*)
%2 = or i64 %1, 4096
store i64 %2, i64* inttoptr (i64 29491308 to i64*)
%3 = load i64, i64* inttoptr (i64 29491928 to i64*)
%4 = or i64 %3, 4096
store i64 %4, i64* inttoptr (i64 29491928 to i64*)
ret void
}
unsigned int ceil_mul(unsigned int a, unsigned int b) {
  return (((b) ? ((a) + (b)-1) / (b) : 0) * (b));
}


x86 assembly (clang, -O0):
<ceil_mul>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112a <ceil_mul+0x2a>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %eax,-0xc(%rbp)
jmp    1134 <ceil_mul+0x34>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <ceil_mul+0x34>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_mul>:
test   %esi,%esi
je     1112 <ceil_mul+0x12>
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
xor    %edx,%edx
div    %esi
imul   %esi,%eax
ret
xor    %eax,%eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @ceil_mul(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = add i32 %8, %9
%11 = sub i32 %10, 1
%12 = load i32, i32* %4
%13 = udiv i32 %11, %12
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %7
%16 = phi i32 [ %13, %7 ], [ 0, %14 ]
%17 = load i32, i32* %4
%18 = mul i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @ceil_mul(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = add i32 %0, -1
%6 = add i32 %5, %1
%7 = udiv i32 %6, %1
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
%10 = mul i32 %9, %1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void add_rule() {
  system("netsh advfirewall firewall add rule name=\"LoL Chat OFF\" dir=out "
         "remoteip=172.65.212.1 protocol=TCP action=block");
  printf("Done.\n");
}


x86 assembly (clang, -O0):
<add_rule>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <system@plt>
lea    0xf39(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_rule>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <system@plt>
lea    0xf3c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [112 x i8] c"netsh advfirewall firewall add rule name=\22LoL Chat OFF\22 dir=out remoteip=172.65.212.1 protocol=TCP action=block\00"
@.str.1 = [7 x i8] c"Done.\0A\00"
define void @add_rule() {
%1 = call i32 @system(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [112 x i8] c"netsh advfirewall firewall add rule name=\22LoL Chat OFF\22 dir=out remoteip=172.65.212.1 protocol=TCP action=block\00"
@str = [6 x i8] c"Done.\00"
define void @add_rule() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ *s2;
typedef int bd;

/* Variables and functions */
int fz_screen_byte(int, int);
int fz_hardlight_byte(int bd, int s) {
  int s2 = s << 1;
  if (s <= 127)
    return (((bd) * ((s2) + ((s2) >> 7))) >> 8);
  else
    return fz_screen_byte(bd, s2);
}


x86 assembly (clang, -O0):
<fz_hardlight_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x7f,-0xc(%rbp)
jg     114d <fz_hardlight_byte+0x3d>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    -0x10(%rbp),%edx
sar    $0x7,%edx
add    %edx,%ecx
imul   %ecx,%eax
sar    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <fz_hardlight_byte+0x4b>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <fz_screen_byte@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_hardlight_byte>:
mov    %esi,%eax
lea    (%rax,%rax,1),%esi
cmp    $0x7f,%eax
jg     1128 <fz_hardlight_byte+0x18>
mov    %esi,%eax
sar    $0x7,%eax
add    %esi,%eax
imul   %edi,%eax
sar    $0x8,%eax
ret
jmp    1030 <fz_screen_byte@plt>

LLVM IR (-O0):
define i32 @fz_hardlight_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = shl i32 %7, 1
store i32 %8, i32* %6
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 127
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = load i32, i32* %6
%15 = ashr i32 %14, 7
%16 = add nsw i32 %13, %15
%17 = mul nsw i32 %12, %16
%18 = ashr i32 %17, 8
store i32 %18, i32* %3
br label %23
19: ; preds = %2
%20 = load i32, i32* %4
%21 = load i32, i32* %6
%22 = call i32 @fz_screen_byte(i32 %20, i32 %21)
store i32 %22, i32* %3
br label %23
23: ; preds = %19, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @fz_hardlight_byte(i32 %0, i32 %1) {
%3 = shl i32 %1, 1
%4 = icmp slt i32 %1, 128
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = ashr i32 %3, 7
%7 = add nsw i32 %6, %3
%8 = mul nsw i32 %7, %0
%9 = ashr i32 %8, 8
br label %12
10: ; preds = %2
%11 = tail call i32 @fz_screen_byte(i32 %0, i32 %3)
br label %12
12: ; preds = %10, %5
%13 = phi i32 [ %9, %5 ], [ %11, %10 ]
ret i32 %13
}
unsigned int test_2(unsigned int x) { return x & ~(1 << 1); }


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

x86 assembly (clang, -O2):
<test_2>:
mov    %edi,%eax
and    $0xfffffffd,%eax
ret

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

LLVM IR (-O2):
define i32 @test_2(i32 %0) {
%2 = and i32 %0, -3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ funcb();
int /*<<< orphan*/ printf(char *);
void funca(void) {
  printf("a\n");
  funcb();
}


x86 assembly (clang, -O0):
<funca>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <funcb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<funca>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <funcb@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"a\0A\00"
define void @funca() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @funcb()
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c"a\00"
define void @funca() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @funcb()
ret void
}
/* Variables and functions */
int gcd(int, int);
int /*<<< orphan*/ init_state();
int val();
int energyquantum(void) {
  int g, i, v, v0;
  v0 = val();
  g = 0;
  for (i = 0; i < 100; i++) {
    init_state();
    v = val();
    g = gcd(g, v - v0);
  }
  return g;
}


x86 assembly (clang, -O0):
<energyquantum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <val@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    118a <energyquantum+0x5a>
mov    $0x0,%al
call   1030 <init_state@plt>
mov    $0x0,%al
call   1040 <val@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
call   1050 <gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <energyquantum+0x20>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<energyquantum>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <val@plt>
mov    %eax,%r14d
mov    $0x64,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <init_state@plt>
xor    %eax,%eax
call   1040 <val@plt>
sub    %r14d,%eax
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <gcd@plt>
mov    %eax,%ebp
add    $0xffffffff,%ebx
jne    1150 <energyquantum+0x20>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @energyquantum() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @val()
store i32 %5, i32* %4
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = call i32 (...) @init_state()
%11 = call i32 (...) @val()
store i32 %11, i32* %3
%12 = load i32, i32* %1
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = sub nsw i32 %13, %14
%16 = call i32 @gcd(i32 %12, i32 %15)
store i32 %16, i32* %1
br label %17
17: ; preds = %9
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %6
20: ; preds = %6
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @energyquantum() {
%1 = tail call i32 (...) @val()
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %8, %2 ]
%4 = phi i32 [ 0, %0 ], [ %9, %2 ]
%5 = tail call i32 (...) @init_state()
%6 = tail call i32 (...) @val()
%7 = sub nsw i32 %6, %1
%8 = tail call i32 @gcd(i32 %3, i32 %7)
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %2
11: ; preds = %2
ret i32 %8
}
void swap_bad(int *array, int i, int j) {
  int tmp = array[i];
  array[i] = array[j];
  array[j] = tmp;
}


x86 assembly (clang, -O0):
<swap_bad>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_bad>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap_bad(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap_bad(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
int test_imm_0Eint64_highword_reg(long long val) {
  return ((val >> 32) & (0x0E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_0Eint64_highword_reg>:
movabs $0xe00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Eint64_highword_reg(i64 %0) {
%2 = and i64 %0, 60129542144
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, int *);
int atoi(const char *str) {
  int i;
  sscanf(str, "%d\n", &i);
  return i;
}


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

x86 assembly (clang, -O2):
<atoi>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @atoi(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
void do_rtl(int argc, char *argv[], int start) {
  (void)argc;
  (void)argv;
  (void)start;
}


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

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

LLVM IR (-O0):
define void @do_rtl(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
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
ret void
}

LLVM IR (-O2):
define void @do_rtl(i32 %0, i8** nocapture %1, i32 %2) {
ret void
}
/* Variables and functions */
int mul(int, int);
int square(int x) { return mul(x, x); }


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

x86 assembly (clang, -O2):
<square>:
mov    %edi,%esi
jmp    1030 <mul@plt>

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

LLVM IR (-O2):
define i32 @square(i32 %0) {
%2 = tail call i32 @mul(i32 %0, i32 %0)
ret i32 %2
}
/* Variables and functions */
int rand();
float frand(void) { return (rand() & 0xFF) / 255.0f; }


x86 assembly (clang, -O0):
<frand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
cvtsi2ss %eax,%xmm0
movss  0xed4(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<frand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
movzbl %al,%eax
cvtsi2ss %eax,%xmm0
divss  0xed9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @frand() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 255
%3 = sitofp i32 %2 to float
%4 = fdiv float %3, 2.550000e+02
ret float %4
}

LLVM IR (-O2):
define float @frand() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 255
%3 = sitofp i32 %2 to float
%4 = fdiv float %3, 2.550000e+02
ret float %4
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int celcon_copy_target_quaddobl_solution_to_container(int k, int i) {
  int fail;
  double *c;
  fail = _ada_use_c2phc4c(478, &k, &i, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_copy_target_quaddobl_solution_to_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x1de,%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_copy_target_quaddobl_solution_to_container>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    $0x1de,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @celcon_copy_target_quaddobl_solution_to_container(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load double*, double** %6
%8 = call i32 @_ada_use_c2phc4c(i32 478, i32* %3, i32* %4, double* %7, i32 0)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @celcon_copy_target_quaddobl_solution_to_container(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @_ada_use_c2phc4c(i32 478, i32* %3, i32* %4, double* undef, i32 0)
ret i32 %5
}
/* Variables and functions */
size_t strlen(char const *);
int IsNullOrEmpty(const char *pchStr) {
  if (pchStr == NULL)
    return (-1);
  size_t szLength = strlen(pchStr);
  if (szLength <= 0)
    return (-2);
  return (0);
}


x86 assembly (clang, -O0):
<IsNullOrEmpty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <IsNullOrEmpty+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <IsNullOrEmpty+0x4e>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
ja     1157 <IsNullOrEmpty+0x47>
movl   $0xfffffffe,-0x4(%rbp)
jmp    115e <IsNullOrEmpty+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsNullOrEmpty>:
test   %rdi,%rdi
je     1113 <IsNullOrEmpty+0x13>
xor    %eax,%eax
cmpb   $0x0,(%rdi)
setne  %al
add    %eax,%eax
add    $0xfffffffe,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @IsNullOrEmpty(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
%6 = select i1 %5, i32 -2, i32 0
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ -1, %1 ]
ret i32 %8
}
void cpu_inc16_flags(struct cpu *cpu, unsigned short a, signed int t) {}


x86 assembly (clang, -O0):
<cpu_inc16_flags>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.cpu = type opaque
define void @cpu_inc16_flags(%struct.cpu* %0, i16 zeroext %1, i32 %2) {
%4 = alloca %struct.cpu*
%5 = alloca i16
%6 = alloca i32
store %struct.cpu* %0, %struct.cpu** %4
store i16 %1, i16* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
%struct.cpu = type opaque
define void @cpu_inc16_flags(%struct.cpu* nocapture %0, i16 zeroext %1, i32 %2) {
ret void
}
/* Type definitions */
typedef int uint;

/* Variables and functions */
int random();
uint random32() { return random() ^ (random() << 16) ^ (random() >> 16); }


x86 assembly (clang, -O0):
<random32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
shl    $0x10,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
sar    $0x10,%ecx
xor    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random32>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebp
shl    $0x10,%ebp
xor    %ebx,%ebp
xor    %eax,%eax
call   1030 <random@plt>
sar    $0x10,%eax
xor    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random32() {
%1 = call i32 (...) @random()
%2 = call i32 (...) @random()
%3 = shl i32 %2, 16
%4 = xor i32 %1, %3
%5 = call i32 (...) @random()
%6 = ashr i32 %5, 16
%7 = xor i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @random32() {
%1 = tail call i32 (...) @random()
%2 = tail call i32 (...) @random()
%3 = shl i32 %2, 16
%4 = xor i32 %3, %1
%5 = tail call i32 (...) @random()
%6 = ashr i32 %5, 16
%7 = xor i32 %4, %6
ret i32 %7
}
/* Variables and functions */
unsigned long align_floor(unsigned long, unsigned long);
unsigned long align_ceil(unsigned long x, unsigned long shift) {
  return (x % (1 << shift)) ? align_floor(x + (1 << shift), shift) : x;
}


x86 assembly (clang, -O0):
<align_ceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     116b <align_ceil+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <align_floor@plt>
mov    %rax,-0x18(%rbp)
jmp    1173 <align_ceil+0x63>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_ceil>:
mov    $0x1,%r8d
mov    %esi,%ecx
shl    %cl,%r8d
mov    %rdi,%rcx
movslq %r8d,%rdi
mov    %rcx,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1142 <align_ceil+0x32>
mov    %rcx,%rax
xor    %edx,%edx
div    %rdi
test   %rdx,%rdx
je     114e <align_ceil+0x3e>
add    %rcx,%rdi
jmp    1030 <align_floor@plt>
mov    %ecx,%eax
xor    %edx,%edx
div    %r8d
test   %rdx,%rdx
jne    113a <align_ceil+0x2a>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @align_ceil(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 = load i64, i64* %4
%7 = trunc i64 %6 to i32
%8 = shl i32 1, %7
%9 = sext i32 %8 to i64
%10 = urem i64 %5, %9
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %2
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = trunc i64 %14 to i32
%16 = shl i32 1, %15
%17 = sext i32 %16 to i64
%18 = add i64 %13, %17
%19 = load i64, i64* %4
%20 = call i64 @align_floor(i64 %18, i64 %19)
br label %23
21: ; preds = %2
%22 = load i64, i64* %3
br label %23
23: ; preds = %21, %12
%24 = phi i64 [ %20, %12 ], [ %22, %21 ]
ret i64 %24
}

LLVM IR (-O2):
define i64 @align_ceil(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl nuw i32 1, %3
%5 = sext i32 %4 to i64
%6 = urem i64 %0, %5
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = add i64 %5, %0
%10 = tail call i64 @align_floor(i64 %9, i64 %1)
br label %11
11: ; preds = %2, %8
%12 = phi i64 [ %10, %8 ], [ %0, %2 ]
ret i64 %12
}
/* Type definitions */
typedef int socklen_t;

/* Variables and functions */
#define IPV6_RTHDR_TYPE_0 128
__attribute__((visibility("default"))) socklen_t inet6_rth_space(int type,
                                                                 int segments) {
  switch (type) {
  case IPV6_RTHDR_TYPE_0:
    if ((segments >= 0) && (segments <= 127))
      return (((segments * 2) + 1) << 3);
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<inet6_rth_space>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
jne    114a <inet6_rth_space+0x4a>
jmp    111d <inet6_rth_space+0x1d>
cmpl   $0x0,-0xc(%rbp)
jl     1145 <inet6_rth_space+0x45>
cmpl   $0x7f,-0xc(%rbp)
jg     1145 <inet6_rth_space+0x45>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
shl    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <inet6_rth_space+0x51>
jmp    114a <inet6_rth_space+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet6_rth_space>:
mov    %esi,%eax
shl    $0x4,%eax
or     $0x8,%eax
xor    %ecx,%ecx
cmp    $0x80,%esi
cmovae %ecx,%eax
cmp    $0x80,%edi
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @inet6_rth_space(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
switch i32 %6, label %19 [
i32 128, label %7
]
7: ; preds = %2
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 127
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %5
%15 = mul nsw i32 %14, 2
%16 = add nsw i32 %15, 1
%17 = shl i32 %16, 3
store i32 %17, i32* %3
br label %20
18: ; preds = %10, %7
br label %19
19: ; preds = %2, %18
store i32 0, i32* %3
br label %20
20: ; preds = %19, %13
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @inet6_rth_space(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 128
%4 = icmp ult i32 %1, 128
%5 = and i1 %3, %4
%6 = shl i32 %1, 4
%7 = or i32 %6, 8
%8 = select i1 %5, i32 %7, i32 0
ret i32 %8
}
double _wire(const int numInputs, const double *inputs,
             const double *connectionWeights) {
  double out;
  out = inputs[0];
  return out;
}


x86 assembly (clang, -O0):
<_wire>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_wire>:
movsd  (%rsi),%xmm0
ret

LLVM IR (-O0):
define double @_wire(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %5
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
store double %10, double* %7
%11 = load double, double* %7
ret double %11
}

LLVM IR (-O2):
define double @_wire(i32 %0, double* nocapture %1, double* nocapture readnone %2) {
%4 = load double, double* %1
ret double %4
}