xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
scalar_t__ isPrime(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (isPrime(atoi(argv[1]))) {
    printf("prime\n");
  } else {
    printf("not prime\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <isPrime@plt>
cmp    $0x0,%rax
je     1175 <main+0x45>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <main+0x51>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <isPrime@plt>
test   %rax,%rax
lea    0xeb5(%rip),%rax
lea    0xeb2(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"prime\0A\00"
@.str.1 = [11 x i8] c"not prime\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @atoi(i8* %8)
%10 = call i64 @isPrime(i32 %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret i32 0
}

LLVM IR (-O2):
@str = [10 x i8] c"not prime\00"
@str.2 = [6 x i8] c"prime\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i64 @isPrime(i32 %5)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0)
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
ret i32 0
}
/* Type definitions */
struct inOutBuff {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ writeBuff(struct inOutBuff *, unsigned char const *,
                             int /*<<< orphan*/);
void writeBuffString(struct inOutBuff *write, const char *string) {
  writeBuff(write, (const unsigned char *)string, strlen(string));
}


x86 assembly (clang, -O0):
<writeBuffString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <writeBuff@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeBuffString>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <writeBuff@plt>

LLVM IR (-O0):
%struct.inOutBuff = type { i32 }
define void @writeBuffString(%struct.inOutBuff* %0, i8* %1) {
%3 = alloca %struct.inOutBuff*
%4 = alloca i8*
store %struct.inOutBuff* %0, %struct.inOutBuff** %3
store i8* %1, i8** %4
%5 = load %struct.inOutBuff*, %struct.inOutBuff** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @writeBuff(%struct.inOutBuff* %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.inOutBuff = type { i32 }
define void @writeBuffString(%struct.inOutBuff* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @writeBuff(%struct.inOutBuff* %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
long pathconf(char *, int);
__attribute__((__weak__, __always___)) long softboundcets_pathconf(char *path,
                                                                   int name) {
  return pathconf(path, name);
}


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

x86 assembly (clang, -O2):
<softboundcets_pathconf>:
jmp    1030 <pathconf@plt>

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

LLVM IR (-O2):
define weak i64 @softboundcets_pathconf(i8* %0, i32 %1) {
%3 = tail call i64 @pathconf(i8* %0, i32 %1)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *, int *);
int foo() {
  int d;
  static int e = 5;
  printf("&d=%p &le=%p\n", &d, &e);
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x2f09(%rip),%rdx
lea    0x4(%rsp),%rsi
call   1030 <printf@plt>
pop    %rcx
ret

LLVM IR (-O0):
@foo.e = internal global i32 5
@.str = [14 x i8] c"&d=%p &le=%p\0A\00"
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* %2, i32* @foo.e)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@foo.e = internal global i32 5
@.str = [14 x i8] c"&d=%p &le=%p\0A\00"
define i32 @foo() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* %1, i32* @foo.e)
ret i32 undef
}
float lqi_limit(float lqi) {
  if (lqi < 0.0)
    return 0.0;
  else if (lqi > 1.0)
    return 1.0;
  else
    return lqi;
}


x86 assembly (clang, -O0):
<lqi_limit>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    112c <lqi_limit+0x2c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1163 <lqi_limit+0x63>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1159 <lqi_limit+0x59>
movss  0xeb9(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1163 <lqi_limit+0x63>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lqi_limit>:
movss  0xef8(%rip),%xmm1
minss  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cmpltss %xmm2,%xmm0
andnps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @lqi_limit(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store float 0.000000e+00, float* %2
br label %15
8: ; preds = %1
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fcmp ogt double %10, 1.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %8
store float 1.000000e+00, float* %2
br label %15
13: ; preds = %8
%14 = load float, float* %3
store float %14, float* %2
br label %15
15: ; preds = %13, %12, %7
%16 = load float, float* %2
ret float %16
}

LLVM IR (-O2):
define float @lqi_limit(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fcmp ogt float %0, 1.000000e+00
%4 = select i1 %3, float 1.000000e+00, float %0
%5 = select i1 %2, float 0.000000e+00, float %4
ret float %5
}
/* Variables and functions */
int posix_memalign(void **, size_t, size_t);
void *luaio_memalign(size_t align, size_t size) {
  void *p;
  int err = posix_memalign(&p, align, size);
  return err ? NULL : p;
}


x86 assembly (clang, -O0):
<luaio_memalign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
call   1030 <posix_memalign@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1149 <luaio_memalign+0x39>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1151 <luaio_memalign+0x41>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<luaio_memalign>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <posix_memalign@plt>
test   %eax,%eax
jne    1129 <luaio_memalign+0x19>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @luaio_memalign(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @posix_memalign(i8** %3, i64 %0, i64 %1)
%6 = icmp eq i32 %5, 0
%7 = load i8*, i8** %3
%8 = select i1 %6, i8* %7, i8* null
ret i8* %8
}
int ncrk(int a, int b) { return (a & ~b) ? 23 : 42; }


x86 assembly (clang, -O0):
<ncrk>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
and    %eax,%edx
mov    $0x2a,%eax
mov    $0x17,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncrk>:
not    %esi
test   %edi,%esi
mov    $0x2a,%ecx
mov    $0x17,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ncrk(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %6, -1
%8 = and i32 %5, %7
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 23, i32 42
ret i32 %11
}

LLVM IR (-O2):
define i32 @ncrk(i32 %0, i32 %1) {
%3 = xor i32 %1, -1
%4 = and i32 %3, %0
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 42, i32 23
ret i32 %6
}
char *mkstr(c)
char c;
{
  static char s[2];
  s[0] = c;
  s[1] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<mkstr>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,0x2f0e(%rip)
movb   $0x0,0x2f08(%rip)
lea    0x2f00(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkstr>:
mov    %dil,0x2f1a(%rip)
lea    0x2f13(%rip),%rax
movb   $0x0,0x2f0d(%rip)
ret

LLVM IR (-O0):
@mkstr.s = internal global [2 x i8] zeroinitializer
define i8* @mkstr(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
store i8 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @mkstr.s, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @mkstr.s, i64 0, i64 1)
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @mkstr.s, i64 0, i64 0)
}

LLVM IR (-O2):
@mkstr.s = internal global [2 x i8] zeroinitializer
define i8* @mkstr(i32 %0) {
%2 = trunc i32 %0 to i8
store i8 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @mkstr.s, i64 0, i64 0)
store i8 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @mkstr.s, i64 0, i64 1)
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @mkstr.s, i64 0, i64 0)
}
/* Variables and functions */
int foo();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("This is text.\n");
  return foo();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"This is text.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @foo()
ret i32 %3
}

LLVM IR (-O2):
@str = [14 x i8] c"This is text.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @foo()
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) int detexGetPixelSize(uint32_t pixel_format) {
  return 1 + ((pixel_format & 0xF00) >> 8);
}


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

x86 assembly (clang, -O2):
<detexGetPixelSize>:
shr    $0x8,%edi
and    $0xf,%edi
lea    0x1(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @detexGetPixelSize(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 15
%4 = add nuw nsw i32 %3, 1
ret i32 %4
}
void l0() {}


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

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

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

LLVM IR (-O2):
define void @l0() {
ret void
}
/* Variables and functions */
int(Memento_paranoidAt)(int i) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @Memento_paranoidAt(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _I8080_XTHL();
void do0xE3() { _I8080_XTHL(); }


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

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

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

LLVM IR (-O2):
define void @do0xE3() {
%1 = tail call i32 (...) @_I8080_XTHL()
ret void
}
int __mp_setuser(void *p, void *d) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__mp_setuser(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
void ve0_nfs_data_init(struct ve_struct *ve) {}


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

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

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

LLVM IR (-O2):
%struct.ve_struct = type opaque
define void @ve0_nfs_data_init(%struct.ve_struct* nocapture %0) {
ret void
}
/* Type definitions */
struct passwd {
  int pw_uid;
};

/* Variables and functions */
struct passwd *getpwnam(char *);
int /*<<< orphan*/ warn(char *);
int lprGetUID(void) {
  struct passwd *user;
  user = getpwnam("lp");
  if (user == 0) {
    warn("Cannot fetch UID of user lp. Assuming UID(lp)==7");
    return 7;
  }
  return user->pw_uid;
}


x86 assembly (clang, -O0):
<lprGetUID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <getpwnam@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115b <lprGetUID+0x3b>
lea    0xeb9(%rip),%rdi
call   1030 <warn@plt>
movl   $0x7,-0x4(%rbp)
jmp    1164 <lprGetUID+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lprGetUID>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <getpwnam@plt>
test   %rax,%rax
je     1136 <lprGetUID+0x16>
mov    (%rax),%eax
pop    %rcx
ret
lea    0xec6(%rip),%rdi
call   1030 <warn@plt>
mov    $0x7,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.passwd = type { i32 }
@.str = [3 x i8] c"lp\00"
@.str.1 = [49 x i8] c"Cannot fetch UID of user lp. Assuming UID(lp)==7\00"
define i32 @lprGetUID() {
%1 = alloca i32
%2 = alloca %struct.passwd*
%3 = call %struct.passwd* @getpwnam(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store %struct.passwd* %3, %struct.passwd** %2
%4 = load %struct.passwd*, %struct.passwd** %2
%5 = icmp eq %struct.passwd* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @warn(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
store i32 7, i32* %1
br label %12
8: ; preds = %0
%9 = load %struct.passwd*, %struct.passwd** %2
%10 = getelementptr inbounds %struct.passwd, %struct.passwd* %9, i32 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %1
br label %12
12: ; preds = %8, %6
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@.str = [3 x i8] c"lp\00"
@.str.1 = [49 x i8] c"Cannot fetch UID of user lp. Assuming UID(lp)==7\00"
define i32 @lprGetUID() {
%1 = tail call %struct.passwd* @getpwnam(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq %struct.passwd* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @warn(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = getelementptr inbounds %struct.passwd, %struct.passwd* %1, i64 0, i32 0
%7 = load i32, i32* %6
br label %8
8: ; preds = %5, %3
%9 = phi i32 [ 7, %3 ], [ %7, %5 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ SOCK_DGRAM;
int socket(int, int /*<<< orphan*/, int /*<<< orphan*/);
int udpopen(int domain, int *opt_err) {
  int s;
  s = socket(domain, SOCK_DGRAM, IPPROTO_UDP);
  if (s < 0)
    return -1;
  return s;
}


x86 assembly (clang, -O0):
<udpopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1152 <udpopen+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <udpopen+0x48>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udpopen>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
call   1030 <socket@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
define i32 @udpopen(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* %4
%8 = load i32, i32* @SOCK_DGRAM
%9 = load i32, i32* @IPPROTO_UDP
%10 = call i32 @socket(i32 %7, i32 %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %16
14: ; preds = %2
%15 = load i32, i32* %6
store i32 %15, i32* %3
br label %16
16: ; preds = %14, %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
define i32 @udpopen(i32 %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @SOCK_DGRAM
%4 = load i32, i32* @IPPROTO_UDP
%5 = tail call i32 @socket(i32 %0, i32 %3, i32 %4)
%6 = icmp sgt i32 %5, -1
%7 = select i1 %6, i32 %5, i32 -1
ret i32 %7
}
int gettimeofday(struct timeval *__restrict tv, void *__restrict tz) {
  int result = gettimeofday(tv, (struct timezone *)tz);
  return result;
}


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

x86 assembly (clang, -O2):
<gettimeofday>:
jmp    1100 <gettimeofday>

LLVM IR (-O0):
%struct.timeval = type opaque
%struct.timezone = type opaque
define i32 @gettimeofday(%struct.timeval* noalias %0, i8* noalias %1) {
%3 = alloca %struct.timeval*
%4 = alloca i8*
%5 = alloca i32
store %struct.timeval* %0, %struct.timeval** %3
store i8* %1, i8** %4
%6 = load %struct.timeval*, %struct.timeval** %3
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to %struct.timezone*
%9 = bitcast %struct.timezone* %8 to i8*
%10 = call i32 @gettimeofday(%struct.timeval* %6, i8* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
%struct.timeval = type opaque
define i32 @gettimeofday(%struct.timeval* noalias nocapture readnone %0, i8* noalias nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
br label %3
}
char *next_aligned(char *p, unsigned int alignbytes) {
  unsigned long alignptr;
  alignptr = (unsigned long)(p + 1);
  return (char *)(alignptr + (unsigned long)alignbytes -
                  (alignptr % (unsigned long)alignbytes));
}


x86 assembly (clang, -O0):
<next_aligned>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
div    %rcx
mov    -0x20(%rbp),%rax
sub    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_aligned>:
mov    %rdi,%rax
mov    %esi,%esi
lea    (%rdi,%rsi,1),%rcx
add    $0x1,%rcx
add    $0x1,%rax
mov    %rax,%rdx
shr    $0x20,%rdx
je     1121 <next_aligned+0x21>
xor    %edx,%edx
div    %rsi
jmp    1125 <next_aligned+0x25>
xor    %edx,%edx
div    %esi
sub    %rdx,%rcx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i8* @next_aligned(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = ptrtoint i8* %7 to i64
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = add i64 %9, %11
%13 = load i64, i64* %5
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = urem i64 %13, %15
%17 = sub i64 %12, %16
%18 = inttoptr i64 %17 to i8*
ret i8* %18
}

LLVM IR (-O2):
define i8* @next_aligned(i8* %0, i32 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = ptrtoint i8* %3 to i64
%5 = zext i32 %1 to i64
%6 = add i64 %4, %5
%7 = urem i64 %4, %5
%8 = sub i64 %6, %7
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  int i = 6, j = 4;
  printf("NO\n");
  switch (i) {
    do {
    case 1:
      printf("yes\n");
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      j--;
    } while (j);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1166 <main+0x56>
jmp    114d <main+0x3d>
mov    -0x10(%rbp),%eax
add    $0xfffffffe,%eax
sub    $0x5,%eax
jb     1172 <main+0x62>
jmp    118a <main+0x7a>
jmp    1166 <main+0x56>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1161 <main+0x51>
jmp    118a <main+0x7a>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"NO\0A\00"
@.str.1 = [5 x i8] c"yes\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 6, i32* %2
store i32 4, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
switch i32 %5, label %17 [
i32 1, label %8
i32 2, label %10
i32 3, label %10
i32 4, label %10
i32 5, label %10
i32 6, label %10
]
6: ; No predecessors!
br label %7
7: ; preds = %13, %6
br label %8
8: ; preds = %0, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %0, %0, %0, %0, %0, %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, -1
store i32 %12, i32* %3
br label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %7, label %16
16: ; preds = %13
br label %17
17: ; preds = %16, %0
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@str = [3 x i8] c"NO\00"
@str.2 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int scanf(char *, unsigned long *, int *);
int /*<<< orphan*/ to_base_n(unsigned long, int);
int main(void) {
  unsigned long num;
  int radix;
  while (scanf("%lu%d", &num, &radix) == 2) {
    to_base_n(num, radix);
    putchar('\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    1177 <main+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <to_base_n@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    119b <main+0x6b>
lea    0xea5(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%rdi
mov    0x4(%rsp),%esi
call   1040 <to_base_n@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
je     1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%lu%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %7, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %2, i32* %3)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i64, i64* %2
%9 = load i32, i32* %3
%10 = call i32 @to_base_n(i64 %8, i32 %9)
%11 = call i32 @putchar(i8 signext 10)
br label %4
12: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lu%d\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = load i64, i64* %1
%9 = load i32, i32* %2
%10 = call i32 @to_base_n(i64 %8, i32 %9)
%11 = call i32 @putchar(i8 signext 10)
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %1, i32* %2)
%13 = icmp eq i32 %12, 2
br i1 %13, label %7, label %14
14: ; preds = %7, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ readChunkFromFile(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/, int);
int32_t readByteFromFile(FILE *pFile, uint8_t *dst, int32_t startPos) {
  return readChunkFromFile(pFile, dst, startPos, sizeof(uint8_t));
}


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

x86 assembly (clang, -O2):
<readByteFromFile>:
mov    $0x4,%ecx
jmp    1030 <readChunkFromFile@plt>

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

LLVM IR (-O2):
define i32 @readByteFromFile(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @readChunkFromFile(i32* %0, i32* %1, i32 %2, i32 4)
ret i32 %4
}
/* Variables and functions */
int smallest_2(int, int);
int smallest(int *ints, unsigned int len) {
  int c = ints[len - 1];
  while (len--)
    c = smallest_2(c, ints[len]);
  return c;
}


x86 assembly (clang, -O0):
<smallest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     115f <smallest+0x4f>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
call   1030 <smallest_2@plt>
mov    %eax,-0x10(%rbp)
jmp    1131 <smallest+0x21>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smallest>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%eax
sub    $0x1,%eax
mov    (%rdi,%rax,4),%eax
jb     1142 <smallest+0x32>
mov    %rdi,%r14
mov    %esi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x4(%r14,%rbx,4),%esi
mov    %eax,%edi
call   1030 <smallest_2@plt>
add    $0xffffffffffffffff,%rbx
jne    1130 <smallest+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @smallest(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %1, 0
br i1 %7, label %18, label %8
8: ; preds = %2
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ %9, %8 ], [ %13, %10 ]
%12 = phi i32 [ %6, %8 ], [ %16, %10 ]
%13 = add nsw i64 %11, -1
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = tail call i32 @smallest_2(i32 %12, i32 %15)
%17 = icmp eq i64 %13, 0
br i1 %17, label %18, label %10
18: ; preds = %10, %2
%19 = phi i32 [ %6, %2 ], [ %16, %10 ]
ret i32 %19
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ sigdelset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigsuspend(int /*<<< orphan*/ *);
void sig_stop_handler(int signal __attribute__((unused))) {
  sigset_t set;
  sigfillset(&set);
  sigdelset(&set, SIGCONT);
  sigdelset(&set, SIGINT);
  sigdelset(&set, SIGKILL);
  sigsuspend(&set);
}


x86 assembly (clang, -O0):
<sig_stop_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <sigfillset@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigdelset@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigdelset@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigdelset@plt>
lea    -0x8(%rbp),%rdi
call   1040 <sigsuspend@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_stop_handler>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <sigfillset@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigdelset@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigdelset@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigdelset@plt>
mov    %rbx,%rdi
call   1040 <sigsuspend@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIGCONT = global i32 0
@SIGINT = global i32 0
@SIGKILL = global i32 0
define void @sig_stop_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @sigfillset(i32* %3)
%5 = load i32, i32* @SIGCONT
%6 = call i32 @sigdelset(i32* %3, i32 %5)
%7 = load i32, i32* @SIGINT
%8 = call i32 @sigdelset(i32* %3, i32 %7)
%9 = load i32, i32* @SIGKILL
%10 = call i32 @sigdelset(i32* %3, i32 %9)
%11 = call i32 @sigsuspend(i32* %3)
ret void
}

LLVM IR (-O2):
@SIGCONT = global i32 0
@SIGINT = global i32 0
@SIGKILL = global i32 0
define void @sig_stop_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sigfillset(i32* %2)
%5 = load i32, i32* @SIGCONT
%6 = call i32 @sigdelset(i32* %2, i32 %5)
%7 = load i32, i32* @SIGINT
%8 = call i32 @sigdelset(i32* %2, i32 %7)
%9 = load i32, i32* @SIGKILL
%10 = call i32 @sigdelset(i32* %2, i32 %9)
%11 = call i32 @sigsuspend(i32* %2)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void Interp5(uint32_t *pc, uint32_t c1, uint32_t c2) {
  if (c1 == c2) {
    *pc = c1;
    return;
  }
  *pc = ((((c1 & 0x00FF00) + (c2 & 0x00FF00)) >> 1) & 0x00FF00) +
        ((((c1 & 0xFF00FF) + (c2 & 0xFF00FF)) >> 1) & 0xFF00FF);
}


x86 assembly (clang, -O0):
<Interp5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1128 <Interp5+0x28>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    1167 <Interp5+0x67>
mov    -0xc(%rbp),%ecx
and    $0xff00,%ecx
mov    -0x10(%rbp),%eax
and    $0xff00,%eax
add    %eax,%ecx
sar    $0x1,%ecx
and    $0xff00,%ecx
mov    -0xc(%rbp),%eax
and    $0xff00ff,%eax
mov    -0x10(%rbp),%edx
and    $0xff00ff,%edx
add    %edx,%eax
sar    $0x1,%eax
and    $0xff00ff,%eax
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Interp5>:
cmp    %edx,%esi
je     1137 <Interp5+0x37>
mov    %esi,%eax
and    $0xff00,%eax
mov    %edx,%ecx
and    $0xff00,%ecx
add    %eax,%ecx
shr    %ecx
and    $0xff00,%ecx
and    $0xff00ff,%esi
and    $0xff00ff,%edx
add    %esi,%edx
shr    %edx
and    $0xff00ff,%edx
or     %ecx,%edx
mov    %edx,%esi
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @Interp5(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %17, label %5
5: ; preds = %3
%6 = and i32 %1, 65280
%7 = and i32 %2, 65280
%8 = add nuw nsw i32 %7, %6
%9 = lshr exact i32 %8, 1
%10 = and i32 %9, 65280
%11 = and i32 %1, 16711935
%12 = and i32 %2, 16711935
%13 = add nuw nsw i32 %12, %11
%14 = lshr i32 %13, 1
%15 = and i32 %14, 16711935
%16 = or i32 %10, %15
br label %17
17: ; preds = %3, %5
%18 = phi i32 [ %16, %5 ], [ %1, %3 ]
store i32 %18, i32* %0
ret void
}
void glutRemoveOverlay(void) {}


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

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

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

LLVM IR (-O2):
define void @glutRemoveOverlay() {
ret void
}
/* Variables and functions */
int hex2n(char);
int hex2byte(char *str) { return (hex2n(str[0]) << 4) + hex2n(str[1]); }


x86 assembly (clang, -O0):
<hex2byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <hex2n@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <hex2n@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2byte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <hex2n@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <hex2n@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hex2byte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = call i32 @hex2n(i8 signext %5)
%7 = shl i32 %6, 4
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = call i32 @hex2n(i8 signext %10)
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @hex2byte(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @hex2n(i8 signext %2)
%4 = shl i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @hex2n(i8 signext %6)
%8 = add nsw i32 %7, %4
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ KpOutPortW(int, int);
void KdBochsE9Break() {
  KpOutPortW(0x8A00, 0x08A00);
  KpOutPortW(0x8A00, 0x08AE0);
}


x86 assembly (clang, -O0):
<KdBochsE9Break>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8a00,%esi
mov    %esi,%edi
call   1030 <KpOutPortW@plt>
mov    $0x8a00,%edi
mov    $0x8ae0,%esi
call   1030 <KpOutPortW@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<KdBochsE9Break>:
push   %rax
mov    $0x8a00,%edi
mov    $0x8a00,%esi
call   1030 <KpOutPortW@plt>
mov    $0x8a00,%edi
mov    $0x8ae0,%esi
pop    %rax
jmp    1030 <KpOutPortW@plt>

LLVM IR (-O0):
define void @KdBochsE9Break() {
%1 = call i32 @KpOutPortW(i32 35328, i32 35328)
%2 = call i32 @KpOutPortW(i32 35328, i32 35552)
ret void
}

LLVM IR (-O2):
define void @KdBochsE9Break() {
%1 = tail call i32 @KpOutPortW(i32 35328, i32 35328)
%2 = tail call i32 @KpOutPortW(i32 35328, i32 35552)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t md5_G(uint32_t x, uint32_t y, uint32_t z) {
  return (x & z) | ((~z) & y);
}


x86 assembly (clang, -O0):
<md5_G>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<md5_G>:
mov    %edi,%eax
xor    %esi,%eax
and    %edx,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @md5_G(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = and i32 %7, %8
%10 = load i32, i32* %6
%11 = xor i32 %10, -1
%12 = load i32, i32* %5
%13 = and i32 %11, %12
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @md5_G(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, %0
%5 = xor i32 %2, -1
%6 = and i32 %5, %1
%7 = or i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ bson_fatal_msg(int, char *);
void bson_fatal(int ok) { bson_fatal_msg(ok, ""); }


x86 assembly (clang, -O0):
<bson_fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <bson_fatal_msg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bson_fatal>:
lea    0xee9(%rip),%rsi
jmp    1030 <bson_fatal_msg@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @bson_fatal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @bson_fatal_msg(i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @bson_fatal(i32 %0) {
%2 = tail call i32 @bson_fatal_msg(i32 %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *calloc(int, int);
void *KTRIE_MALLOC(int n) {
  void *p;
  p = calloc(1, n);
  return p;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @KTRIE_MALLOC(i32 %0) {
%2 = tail call i8* @calloc(i32 1, i32 %0)
ret i8* %2
}
char *skip_line(const char *s) {
  while (*s != '\0')
    s++;
  return (char *)s;
}


x86 assembly (clang, -O0):
<skip_line>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1129 <skip_line+0x29>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip_line+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @skip_line(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret i8* %3
}
unsigned random(void) {
  static unsigned x = 123456789;
  static unsigned y = 362436069;
  static unsigned z = 521288629;
  static unsigned w = 88675123;
  static unsigned t;
  t = x ^ (x << 11);
  x = y;
  y = z;
  z = w;
  w = w ^ (w >> 19) ^ (t ^ (t >> 8));
  return w;
}


x86 assembly (clang, -O0):
<random>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
mov    0x2f10(%rip),%ecx
shl    $0xb,%ecx
xor    %ecx,%eax
mov    %eax,0x2f19(%rip)
mov    0x2f03(%rip),%eax
mov    %eax,0x2ef9(%rip)
mov    0x2efb(%rip),%eax
mov    %eax,0x2ef1(%rip)
mov    0x2ef3(%rip),%eax
mov    %eax,0x2ee9(%rip)
mov    0x2ee7(%rip),%eax
mov    0x2ee1(%rip),%ecx
shr    $0x13,%ecx
xor    %ecx,%eax
mov    0x2ede(%rip),%ecx
mov    0x2ed8(%rip),%edx
shr    $0x8,%edx
xor    %edx,%ecx
xor    %ecx,%eax
mov    %eax,0x2ec3(%rip)
mov    0x2ebd(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<random>:
mov    0x2f1a(%rip),%ecx
mov    %ecx,%eax
shl    $0xb,%eax
xor    %ecx,%eax
mov    0x2f11(%rip),%ecx
mov    %ecx,0x2f07(%rip)
mov    0x2f09(%rip),%ecx
mov    %ecx,0x2eff(%rip)
mov    0x2f01(%rip),%ecx
mov    %ecx,0x2ef7(%rip)
mov    %eax,%edx
shr    $0x8,%edx
xor    %ecx,%eax
shr    $0x13,%ecx
xor    %edx,%eax
xor    %ecx,%eax
mov    %eax,0x2ee7(%rip)
ret

LLVM IR (-O0):
@random.x = internal global i32 123456789
@random.y = internal global i32 362436069
@random.z = internal global i32 521288629
@random.w = internal global i32 88675123
@random.t = internal global i32 0
define i32 @random() {
%1 = load i32, i32* @random.x
%2 = load i32, i32* @random.x
%3 = shl i32 %2, 11
%4 = xor i32 %1, %3
store i32 %4, i32* @random.t
%5 = load i32, i32* @random.y
store i32 %5, i32* @random.x
%6 = load i32, i32* @random.z
store i32 %6, i32* @random.y
%7 = load i32, i32* @random.w
store i32 %7, i32* @random.z
%8 = load i32, i32* @random.w
%9 = load i32, i32* @random.w
%10 = lshr i32 %9, 19
%11 = xor i32 %8, %10
%12 = load i32, i32* @random.t
%13 = load i32, i32* @random.t
%14 = lshr i32 %13, 8
%15 = xor i32 %12, %14
%16 = xor i32 %11, %15
store i32 %16, i32* @random.w
%17 = load i32, i32* @random.w
ret i32 %17
}

LLVM IR (-O2):
@random.x = internal unnamed_addr global i32 123456789
@random.y = internal unnamed_addr global i32 362436069
@random.z = internal unnamed_addr global i32 521288629
@random.w = internal unnamed_addr global i32 88675123
define i32 @random() {
%1 = load i32, i32* @random.x
%2 = shl i32 %1, 11
%3 = xor i32 %2, %1
%4 = load i32, i32* @random.y
store i32 %4, i32* @random.x
%5 = load i32, i32* @random.z
store i32 %5, i32* @random.y
%6 = load i32, i32* @random.w
store i32 %6, i32* @random.z
%7 = lshr i32 %6, 19
%8 = lshr i32 %3, 8
%9 = xor i32 %8, %3
%10 = xor i32 %9, %6
%11 = xor i32 %10, %7
store i32 %11, i32* @random.w
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *realloc(int /*<<< orphan*/, int);
void reallocPtrZero2() {
  char *r = realloc(0, 12);
  if (r)
    free(r);
}


x86 assembly (clang, -O0):
<reallocPtrZero2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
mov    $0xc,%esi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114c <reallocPtrZero2+0x2c>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocPtrZero2>:
push   %rax
xor    %edi,%edi
mov    $0xc,%esi
call   1040 <realloc@plt>
test   %rax,%rax
je     113b <reallocPtrZero2+0x1b>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>
pop    %rax
ret

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

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