xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ushort_put(unsigned short const, int /*<<< orphan*/ *);
void std_ushort_str(const void *restrict self, const char *restrict format,
                    FILE *restrict stream) {
  (void)format;
  if (self)
    ushort_put(*(const unsigned short *)self, stream);
}


x86 assembly (clang, -O0):
<std_ushort_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1142 <std_ushort_str+0x32>
mov    -0x8(%rbp),%rax
mov    (%rax),%ax
mov    -0x18(%rbp),%rsi
movzwl %ax,%edi
call   1030 <ushort_put@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_ushort_str>:
test   %rdi,%rdi
je     1120 <std_ushort_str+0x10>
movzwl (%rdi),%edi
mov    %rdx,%rsi
jmp    1030 <ushort_put@plt>
ret

LLVM IR (-O0):
define void @std_ushort_str(i8* noalias %0, i8* noalias %1, i32* noalias %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i16*
%13 = load i16, i16* %12
%14 = load i32*, i32** %6
%15 = call i32 @ushort_put(i16 zeroext %13, i32* %14)
br label %16
16: ; preds = %10, %3
ret void
}

LLVM IR (-O2):
define void @std_ushort_str(i8* noalias %0, i8* noalias nocapture readnone %1, i32* noalias %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = bitcast i8* %0 to i16*
%7 = load i16, i16* %6
%8 = tail call i32 @ushort_put(i16 zeroext %7, i32* %2)
br label %9
9: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;

/* Variables and functions */
int pthread_rwlockattr_setpshared(int /*<<< orphan*/ *, int);
int my_pthread_rwlockattr_setpshared(pthread_rwlockattr_t *__attr,
                                     int pshared) {
  pthread_rwlockattr_t *realattr =
      (pthread_rwlockattr_t *)*(unsigned int *)__attr;
  return pthread_rwlockattr_setpshared(realattr, pshared);
}


x86 assembly (clang, -O0):
<my_pthread_rwlockattr_setpshared>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <pthread_rwlockattr_setpshared@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @my_pthread_rwlockattr_setpshared(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* %6
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = load i32, i32* %4
%12 = call i32 @pthread_rwlockattr_setpshared(i32* %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @my_pthread_rwlockattr_setpshared(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @pthread_rwlockattr_setpshared(i32* %5, i32 %1)
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void ComparatorRefSet(uint32_t ui32Base, uint32_t ui32Ref) {
  ASSERT(ui32Base == 0x4003C000);
  (*((volatile uint32_t *)(ui32Base + 0x00000010))) = ui32Ref;
}


x86 assembly (clang, -O0):
<ComparatorRefSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x4003c000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x10,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorRefSet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x4003c000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    %ebx,0x10(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @ComparatorRefSet(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 = icmp eq i32 %5, 1073987584
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 16
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
store volatile i32 %9, i32* %13
ret void
}

LLVM IR (-O2):
define void @ComparatorRefSet(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1073987584
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 16
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store volatile i32 %1, i32* %8
ret void
}
unsigned setbits(unsigned x, int p, int n, int y) {
  return ((x & ~(~(~0 << n) << (p + 1 - n))) |
          ((y & ~(~0 << n)) << (p + 1 - n)));
}


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

x86 assembly (clang, -O2):
<setbits>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
mov    %eax,%edx
shl    %cl,%edx
not    %edx
and    %edi,%edx
and    %r8d,%eax
shl    %cl,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = shl i32 -1, %10
%12 = xor i32 %11, -1
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %7
%16 = sub nsw i32 %14, %15
%17 = shl i32 %12, %16
%18 = xor i32 %17, -1
%19 = and i32 %9, %18
%20 = load i32, i32* %8
%21 = load i32, i32* %7
%22 = shl i32 -1, %21
%23 = xor i32 %22, -1
%24 = and i32 %20, %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
%27 = load i32, i32* %7
%28 = sub nsw i32 %26, %27
%29 = shl i32 %24, %28
%30 = or i32 %19, %29
ret i32 %30
}

LLVM IR (-O2):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl nsw i32 -1, %2
%6 = xor i32 %5, -1
%7 = add nsw i32 %1, 1
%8 = sub i32 %7, %2
%9 = shl i32 %6, %8
%10 = xor i32 %9, -1
%11 = and i32 %10, %0
%12 = and i32 %6, %3
%13 = shl i32 %12, %8
%14 = or i32 %11, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void tgaFree(void *memory) { free(memory); }


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

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

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

LLVM IR (-O2):
define void @tgaFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int is_allocmap(const char *name, const char *type) {
  if ((*(unsigned long long *)name) != 0x0000000200000000ULL)
    return 0;
  if ((*(unsigned long long *)type) != 0xc1d3d3d6c3d4c1d7ULL)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_allocmap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movabs $0x200000000,%rcx
cmp    %rcx,(%rax)
je     112f <is_allocmap+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1159 <is_allocmap+0x59>
mov    -0x18(%rbp),%rax
movabs $0xc1d3d3d6c3d4c1d7,%rcx
d3 d3 c1
cmp    %rcx,(%rax)
je     1152 <is_allocmap+0x52>
movl   $0x0,-0x4(%rbp)
jmp    1159 <is_allocmap+0x59>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_allocmap>:
xor    %eax,%eax
movabs $0x200000000,%rcx
cmp    %rcx,(%rdi)
jne    1123 <is_allocmap+0x23>
movabs $0xc1d3d3d6c3d4c1d7,%rcx
d3 d3 c1
xor    %eax,%eax
cmp    %rcx,(%rsi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_allocmap(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 8589934592
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = bitcast i8* %1 to i64*
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, -4480004284941549097
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %6, %2
%12 = phi i32 [ 0, %2 ], [ %10, %6 ]
ret i32 %12
}
/* Type definitions */
typedef char *u_short;

/* Variables and functions */
u_short _go32_my_ds() { asm("movw %ds,%ax"); }


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

x86 assembly (clang, -O2):
<_go32_my_ds>:
mov    %ds,%ax
ret

LLVM IR (-O0):
define i8* @_go32_my_ds() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define i8* @_go32_my_ds() {
tail call void asm sideeffect "movw %ds,%ax", "~{dirflag},~{fpsr},~{flags}"()
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void recurse(int count) {
  printf("%d\n", count);
  if (count != 1000)
    recurse(count + 1);
}


x86 assembly (clang, -O0):
<recurse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x3e8,-0x4(%rbp)
je     1152 <recurse+0x32>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <recurse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recurse>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1120 <recurse+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @recurse(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 1000
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
br label %10
10: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @recurse(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp eq i32 %3, 1000
%6 = add nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret void
}
void __libc_csu_init(void) {}


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

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

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

LLVM IR (-O2):
define void @__libc_csu_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void usage_error(char *message, char *argument) {
  fputs("pfind: ", stderr);
  fprintf(stderr, message, argument);
  fputs("\n", stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<usage_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xeb0(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <fprintf@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
lea    0xe8d(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage_error>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e9e(%rip),%r15
mov    (%r15),%esi
lea    0xeb4(%rip),%rdi
call   1030 <fputs@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    (%r15),%esi
lea    0xe9f(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"pfind: \00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @usage_error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32 %7, i8* %8, i8* %9)
%11 = load i32, i32* @stderr
%12 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"pfind: \00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @usage_error(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* %0, i8* %1)
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @exit(i32 1)
unreachable
}
int consoleStrHeight(char *str) {
  int height = 1;
  for (; *str; str++)
    if (*str == '\n')
      height++;
  return height;
}


x86 assembly (clang, -O0):
<consoleStrHeight>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <consoleStrHeight+0x4b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1135 <consoleStrHeight+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <consoleStrHeight+0x3a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <consoleStrHeight+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<consoleStrHeight>:
mov    $0x1,%eax
jmp    1117 <consoleStrHeight+0x17>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0xa,%cl
je     1110 <consoleStrHeight+0x10>
test   %cl,%cl
jne    1113 <consoleStrHeight+0x13>
ret

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

LLVM IR (-O2):
define i32 @consoleStrHeight(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i32 [ 1, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 10, label %6
]
6: ; preds = %2
%7 = add nsw i32 %4, 1
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
void close_socket(int sockfd) {
  if (sockfd > 0) {
    shutdown(sockfd, SHUT_RDWR);
    close(sockfd);
  }
}


x86 assembly (clang, -O0):
<close_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    114e <close_socket+0x2e>
mov    -0x4(%rbp),%edi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_socket>:
test   %edi,%edi
jle    113d <close_socket+0x1d>
push   %rbx
mov    %edi,%ebx
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>
ret

LLVM IR (-O0):
@SHUT_RDWR = global i32 0
define void @close_socket(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = load i32, i32* @SHUT_RDWR
%8 = call i32 @shutdown(i32 %6, i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @close(i32 %9)
br label %11
11: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@SHUT_RDWR = global i32 0
define void @close_socket(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = load i32, i32* @SHUT_RDWR
%5 = tail call i32 @shutdown(i32 %0, i32 %4)
%6 = tail call i32 @close(i32 %0)
br label %7
7: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ NDFC_WRITE_REG_ST(int);
void NFC_RbIntClearStatus(void) { NDFC_WRITE_REG_ST((1 << 0)); }


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

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

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

LLVM IR (-O2):
define void @NFC_RbIntClearStatus() {
%1 = tail call i32 @NDFC_WRITE_REG_ST(i32 1)
ret void
}
int main() {
  int i = 0;
  for (i = 0; i < 10; i++) {
  }
  if (i != 0) {
    goto ERROR;
  }
  return 0;
ERROR:
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1136 <main+0x36>
jmp    1128 <main+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
cmpl   $0x0,-0x8(%rbp)
je     1145 <main+0x45>
jmp    1151 <main+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1158 <main+0x58>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 -1
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOTSUP;
int /*<<< orphan*/ errno;
pid_t _vfork(void) {
  errno = ENOTSUP;
  return -1;
}


x86 assembly (clang, -O0):
<_vfork>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec4(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vfork>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @_vfork() {
%1 = load i32, i32* @ENOTSUP
store i32 %1, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @_vfork() {
%1 = load i32, i32* @ENOTSUP
store i32 %1, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("usage:\n"
         "    -v, --verbose\n"
         "        enable verbose output.\n"
         "    -h, --help\n"
         "        print this help and quit.\n"
         "    -u, --use-ufs\n"
         "        perform benchmark on the underlying file system\n"
         "    -f, --input-file\n"
         "        input file name.\n"
         "    -o, --input-file\n"
         "        output file name.\n");
}


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

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

LLVM IR (-O0):
@.str = [273 x i8] c"usage:\0A -v, --verbose\0A enable verbose output.\0A -h, --help\0A print this help and quit.\0A -u, --use-ufs\0A perform benchmark on the underlying file system\0A -f, --input-file\0A input file name.\0A -o, --input-file\0A output file name.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([273 x i8], [273 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [272 x i8] c"usage:\0A -v, --verbose\0A enable verbose output.\0A -h, --help\0A print this help and quit.\0A -u, --use-ufs\0A perform benchmark on the underlying file system\0A -f, --input-file\0A input file name.\0A -o, --input-file\0A output file name.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([272 x i8], [272 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int /*<<< orphan*/ foo(int);
int /*<<< orphan*/ h(int);
int /*<<< orphan*/ h2(int);
void main(int i) {
  f(2);
  h(2);
  h2(2);
  foo(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <f@plt>
mov    $0x2,%edi
call   1030 <h@plt>
mov    $0x2,%edi
call   1050 <h2@plt>
mov    $0x1,%edi
call   1060 <foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1040 <f@plt>
mov    $0x2,%edi
call   1030 <h@plt>
mov    $0x2,%edi
call   1050 <h2@plt>
mov    $0x1,%edi
pop    %rax
jmp    1060 <foo@plt>

LLVM IR (-O0):
define void @main(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @f(i32 2)
%4 = call i32 @h(i32 2)
%5 = call i32 @h2(i32 2)
%6 = call i32 @foo(i32 1)
ret void
}

LLVM IR (-O2):
define void @main(i32 %0) {
%2 = tail call i32 @f(i32 2)
%3 = tail call i32 @h(i32 2)
%4 = tail call i32 @h2(i32 2)
%5 = tail call i32 @foo(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  while (1) {
    printf("helloworld");
    for (int i = 0; i < 30000; i++) {
      for (int j = 0; j < 1000; j++)
        ;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7530,-0x8(%rbp)
jge    1179 <main+0x69>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1166 <main+0x56>
jmp    1158 <main+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x36>
jmp    116b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <main+0x22>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [11 x i8] c"helloworld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %21
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %6
6: ; preds = %18, %4
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 30000
br i1 %8, label %9, label %21
9: ; preds = %6
store i32 0, i32* %3
br label %10
10: ; preds = %14, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 1000
br i1 %12, label %13, label %17
13: ; preds = %10
br label %14
14: ; preds = %13
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %10
17: ; preds = %10
br label %18
18: ; preds = %17
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %6
21: ; preds = %6
br label %4
}

LLVM IR (-O2):
@.str = [11 x i8] c"helloworld\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ __emit_string_literal_range(char *, int, int, int);
void test_concatenated_string_literal(void) {
  __emit_string_literal_range("01234"
                              "56789",
                              4, 3, 6);
}


x86 assembly (clang, -O0):
<test_concatenated_string_literal>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    $0x6,%ecx
call   1030 <__emit_string_literal_range@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_concatenated_string_literal>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
mov    $0x3,%edx
mov    $0x6,%ecx
jmp    1030 <__emit_string_literal_range@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"0123456789\00"
define void @test_concatenated_string_literal() {
%1 = call i32 @__emit_string_literal_range(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 4, i32 3, i32 6)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"0123456789\00"
define void @test_concatenated_string_literal() {
%1 = tail call i32 @__emit_string_literal_range(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 4, i32 3, i32 6)
ret void
}
void mdp4_dtv_overlay_blt_stop(struct msm_fb_data_type *mfd) { return; }


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

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

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

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
define void @mdp4_dtv_overlay_blt_stop(%struct.msm_fb_data_type* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void be32enc(void *buf, uint32_t x) {
  uint8_t *b = (uint8_t *)buf;
  b[0] = (x >> 24) & 0xff;
  b[1] = (x >> 16) & 0xff;
  b[2] = (x >> 8) & 0xff;
  b[3] = x & 0xff;
}


x86 assembly (clang, -O0):
<be32enc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<be32enc>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x4(%rdi)
mov    %edx,0x8(%rdi)
mov    %esi,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @be32enc(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = lshr i32 %1, 24
store i32 %4, i32* %3
%5 = lshr i32 %1, 16
%6 = and i32 %5, 255
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
%9 = lshr i32 %1, 8
%10 = and i32 %9, 255
%11 = getelementptr inbounds i8, i8* %0, i64 8
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
%13 = and i32 %1, 255
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
ret void
}
int fun228() { return 228; }


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

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

LLVM IR (-O0):
define i32 @fun228() {
ret i32 228
}

LLVM IR (-O2):
define i32 @fun228() {
ret i32 228
}
/* Variables and functions */
int strcmp(char const *, char const *);
int qsort_cmp(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
}


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

x86 assembly (clang, -O2):
<qsort_cmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @qsort_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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @qsort_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int fcntl(int, int /*<<< orphan*/, int);
int set_nonblocking(int fd) {
  int flags;
  if (-1 == (flags = fcntl(fd, F_GETFL, 0)))
    flags = 0;
  return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
}


x86 assembly (clang, -O0):
<set_nonblocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1147 <set_nonblocking+0x37>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    0x2e8b(%rip),%rax
or     (%rax),%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_nonblocking>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
xor    %ebp,%ebp
xor    %edx,%edx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
cmovne %eax,%ebp
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
or     (%rax),%ebp
mov    %ebx,%edi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @set_nonblocking(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @F_GETFL
%6 = call i32 @fcntl(i32 %4, i32 %5, i32 0)
store i32 %6, i32* %3
%7 = icmp eq i32 -1, %6
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %3
br label %9
9: ; preds = %8, %1
%10 = load i32, i32* %2
%11 = load i32, i32* @F_SETFL
%12 = load i32, i32* %3
%13 = load i32, i32* @O_NONBLOCK
%14 = or i32 %12, %13
%15 = call i32 @fcntl(i32 %10, i32 %11, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
@F_GETFL = global i32 0
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
define i32 @set_nonblocking(i32 %0) {
%2 = load i32, i32* @F_GETFL
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
%5 = select i1 %4, i32 0, i32 %3
%6 = load i32, i32* @F_SETFL
%7 = load i32, i32* @O_NONBLOCK
%8 = or i32 %5, %7
%9 = tail call i32 @fcntl(i32 %0, i32 %6, i32 %8)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ _Mem_Free(void *, int, int /*<<< orphan*/, char const *,
                             int);
void CL_CinModule_MemFree(void *data, const char *filename, int fileline) {
  _Mem_Free(data, 128, 0, filename, fileline);
}


x86 assembly (clang, -O0):
<CL_CinModule_MemFree>:
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),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x80,%esi
xor    %edx,%edx
call   1030 <_Mem_Free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_CinModule_MemFree>:
mov    %edx,%r8d
mov    %rsi,%rcx
mov    $0x80,%esi
xor    %edx,%edx
jmp    1030 <_Mem_Free@plt>

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

LLVM IR (-O2):
define void @CL_CinModule_MemFree(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_Mem_Free(i8* %0, i32 128, i32 0, i8* %1, i32 %2)
ret void
}
int do_668() { return 668; }


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

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

LLVM IR (-O0):
define i32 @do_668() {
ret i32 668
}

LLVM IR (-O2):
define i32 @do_668() {
ret i32 668
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
__volatile void quit(void) {
  refresh();
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <refresh@plt>
mov    $0x0,%al
call   1040 <endwin@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
xor    %eax,%eax
call   1030 <refresh@plt>
xor    %eax,%eax
call   1040 <endwin@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @quit() {
%1 = call i32 (...) @refresh()
%2 = call i32 (...) @endwin()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @quit() {
%1 = tail call i32 (...) @refresh()
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_EDuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xED << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_EDuint64_lowword_reg>:
test   $0xed,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EDuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 237
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void libev_system_deinit(void *ctx) { free(ctx); }


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

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

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

LLVM IR (-O2):
define void @libev_system_deinit(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};
struct FTW {
  int dummy;
};

/* Variables and functions */
int remove(char const *);
int unlink_cb(const char *fpath, const struct stat *sb, int typeflag,
              struct FTW *ftwbuf) {
  return remove(fpath);
}


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

x86 assembly (clang, -O2):
<unlink_cb>:
jmp    1030 <remove@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.FTW = type { i32 }
define i32 @unlink_cb(i8* %0, %struct.stat* %1, i32 %2, %struct.FTW* %3) {
%5 = alloca i8*
%6 = alloca %struct.stat*
%7 = alloca i32
%8 = alloca %struct.FTW*
store i8* %0, i8** %5
store %struct.stat* %1, %struct.stat** %6
store i32 %2, i32* %7
store %struct.FTW* %3, %struct.FTW** %8
%9 = load i8*, i8** %5
%10 = call i32 @remove(i8* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.FTW = type { i32 }
define i32 @unlink_cb(i8* nocapture %0, %struct.stat* nocapture readnone %1, i32 %2, %struct.FTW* nocapture readnone %3) {
%5 = tail call i32 @remove(i8* %0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int strcmp(char *, char *);
int weird_strcmp(char *a, char *b) {
  int val = strcmp(a, b);
  free(a);
  return val;
}


x86 assembly (clang, -O0):
<weird_strcmp>:
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   1040 <strcmp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weird_strcmp>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strcmp@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @weird_strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = tail call i32 @free(i8* %0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ command;

/* Variables and functions */
int /*<<< orphan*/ matrix_write(unsigned char *, int);
void matrix_setbrightness(unsigned int brightness) {
  unsigned char command[] = {'F', 'W', 'C', (2 << 5) | 1, brightness};
  matrix_write(command, sizeof(command));
}


x86 assembly (clang, -O0):
<matrix_setbrightness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x46,-0x9(%rbp)
movb   $0x57,-0x8(%rbp)
movb   $0x43,-0x7(%rbp)
movb   $0x41,-0x6(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
lea    -0x9(%rbp),%rdi
mov    $0x5,%esi
call   1030 <matrix_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_setbrightness>:
push   %rax
movl   $0x41435746,0x3(%rsp)
41
mov    %dil,0x7(%rsp)
lea    0x3(%rsp),%rdi
mov    $0x5,%esi
call   1030 <matrix_write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @matrix_setbrightness(i32 %0) {
%2 = alloca i32
%3 = alloca [5 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
store i8 70, i8* %4
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 87, i8* %5
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 67, i8* %6
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8 65, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i32, i32* %2
%10 = trunc i32 %9 to i8
store i8 %10, i8* %8
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = call i32 @matrix_write(i8* %11, i32 5)
ret void
}

LLVM IR (-O2):
define void @matrix_setbrightness(i32 %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
store i8 70, i8* %3
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
store i8 87, i8* %4
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
store i8 67, i8* %5
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
store i8 65, i8* %6
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%8 = trunc i32 %0 to i8
store i8 %8, i8* %7
%9 = call i32 @matrix_write(i8* %3, i32 5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
void *mmap(void *, size_t, int, int, int, int /*<<< orphan*/);
__attribute__((weak)) void *__real_mmap(void *addr, size_t len, int prot,
                                        int flags, int fd, off_t off) {
  return mmap(addr, len, prot, flags, fd, off);
}


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

x86 assembly (clang, -O2):
<__real_mmap>:
jmp    1030 <mmap@plt>

LLVM IR (-O0):
define weak i8* @__real_mmap(i8* %0, i64 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %7
store i64 %1, i64* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i8*, i8** %7
%14 = load i64, i64* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = call i8* @mmap(i8* %13, i64 %14, i32 %15, i32 %16, i32 %17, i32 %18)
ret i8* %19
}

LLVM IR (-O2):
define weak i8* @__real_mmap(i8* %0, i64 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i8* @mmap(i8* %0, i64 %1, i32 %2, i32 %3, i32 %4, i32 %5)
ret i8* %7
}
/* Variables and functions */
int get_stuff();
int main(int argc, char **argv) { return get_stuff(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <get_stuff@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @get_stuff()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @get_stuff()
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ GCSTelemetryStatsHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void GCSTelemetryStatsRequestUpdate() {
  UAVObjRequestUpdate(GCSTelemetryStatsHandle());
}


x86 assembly (clang, -O0):
<GCSTelemetryStatsRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <GCSTelemetryStatsHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GCSTelemetryStatsRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1040 <GCSTelemetryStatsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @GCSTelemetryStatsRequestUpdate() {
%1 = call i32 (...) @GCSTelemetryStatsHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @GCSTelemetryStatsRequestUpdate() {
%1 = tail call i32 (...) @GCSTelemetryStatsHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ endwin();
void shutdown_curses(void) {
  clear();
  endwin();
}


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

x86 assembly (clang, -O2):
<shutdown_curses>:
push   %rax
xor    %eax,%eax
call   1040 <clear@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <endwin@plt>

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

LLVM IR (-O2):
define void @shutdown_curses() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 (...) @endwin()
ret void
}
int exists_tcompressed_word() { return -1; }


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

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

LLVM IR (-O0):
define i32 @exists_tcompressed_word() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @exists_tcompressed_word() {
ret i32 -1
}
/* Type definitions */
struct struct_dll2 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct struct_dll2 *);
int /*<<< orphan*/ printf(char *);
void free_struct_dll2(struct struct_dll2 *s) {
  printf("free_struct_dll2\n");
  free(s);
}


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

x86 assembly (clang, -O2):
<free_struct_dll2>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.struct_dll2 = type { i32 }
@.str = [18 x i8] c"free_struct_dll2\0A\00"
define void @free_struct_dll2(%struct.struct_dll2* %0) {
%2 = alloca %struct.struct_dll2*
store %struct.struct_dll2* %0, %struct.struct_dll2** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.struct_dll2*, %struct.struct_dll2** %2
%5 = call i32 @free(%struct.struct_dll2* %4)
ret void
}

LLVM IR (-O2):
%struct.struct_dll2 = type { i32 }
@str = [17 x i8] c"free_struct_dll2\00"
define void @free_struct_dll2(%struct.struct_dll2* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @free(%struct.struct_dll2* %0)
ret void
}