xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(char const *);
int readlink(char const *, char *, int);
int is_link(const char *fname) {
  assert(fname);
  char c;
  ssize_t rv = readlink(fname, &c, 1);
  return (rv != -1);
}


x86 assembly (clang, -O0):
<is_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <readlink@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_link>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <assert@plt>
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <readlink@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_link(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @readlink(i8* %7, i8* %3, i32 1)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, -1
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @is_link(i8* %0) {
%2 = alloca i8
%3 = tail call i32 @assert(i8* %0)
%4 = call i32 @readlink(i8* %0, i8* %2, i32 1)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}
__attribute__((no, noclone)) unsigned __int128 t163_5sub(unsigned __int128 x) {
  unsigned __int128 r;
  if (__builtin_sub_overflow(x, (unsigned __int128)(-1), &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t163_5sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
sub    $0xffffffffffffffff,%rdx
sbb    $0xffffffffffffffff,%rcx
setb   %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1158 <t163_5sub+0x48>
jmp    115f <t163_5sub+0x4f>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t163_5sub>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
sub    $0xffffffffffffffff,%rbx
sbb    $0xffffffffffffffff,%r14
jae    112b <t163_5sub+0x1b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t163_5sub(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = call { i128, i1 } @llvm.usub.with.overflow.i128(i128 %11, i128 -1)
%13 = extractvalue { i128, i1 } %12, 1
%14 = extractvalue { i128, i1 } %12, 0
store i128 %14, i128* %6
br i1 %13, label %15, label %17
15: ; preds = %2
%16 = call i32 (...) @bar()
br label %17
17: ; preds = %15, %2
%18 = load i128, i128* %6
store i128 %18, i128* %3
%19 = bitcast i128* %3 to { i64, i64 }*
%20 = load { i64, i64 }, { i64, i64 }* %19
ret { i64, i64 } %20
}

LLVM IR (-O2):
define { i64, i64 } @t163_5sub(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.usub.with.overflow.i128(i128 %6, i128 -1)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
/* Variables and functions */
int /*<<< orphan*/ xfree(void *);
int freer(const void *key) {
  xfree((void *)key);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @freer(i8* %0) {
%2 = tail call i32 @xfree(i8* %0)
ret i32 0
}
int foo2(arg)
int arg;
{
  __asm volatile("" : "+r"(arg));
  return arg;
}


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

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

LLVM IR (-O0):
define i32 @foo2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 asm sideeffect "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo2(i32 %0) {
%2 = tail call i32 asm sideeffect "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i32 %2
}
/* Variables and functions */
int strcmp(char const *, char const *);
int sym_cmp(const void *n1, const void *n2) {
  return strcmp((const char *)n1, (const char *)n2);
}


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

x86 assembly (clang, -O2):
<sym_cmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @sym_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
unsigned makeodd(const unsigned x) {
  if (x == 0) {
    return 1;
  } else {
    return (x % 2 == 1) ? x : x - 1;
  }
}


x86 assembly (clang, -O0):
<makeodd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <makeodd+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1146 <makeodd+0x46>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1137 <makeodd+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <makeodd+0x40>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeodd>:
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x1,%ecx
add    %eax,%ecx
cmp    $0x1,%edi
mov    $0x1,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @makeodd(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = and i32 %0, 1
%4 = add i32 %0, -1
%5 = add i32 %4, %3
%6 = select i1 %2, i32 1, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ do_csi(char *);
void mc_print_composed(void) { do_csi("?10i"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"?10i\00"
define void @mc_print_composed() {
%1 = call i32 @do_csi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"?10i\00"
define void @mc_print_composed() {
%1 = tail call i32 @do_csi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int /*<<< orphan*/ SSL_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ SSL_shutdown(int /*<<< orphan*/ *);
void zopenssl_SSL_free(SSL *ssl) {
  if (ssl) {
    SSL_shutdown(ssl);
    SSL_free(ssl);
  }
}


x86 assembly (clang, -O0):
<zopenssl_SSL_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1149 <zopenssl_SSL_free+0x29>
mov    -0x8(%rbp),%rdi
call   1040 <SSL_shutdown@plt>
mov    -0x8(%rbp),%rdi
call   1030 <SSL_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zopenssl_SSL_free>:
test   %rdi,%rdi
je     1137 <zopenssl_SSL_free+0x17>
push   %rbx
mov    %rdi,%rbx
call   1040 <SSL_shutdown@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <SSL_free@plt>
ret

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

LLVM IR (-O2):
define void @zopenssl_SSL_free(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @SSL_shutdown(i32* %0)
%5 = tail call i32 @SSL_free(i32* %0)
br label %6
6: ; preds = %3, %1
ret void
}
/* Type definitions */
struct xfs_inode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ VFS_I(struct xfs_inode *);
int /*<<< orphan*/ barrier();
int /*<<< orphan*/ unlock_new_inode(int /*<<< orphan*/);
int /*<<< orphan*/ xfs_iflags_clear(struct xfs_inode *, int);
void xfs_finish_inode_setup(struct xfs_inode *ip) {
  xfs_iflags_clear(ip, (1 << 3));
  barrier();
  unlock_new_inode(VFS_I(ip));
}


x86 assembly (clang, -O0):
<xfs_finish_inode_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1040 <xfs_iflags_clear@plt>
mov    $0x0,%al
call   1030 <barrier@plt>
mov    -0x8(%rbp),%rdi
call   1050 <VFS_I@plt>
mov    %eax,%edi
call   1060 <unlock_new_inode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfs_finish_inode_setup>:
push   %rbx
mov    %rdi,%rbx
mov    $0x8,%esi
call   1040 <xfs_iflags_clear@plt>
xor    %eax,%eax
call   1030 <barrier@plt>
mov    %rbx,%rdi
call   1050 <VFS_I@plt>
mov    %eax,%edi
pop    %rbx
jmp    1060 <unlock_new_inode@plt>

LLVM IR (-O0):
%struct.xfs_inode = type { i32 }
define void @xfs_finish_inode_setup(%struct.xfs_inode* %0) {
%2 = alloca %struct.xfs_inode*
store %struct.xfs_inode* %0, %struct.xfs_inode** %2
%3 = load %struct.xfs_inode*, %struct.xfs_inode** %2
%4 = call i32 @xfs_iflags_clear(%struct.xfs_inode* %3, i32 8)
%5 = call i32 (...) @barrier()
%6 = load %struct.xfs_inode*, %struct.xfs_inode** %2
%7 = call i32 @VFS_I(%struct.xfs_inode* %6)
%8 = call i32 @unlock_new_inode(i32 %7)
ret void
}

LLVM IR (-O2):
%struct.xfs_inode = type { i32 }
define void @xfs_finish_inode_setup(%struct.xfs_inode* %0) {
%2 = tail call i32 @xfs_iflags_clear(%struct.xfs_inode* %0, i32 8)
%3 = tail call i32 (...) @barrier()
%4 = tail call i32 @VFS_I(%struct.xfs_inode* %0)
%5 = tail call i32 @unlock_new_inode(i32 %4)
ret void
}
int callee4(void) {
  int A = 1;
  int B = 2;
  int C;
  C = A + B;
  return 0;
}


x86 assembly (clang, -O0):
<callee4>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @callee4() {
ret i32 0
}
/* Variables and functions */
scalar_t__ mystrchr(char *, char *);
char *mystrpbrk(char *str1, char *str2) {
  while (*str1) {
    if (mystrchr(str2, str1))
      return str1;
    str1++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<mystrpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1162 <mystrpbrk+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <mystrchr@plt>
cmp    $0x0,%rax
je     1151 <mystrpbrk+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116a <mystrpbrk+0x5a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <mystrpbrk+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrpbrk>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     113a <mystrpbrk+0x2a>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <mystrchr@plt>
test   %rax,%rax
jne    113c <mystrpbrk+0x2c>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <mystrpbrk+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mystrpbrk(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %9
%6 = phi i8* [ %10, %9 ], [ %0, %2 ]
%7 = tail call i64 @mystrchr(i8* %1, i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %9, %2
%14 = phi i8* [ null, %2 ], [ null, %9 ], [ %6, %5 ]
ret i8* %14
}
int heap_parent(int i) { return (i >> 1); }


x86 assembly (clang, -O0):
<heap_parent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_parent>:
mov    %edi,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @heap_parent(i32 %0) {
%2 = ashr i32 %0, 1
ret i32 %2
}
void ff_hevc_put_hevc_bi_w_epel_h4_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_epel_h4_8_sse4() {
ret void
}
int main() {
  union {
    int a;
    int b;
  } u;
  u.a = 1;
  u.b = 3;
  if (u.a != 3 || u.b != 3)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    112d <main+0x2d>
cmpl   $0x3,-0x8(%rbp)
je     1139 <main+0x39>
movl   $0x1,-0x4(%rbp)
jmp    1140 <main+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.anon
store i32 0, i32* %1
%3 = bitcast %union.anon* %2 to i32*
store i32 1, i32* %3
%4 = bitcast %union.anon* %2 to i32*
store i32 3, i32* %4
%5 = bitcast %union.anon* %2 to i32*
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 3
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = bitcast %union.anon* %2 to i32*
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %8, %0
store i32 1, i32* %1
br label %14
13: ; preds = %8
store i32 0, i32* %1
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
void *sbrk(int);
void *allocNew(size_t numBytes) {
  void *freeSegment = sbrk(sizeof(size_t) + numBytes);
  if ((freeSegment == (void *)(-1)) | (freeSegment == NULL))
    return NULL;
  *((size_t *)freeSegment) = numBytes;
  void *userMemory = freeSegment + sizeof(size_t);
  return userMemory;
}


x86 assembly (clang, -O0):
<allocNew>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmpq   $0x0,-0x18(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%ecx
or     %ecx,%eax
cmp    $0x0,%eax
je     1168 <allocNew+0x58>
movq   $0x0,-0x8(%rbp)
jmp    1187 <allocNew+0x77>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocNew>:
push   %rbx
mov    %rdi,%rbx
add    $0x8,%edi
call   1030 <sbrk@plt>
lea    0x1(%rax),%rcx
cmp    $0x2,%rcx
jae    112a <allocNew+0x1a>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,(%rax)
add    $0x8,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @allocNew(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %3
%6 = load i64, i64* %3
%7 = add i64 8, %6
%8 = trunc i64 %7 to i32
%9 = call i8* @sbrk(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, inttoptr (i64 -1 to i8*)
%12 = zext i1 %11 to i32
%13 = load i8*, i8** %4
%14 = icmp eq i8* %13, null
%15 = zext i1 %14 to i32
%16 = or i32 %12, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %1
store i8* null, i8** %2
br label %26
19: ; preds = %1
%20 = load i64, i64* %3
%21 = load i8*, i8** %4
%22 = bitcast i8* %21 to i64*
store i64 %20, i64* %22
%23 = load i8*, i8** %4
%24 = getelementptr i8, i8* %23, i64 8
store i8* %24, i8** %5
%25 = load i8*, i8** %5
store i8* %25, i8** %2
br label %26
26: ; preds = %19, %18
%27 = load i8*, i8** %2
ret i8* %27
}

LLVM IR (-O2):
define i8* @allocNew(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = add i32 %2, 8
%4 = tail call i8* @sbrk(i32 %3)
%5 = ptrtoint i8* %4 to i64
switch i64 %5, label %6 [
i64 -1, label %9
i64 0, label %9
]
6: ; preds = %1
%7 = bitcast i8* %4 to i64*
store i64 %0, i64* %7
%8 = getelementptr i8, i8* %4, i64 8
br label %9
9: ; preds = %1, %1, %6
%10 = phi i8* [ %8, %6 ], [ null, %1 ], [ null, %1 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ set_hl(int);
void opcb_ce() { set_hl(1); }


x86 assembly (clang, -O0):
<opcb_ce>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <set_hl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<opcb_ce>:
mov    $0x1,%edi
jmp    1030 <set_hl@plt>

LLVM IR (-O0):
define void @opcb_ce() {
%1 = call i32 @set_hl(i32 1)
ret void
}

LLVM IR (-O2):
define void @opcb_ce() {
%1 = tail call i32 @set_hl(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(long);
void gexit(long code) { exit(code); }


x86 assembly (clang, -O0):
<gexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<gexit>:
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define void @gexit(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @exit(i64 %3)
unreachable
}

LLVM IR (-O2):
define void @gexit(i64 %0) {
%2 = tail call i32 @exit(i64 %0)
unreachable
}
void extern_func1_15(int a, char *b, unsigned long c) { return; }


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

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

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

LLVM IR (-O2):
define void @extern_func1_15(i32 %0, i8* nocapture %1, i64 %2) {
ret void
}
int test_imm_E7int16_mem(short *val) {
  return ((*val) & (-0xE7 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E7int16_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, -231
%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_E7int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -231
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_0Duint32_mem(unsigned int *val) {
  return ((*val) & (0x0D << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_0Duint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 13
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void border_ne_ext_diagonal_special_sand_short_hori(unsigned char *pic,
                                                    unsigned char *mirr) {
  *pic = 0x2B;
  *mirr = 0x02;
}


x86 assembly (clang, -O0):
<border_ne_ext_diagonal_special_sand_short_hori>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x2b,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x2,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<border_ne_ext_diagonal_special_sand_short_hori>:
movb   $0x2b,(%rdi)
movb   $0x2,(%rsi)
ret

LLVM IR (-O0):
define void @border_ne_ext_diagonal_special_sand_short_hori(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
store i8 43, i8* %5
%6 = load i8*, i8** %4
store i8 2, i8* %6
ret void
}

LLVM IR (-O2):
define void @border_ne_ext_diagonal_special_sand_short_hori(i8* nocapture writeonly %0, i8* nocapture writeonly %1) {
store i8 43, i8* %0
store i8 2, i8* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int /*<<< orphan*/ comp_encode(int);
int fastsin(scalar_t__);
uint8_t _modem_encode(int bit) {
  static int16_t t;
  t += bit == 0 ? ((int16_t)(1700.0 / 8000.0 * 65536.0))
                : ((int16_t)(2100.0 / 8000.0 * 65536.0));
  return comp_encode(fastsin(t) >> 2);
}


x86 assembly (clang, -O0):
<_modem_encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x4333,%eax
mov    $0x3666,%ecx
cmp    $0x0,%edx
cmove  %rcx,%rax
add    0x2ef2(%rip),%rax
mov    %rax,0x2eeb(%rip)
mov    0x2ee4(%rip),%rdi
call   1040 <fastsin@plt>
mov    %eax,%edi
sar    $0x2,%edi
call   1030 <comp_encode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_modem_encode>:
push   %rax
mov    0x2f10(%rip),%rax
lea    0x4333(%rax),%rcx
add    $0x3666,%rax
test   %edi,%edi
cmovne %rcx,%rax
mov    %rax,0x2ef6(%rip)
mov    %rax,%rdi
call   1040 <fastsin@plt>
sar    $0x2,%eax
mov    %eax,%edi
pop    %rax
jmp    1030 <comp_encode@plt>

LLVM IR (-O0):
@_modem_encode.t = internal global i64 0
define i32 @_modem_encode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i64 13926, i64 17203
%7 = load i64, i64* @_modem_encode.t
%8 = add nsw i64 %7, %6
store i64 %8, i64* @_modem_encode.t
%9 = load i64, i64* @_modem_encode.t
%10 = call i32 @fastsin(i64 %9)
%11 = ashr i32 %10, 2
%12 = call i32 @comp_encode(i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@_modem_encode.t = internal unnamed_addr global i64 0
define i32 @_modem_encode(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i64 13926, i64 17203
%4 = load i64, i64* @_modem_encode.t
%5 = add nsw i64 %4, %3
store i64 %5, i64* @_modem_encode.t
%6 = tail call i32 @fastsin(i64 %5)
%7 = ashr i32 %6, 2
%8 = tail call i32 @comp_encode(i32 %7)
ret i32 %8
}
/* Variables and functions */
long lrand48();
__attribute__((__weak__, __always___)) long int softboundcets_lrand48() {
  return lrand48();
}


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

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

LLVM IR (-O0):
define weak i64 @softboundcets_lrand48() {
%1 = call i64 (...) @lrand48()
ret i64 %1
}

LLVM IR (-O2):
define weak i64 @softboundcets_lrand48() {
%1 = tail call i64 (...) @lrand48()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void main() { system("cd /"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"cd /\00"
define void @main() {
%1 = call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"cd /\00"
define void @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ caddr_t;

/* Variables and functions */
int /*<<< orphan*/ munmap(int /*<<< orphan*/, unsigned long const);
int free_pages(void *pages, const unsigned long size, const int sbrk_b) {
  if (!sbrk_b) {
    (void)munmap((caddr_t)pages, size);
  }
  return 1;
}


x86 assembly (clang, -O0):
<free_pages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113c <free_pages+0x2c>
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <munmap@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_pages>:
test   %edx,%edx
je     111a <free_pages+0xa>
mov    $0x1,%eax
ret
push   %rax
call   1030 <munmap@plt>
add    $0x8,%rsp
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @free_pages(i8* %0, i64 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = ptrtoint i8* %0 to i64
%7 = trunc i64 %6 to i32
%8 = tail call i32 @munmap(i32 %7, i64 %1)
br label %9
9: ; preds = %5, %3
ret i32 1
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double rand_double(const int range) {
  double r = range * (double)rand() / (double)RAND_MAX;
  if (r == 0)
    return rand_double(range);
  return r;
}


x86 assembly (clang, -O0):
<rand_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e97(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1189 <rand_double+0x69>
jp     1189 <rand_double+0x69>
mov    -0xc(%rbp),%edi
call   1030 <rand_double@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1193 <rand_double+0x73>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_double>:
push   %rbx
sub    $0x10,%rsp
cvtsi2sd %edi,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x2ec2(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
mulsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
ucomisd 0xea7(%rip),%xmm0
jne    115d <rand_double+0x4d>
jnp    1130 <rand_double+0x20>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @rand_double(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = call i64 (...) @rand()
%8 = sitofp i64 %7 to double
%9 = fmul double %6, %8
%10 = load i64, i64* @RAND_MAX
%11 = sitofp i64 %10 to double
%12 = fdiv double %9, %11
store double %12, double* %4
%13 = load double, double* %4
%14 = fcmp oeq double %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load i32, i32* %3
%17 = call double @rand_double(i32 %16)
store double %17, double* %2
br label %20
18: ; preds = %1
%19 = load double, double* %4
store double %19, double* %2
br label %20
20: ; preds = %18, %15
%21 = load double, double* %2
ret double %21
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @rand_double(i32 %0) {
%2 = sitofp i32 %0 to double
br label %3
3: ; preds = %3, %1
%4 = tail call i64 (...) @rand()
%5 = sitofp i64 %4 to double
%6 = fmul double %2, %5
%7 = load i64, i64* @RAND_MAX
%8 = sitofp i64 %7 to double
%9 = fdiv double %6, %8
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %3, label %11
11: ; preds = %3
ret double %9
}
/* Type definitions */
struct sembuf {
  int member_1;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_0;
};
typedef int /*<<< orphan*/ operation;

/* Variables and functions */
int /*<<< orphan*/ SEM_UNDO;
int /*<<< orphan*/ semop(int, struct sembuf *, int);
void sem_lock(int semid) {
  struct sembuf operation[] = {
      {0, -1, SEM_UNDO},
  };
  semop(semid, operation, (sizeof(operation) / sizeof(struct sembuf)));
}


x86 assembly (clang, -O0):
<sem_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_lock>:
sub    $0x18,%rsp
movabs $0xffffffff00000000,%rax
ff ff ff
mov    %rax,0x8(%rsp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sembuf = type { i32, i32, i32 }
@SEM_UNDO = global i32 0
define void @sem_lock(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x %struct.sembuf]
store i32 %0, i32* %2
%4 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %3, i64 0, i64 0
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i32 0, i32 0
store i32 0, i32* %5
%6 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i32 0, i32 1
store i32 -1, i32* %6
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %4, i32 0, i32 2
%8 = load i32, i32* @SEM_UNDO
store i32 %8, i32* %7
%9 = load i32, i32* %2
%10 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %3, i64 0, i64 0
%11 = call i32 @semop(i32 %9, %struct.sembuf* %10, i32 1)
ret void
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i32, i32 }
@SEM_UNDO = global i32 0
define void @sem_lock(i32 %0) {
%2 = alloca [1 x %struct.sembuf]
%3 = bitcast [1 x %struct.sembuf]* %2 to i8*
%4 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0
%5 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0, i32 0
store i32 0, i32* %5
%6 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0, i32 1
store i32 -1, i32* %6
%7 = getelementptr inbounds [1 x %struct.sembuf], [1 x %struct.sembuf]* %2, i64 0, i64 0, i32 2
%8 = load i32, i32* @SEM_UNDO
store i32 %8, i32* %7
%9 = call i32 @semop(i32 %0, %struct.sembuf* %4, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SYS_exit;
int /*<<< orphan*/ SYS_write;
int /*<<< orphan*/ bye(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ hello(int, char *, int, int /*<<< orphan*/);
void main() {
  hello(1, "Hello World from arm world\n",
        sizeof("Hello World from arm world\n"), SYS_write);
  bye(0, SYS_exit);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edi
lea    0xec7(%rip),%rsi
mov    $0x1c,%edx
call   1030 <hello@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <bye@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%ecx
lea    0xecf(%rip),%rsi
mov    $0x1,%edi
mov    $0x1c,%edx
call   1030 <hello@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
pop    %rax
jmp    1040 <bye@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Hello World from arm world\0A\00"
@SYS_write = global i32 0
@SYS_exit = global i32 0
define void @main() {
%1 = load i32, i32* @SYS_write
%2 = call i32 @hello(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 28, i32 %1)
%3 = load i32, i32* @SYS_exit
%4 = call i32 @bye(i32 0, i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Hello World from arm world\0A\00"
@SYS_write = global i32 0
@SYS_exit = global i32 0
define void @main() {
%1 = load i32, i32* @SYS_write
%2 = tail call i32 @hello(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 28, i32 %1)
%3 = load i32, i32* @SYS_exit
%4 = tail call i32 @bye(i32 0, i32 %3)
ret void
}
void RTAvlULDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlULDestroy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void print_error(char message[]) { printf("[error] %s\n", message); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"[error] %s\0A\00"
define void @print_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_long_xor_to_all(long *target, long *source, int nreduce,
                                  int PE_start, int logPE_stride, int PE_size,
                                  long *pWrk, long *pSync) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_long_xor_to_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_long_xor_to_all(i64* %0, i64* %1, i32 %2, i32 %3, i32 %4, i32 %5, i64* %6, i64* %7) {
%9 = alloca i64*
%10 = alloca i64*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64*
%16 = alloca i64*
store i64* %0, i64** %9
store i64* %1, i64** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i64* %6, i64** %15
store i64* %7, i64** %16
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_long_xor_to_all(i64* nocapture readnone %0, i64* nocapture readnone %1, i32 %2, i32 %3, i32 %4, i32 %5, i64* nocapture readnone %6, i64* nocapture readnone %7) {
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ setbuf(int /*<<< orphan*/ *, char *);
void uninivar_setbuf(void) {
  FILE *stream;
  char *buf;
  (void)setbuf(stream, buf);
}


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

x86 assembly (clang, -O2):
<uninivar_setbuf>:
jmp    1030 <setbuf@plt>

LLVM IR (-O0):
define void @uninivar_setbuf() {
%1 = alloca i32*
%2 = alloca i8*
%3 = load i32*, i32** %1
%4 = load i8*, i8** %2
%5 = call i32 @setbuf(i32* %3, i8* %4)
ret void
}

LLVM IR (-O2):
define void @uninivar_setbuf() {
%1 = tail call i32 @setbuf(i32* undef, i8* undef)
ret void
}
int is_octal(int ch) { return ((ch >= '0') && (ch <= '7')); }


x86 assembly (clang, -O0):
<is_octal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <is_octal+0x20>
cmpl   $0x37,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_octal>:
and    $0xfffffff8,%edi
xor    %eax,%eax
cmp    $0x30,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_octal(i32 %0) {
%2 = and i32 %0, -8
%3 = icmp eq i32 %2, 48
%4 = zext i1 %3 to i32
ret i32 %4
}
int fls(unsigned long x) {
  long r;
  asm("bsr %1,%0\n\t"
      "jnz 1f\n\t"
      "mov $-1,%0\n"
      "1:"
      : "=r"(r)
      : "rm"(x));
  return (int)r + 1;
}


x86 assembly (clang, -O0):
<fls>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
bsr    -0x18(%rbp),%rax
jne    1122 <fls+0x22>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fls>:
mov    %rdi,-0x8(%rsp)
bsr    -0x8(%rsp),%rax
jne    1114 <fls+0x14>
mov    $0xffffffffffffffff,%rax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @fls(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 asm "bsr $1,$0\0A\09jnz 1f\0A\09mov $$-1,$0\0A1:", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
%8 = add nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @fls(i64 %0) {
%2 = tail call i64 asm "bsr $1,$0\0A\09jnz 1f\0A\09mov $$-1,$0\0A1:", "=r,rm,~{dirflag},~{fpsr},~{flags}"(i64 %0)
%3 = trunc i64 %2 to i32
%4 = add nsw i32 %3, 1
ret i32 %4
}
int str_toupper(char *src) {
  int i, c;
  for (i = 0; (c = src[i]) != '\0'; i++) {
    if (c >= 'a' && c <= 'z')
      src[i] = c + 'A' - 'a';
  }
  return i;
}


x86 assembly (clang, -O0):
<str_toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1164 <str_toupper+0x64>
cmpl   $0x61,-0x10(%rbp)
jl     1151 <str_toupper+0x51>
cmpl   $0x7a,-0x10(%rbp)
jg     1151 <str_toupper+0x51>
mov    -0x10(%rbp),%eax
add    $0x41,%eax
sub    $0x61,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1156 <str_toupper+0x56>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <str_toupper+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_toupper>:
mov    (%rdi),%cl
xor    %eax,%eax
jmp    1119 <str_toupper+0x19>
cs nopw 0x0(%rax,%rax,1)
movzbl 0x1(%rdi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
je     112d <str_toupper+0x2d>
lea    -0x61(%rcx),%edx
cmp    $0x19,%dl
ja     1110 <str_toupper+0x10>
add    $0xe0,%cl
mov    %cl,(%rdi,%rax,1)
jmp    1110 <str_toupper+0x10>
ret

LLVM IR (-O0):
define i32 @str_toupper(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %29, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
store i32 %11, i32* %4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %5
%14 = load i32, i32* %4
%15 = icmp sge i32 %14, 97
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp sle i32 %17, 122
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 65
%22 = sub nsw i32 %21, 97
%23 = trunc i32 %22 to i8
%24 = load i8*, i8** %2
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 %23, i8* %27
br label %28
28: ; preds = %19, %16, %13
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %5
32: ; preds = %5
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @str_toupper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %12
%5 = phi i64 [ %13, %12 ], [ 0, %1 ]
%6 = phi i8 [ %15, %12 ], [ %2, %1 ]
%7 = phi i8* [ %14, %12 ], [ %0, %1 ]
%8 = add i8 %6, -97
%9 = icmp ult i8 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = add nsw i8 %6, -32
store i8 %11, i8* %7
br label %12
12: ; preds = %4, %10
%13 = add nuw i64 %5, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %12
%18 = trunc i64 %13 to i32
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 0, %1 ], [ %18, %17 ]
ret i32 %20
}
char add_char(char x, char y) { return x + y; }


x86 assembly (clang, -O0):
<add_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_char>:
lea    (%rsi,%rdi,1),%eax
ret

LLVM IR (-O0):
define signext i8 @add_char(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = add nsw i32 %6, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @add_char(i8 signext %0, i8 signext %1) {
%3 = add i8 %1, %0
ret i8 %3
}
double rt_timer_timenow(void *v) {
  rt_timer_stop(v);
  double return_value_rt_timer_time$1;
  return_value_rt_timer_time$1 = rt_timer_time(v);
  return return_value_rt_timer_time$1;
}


x86 assembly (clang, -O0):
<rt_timer_timenow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <rt_timer_stop@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <rt_timer_time@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_timer_timenow>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rt_timer_stop@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <rt_timer_time@plt>
cvtsi2sd %eax,%xmm0
pop    %rbx
ret

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

LLVM IR (-O2):
define double @rt_timer_timenow(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @rt_timer_stop to i32 (i8*, ...)*)(i8* %0)
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @rt_timer_time to i32 (i8*, ...)*)(i8* %0)
%4 = sitofp i32 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void myKbd(unsigned char key, int x, int y) {
  if (key == 27)
    exit(0);
}


x86 assembly (clang, -O0):
<myKbd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1b,%eax
jne    1138 <myKbd+0x28>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myKbd>:
cmp    $0x1b,%dil
je     1117 <myKbd+0x7>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @myKbd(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 27
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @myKbd(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
ret void
}