xunge/DecIR huggingface dataset:
/* Variables and functions */
int __ocml_isfinite_f64(double);
int __finite(double x) { return __ocml_isfinite_f64(x); }


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

x86 assembly (clang, -O2):
<__finite>:
jmp    1030 <__ocml_isfinite_f64@plt>

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

LLVM IR (-O2):
define i32 @__finite(double %0) {
%2 = tail call i32 @__ocml_isfinite_f64(double %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void quit(int err, char *fmt, char *str) {
  printf(fmt, str);
  exit(err);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @quit(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i32 @printf(i8* %7, i8* %8)
%10 = load i32, i32* %4
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
define void @quit(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @printf(i8* %1, i8* %2)
%5 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
struct tlbe {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tlb_mask_offset(struct tlbe *);
uint64_t tlb_mask_rpn(struct tlbe *t) { return ~(tlb_mask_offset(t)); }


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

x86 assembly (clang, -O2):
<tlb_mask_rpn>:
push   %rax
call   1030 <tlb_mask_offset@plt>
not    %eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tlbe = type { i32 }
define i32 @tlb_mask_rpn(%struct.tlbe* %0) {
%2 = alloca %struct.tlbe*
store %struct.tlbe* %0, %struct.tlbe** %2
%3 = load %struct.tlbe*, %struct.tlbe** %2
%4 = call i32 @tlb_mask_offset(%struct.tlbe* %3)
%5 = xor i32 %4, -1
ret i32 %5
}

LLVM IR (-O2):
%struct.tlbe = type { i32 }
define i32 @tlb_mask_rpn(%struct.tlbe* %0) {
%2 = tail call i32 @tlb_mask_offset(%struct.tlbe* %0)
%3 = xor i32 %2, -1
ret i32 %3
}
void teardown_clock(void) {}


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

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

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

LLVM IR (-O2):
define void @teardown_clock() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int i;
  int RO = 5;
  printf("%d,%d\n", RO, RO);
  char *s = "This is a valid char	\n string \102 \134 \' \bm\vn";
  printf("%s", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
lea    0xed0(%rip),%rsi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%d,%d\0A\00"
@.str.1 = [41 x i8] c"This is a valid char\09\0A string B \\ ' \08m\0Bn\00"
@.str.2 = [3 x i8] c"%s\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 5, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8** %3
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d,%d\0A\00"
@.str.1 = [41 x i8] c"This is a valid char\09\0A string B \\ ' \08m\0Bn\00"
@.str.2 = [3 x i8] c"%s\00"
define void @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 5, i32 5)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int get_nchan_from_depth(int depth) {
  int i = 1;
  return i << depth;
}


x86 assembly (clang, -O0):
<get_nchan_from_depth>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nchan_from_depth>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @get_nchan_from_depth(i32 %0) {
%2 = shl nuw i32 1, %0
ret i32 %2
}
/* Type definitions */
struct ooc_vm_area {
  int dummy;
};
struct block {
  int dummy;
};

/* Variables and functions */
struct block *S_vma_2block(struct ooc_vm_area *const vma) {
  return (struct block *)((uintptr_t)vma & (~(uintptr_t)(4096 - 1)));
}


x86 assembly (clang, -O0):
<S_vma_2block>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffffff000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<S_vma_2block>:
mov    %rdi,%rax
and    $0xfffffffffffff000,%rax
ret

LLVM IR (-O0):
%struct.block = type { i32 }
%struct.ooc_vm_area = type { i32 }
define %struct.block* @S_vma_2block(%struct.ooc_vm_area* %0) {
%2 = alloca %struct.ooc_vm_area*
store %struct.ooc_vm_area* %0, %struct.ooc_vm_area** %2
%3 = load %struct.ooc_vm_area*, %struct.ooc_vm_area** %2
%4 = ptrtoint %struct.ooc_vm_area* %3 to i64
%5 = and i64 %4, -4096
%6 = inttoptr i64 %5 to %struct.block*
ret %struct.block* %6
}

LLVM IR (-O2):
%struct.block = type { i32 }
%struct.ooc_vm_area = type { i32 }
define %struct.block* @S_vma_2block(%struct.ooc_vm_area* %0) {
%2 = ptrtoint %struct.ooc_vm_area* %0 to i64
%3 = and i64 %2, -4096
%4 = inttoptr i64 %3 to %struct.block*
ret %struct.block* %4
}
int security_socket_listen(struct socket *sock, int backlog) { return 0; }


x86 assembly (clang, -O0):
<security_socket_listen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.socket = type opaque
define i32 @security_socket_listen(%struct.socket* %0, i32 %1) {
%3 = alloca %struct.socket*
%4 = alloca i32
store %struct.socket* %0, %struct.socket** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.socket = type opaque
define i32 @security_socket_listen(%struct.socket* nocapture readnone %0, i32 %1) {
ret i32 0
}
void outpw(unsigned short port, unsigned short value) {
  asm volatile("outw %%ax,%%dx" : : "dN"(port), "a"(value));
}


x86 assembly (clang, -O0):
<outpw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x4(%rbp),%ax
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outpw>:
mov    %esi,%eax
mov    %edi,%edx
out    %ax,(%dx)
ret

LLVM IR (-O0):
define void @outpw(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @outpw(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw %ax,%dx", "{dx}N,{ax},~{dirflag},~{fpsr},~{flags}"(i16 %0, i16 %1)
ret void
}
/* Type definitions */
struct out {
  int dummy;
};
struct node {
  int dummy;
};
struct module {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print_block(struct out *, struct module const *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ subs_first_const(struct node const *);
void print_post(struct out *out, const struct module *mod,
                const struct node *node) {
  print_block(out, mod, subs_first_const(node));
}


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

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

LLVM IR (-O0):
%struct.out = type { i32 }
%struct.module = type { i32 }
%struct.node = type { i32 }
define void @print_post(%struct.out* %0, %struct.module* %1, %struct.node* %2) {
%4 = alloca %struct.out*
%5 = alloca %struct.module*
%6 = alloca %struct.node*
store %struct.out* %0, %struct.out** %4
store %struct.module* %1, %struct.module** %5
store %struct.node* %2, %struct.node** %6
%7 = load %struct.out*, %struct.out** %4
%8 = load %struct.module*, %struct.module** %5
%9 = load %struct.node*, %struct.node** %6
%10 = call i32 @subs_first_const(%struct.node* %9)
%11 = call i32 @print_block(%struct.out* %7, %struct.module* %8, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.out = type { i32 }
%struct.module = type { i32 }
%struct.node = type { i32 }
define void @print_post(%struct.out* %0, %struct.module* %1, %struct.node* %2) {
%4 = tail call i32 @subs_first_const(%struct.node* %2)
%5 = tail call i32 @print_block(%struct.out* %0, %struct.module* %1, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usage(void) {
  fprintf(
      stderr,
      "Usage: gpio-hammer [options]...\n"
      "Hammer GPIO lines, 0->1->0->1...\n"
      "  -n <name>  Hammer GPIOs on a named device (must be stated)\n"
      "  -o <n>     Offset[s] to hammer, at least one, several can be stated\n"
      " [-c <n>]    Do <n> loops (optional, infinite loop if not stated)\n"
      "  -?         This helptext\n"
      "\n"
      "Example:\n"
      "gpio-hammer -n gpiochip0 -o 4\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [330 x i8] c"Usage: gpio-hammer [options]...\0AHammer GPIO lines, 0->1->0->1...\0A -n <name> Hammer GPIOs on a named device (must be stated)\0A -o <n> Offset[s] to hammer, at least one, several can be stated\0A [-c <n>] Do <n> loops (optional, infinite loop if not stated)\0A -? This helptext\0A\0AExample:\0Agpio-hammer -n gpiochip0 -o 4\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([330 x i8], [330 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [330 x i8] c"Usage: gpio-hammer [options]...\0AHammer GPIO lines, 0->1->0->1...\0A -n <name> Hammer GPIOs on a named device (must be stated)\0A -o <n> Offset[s] to hammer, at least one, several can be stated\0A [-c <n>] Do <n> loops (optional, infinite loop if not stated)\0A -? This helptext\0A\0AExample:\0Agpio-hammer -n gpiochip0 -o 4\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([330 x i8], [330 x i8]* @.str, i64 0, i64 0))
ret void
}
int wps_validate_m7(const struct wpabuf *tlvs) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.wpabuf = type opaque
define i32 @wps_validate_m7(%struct.wpabuf* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void AESKey3Set(uint32_t ui32Base, uint32_t *pui32Key) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) = pui32Key[0];
  (*((volatile uint32_t *)(ui32Base + 0x0000000C))) = pui32Key[1];
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) = pui32Key[2];
  (*((volatile uint32_t *)(ui32Base + 0x00000004))) = pui32Key[3];
}


x86 assembly (clang, -O0):
<AESKey3Set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0xc(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<AESKey3Set>:
mov    (%rsi),%rax
mov    %rax,0x8(%rdi)
mov    0x8(%rsi),%rax
mov    %rax,0xc(%rdi)
mov    0x10(%rsi),%rax
mov    %rax,(%rdi)
mov    0x18(%rsi),%rax
mov    %rax,0x4(%rdi)
ret

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

LLVM IR (-O2):
define void @AESKey3Set(i64 %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = add nsw i64 %0, 8
%5 = inttoptr i64 %4 to i64*
store volatile i64 %3, i64* %5
%6 = getelementptr inbounds i64, i64* %1, i64 1
%7 = load i64, i64* %6
%8 = add nsw i64 %0, 12
%9 = inttoptr i64 %8 to i64*
store volatile i64 %7, i64* %9
%10 = getelementptr inbounds i64, i64* %1, i64 2
%11 = load i64, i64* %10
%12 = inttoptr i64 %0 to i64*
store volatile i64 %11, i64* %12
%13 = getelementptr inbounds i64, i64* %1, i64 3
%14 = load i64, i64* %13
%15 = add nsw i64 %0, 4
%16 = inttoptr i64 %15 to i64*
store volatile i64 %14, i64* %16
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(int);
int /*<<< orphan*/ stderr;
void *Malloc(int size) {
  void *chunk;
  chunk = malloc(size);
  if (chunk == NULL)
    fprintf(stderr, "Red Alert: Insufficient Memory!\n");
  return chunk;
}


x86 assembly (clang, -O0):
<Malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1157 <Malloc+0x37>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Malloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <Malloc+0x23>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Red Alert: Insufficient Memory!\0A\00"
define i8* @Malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Red Alert: Insufficient Memory!\0A\00"
define noalias i8* @Malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %4, %1
ret i8* %2
}
void users_open_devices(void) {}


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

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

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

LLVM IR (-O2):
define void @users_open_devices() {
ret void
}
int getNum() {
  const int x = 1;
  int y;
  y = 0;
  while (y < 1000) {
    if (y < 100)
      y = y + 1;
    else
      y = y + 2;
  }
  return (y);
}


x86 assembly (clang, -O0):
<getNum>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1145 <getNum+0x45>
cmpl   $0x64,-0x8(%rbp)
jge    1137 <getNum+0x37>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1140 <getNum+0x40>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <getNum+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNum>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x64,%eax
sbb    $0x0,%eax
add    $0x2,%eax
cmp    $0x3e8,%eax
jb     1110 <getNum+0x10>
ret

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

LLVM IR (-O2):
define i32 @getNum() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = icmp ult i32 %2, 100
%4 = select i1 %3, i32 1, i32 2
%5 = add nuw nsw i32 %4, %2
%6 = icmp ult i32 %5, 1000
br i1 %6, label %1, label %7
7: ; preds = %1
ret i32 %5
}
/* Variables and functions */
int socket(int, int, int);
int /*<<< orphan*/ unix_error(char *);
int Socket(int family, int type, int protocol) {
  int rc;
  if ((rc = socket(family, type, protocol)) < 0)
    unix_error("Socket error");
  return rc;
}


x86 assembly (clang, -O0):
<Socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <socket@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    1157 <Socket+0x37>
lea    0xeae(%rip),%rdi
call   1030 <unix_error@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Socket>:
push   %rbx
call   1040 <socket@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Socket+0x18>
lea    0xecd(%rip),%rdi
call   1030 <unix_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"Socket error\00"
define i32 @Socket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @unix_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
float ClampAxis(float);
float NormalizeAxis(float ang) {
  ang = ClampAxis(ang);
  if (ang > 180.f) {
    ang -= 360.f;
  }
  return ang;
}


x86 assembly (clang, -O0):
<NormalizeAxis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <ClampAxis@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xec7(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1158 <NormalizeAxis+0x48>
movss  -0x4(%rbp),%xmm0
movss  0xeb5(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NormalizeAxis>:
push   %rax
call   1030 <ClampAxis@plt>
movss  0xee2(%rip),%xmm2
addss  %xmm0,%xmm2
movss  0xeda(%rip),%xmm1
cmpltss %xmm0,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @NormalizeAxis(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @ClampAxis(float %3)
store float %4, float* %2
%5 = load float, float* %2
%6 = fcmp ogt float %5, 1.800000e+02
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load float, float* %2
%9 = fsub float %8, 3.600000e+02
store float %9, float* %2
br label %10
10: ; preds = %7, %1
%11 = load float, float* %2
ret float %11
}

LLVM IR (-O2):
define float @NormalizeAxis(float %0) {
%2 = tail call float @ClampAxis(float %0)
%3 = fcmp ogt float %2, 1.800000e+02
%4 = fadd float %2, -3.600000e+02
%5 = select i1 %3, float %4, float %2
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ wait1Msec(int);
void pause() { wait1Msec(100); }


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

x86 assembly (clang, -O2):
<pause>:
mov    $0x64,%edi
jmp    1030 <wait1Msec@plt>

LLVM IR (-O0):
define void @pause() {
%1 = call i32 @wait1Msec(i32 100)
ret void
}

LLVM IR (-O2):
define void @pause() {
%1 = tail call i32 @wait1Msec(i32 100)
ret void
}
int test_imm_37int16_reg(short val) {
  return ((val) & (-0x37 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_37int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffffc9,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_37int16_reg>:
test   $0xffc9,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_37int16_reg(i16 signext %0) {
%2 = and i16 %0, -55
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void fast_log_ostor_dump(struct fast_log_entry *fe __attribute__((unused)),
                         char *buf __attribute__((unused))) {}


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

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

LLVM IR (-O0):
%struct.fast_log_entry = type opaque
define void @fast_log_ostor_dump(%struct.fast_log_entry* %0, i8* %1) {
%3 = alloca %struct.fast_log_entry*
%4 = alloca i8*
store %struct.fast_log_entry* %0, %struct.fast_log_entry** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
%struct.fast_log_entry = type opaque
define void @fast_log_ostor_dump(%struct.fast_log_entry* nocapture %0, i8* nocapture %1) {
ret void
}
unsigned xrop3_229_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = S & T;
  stk2 = D | stk3;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_229_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_229_0_0>:
shl    $0x8,%edi
mov    %esi,%eax
shl    $0x8,%eax
lea    (%rsi,%rax,1),%ecx
and    %edi,%eax
or     $0xff,%eax
xor    %ecx,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @xrop3_229_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = and i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %5
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = xor i32 %32, -1
store i32 %33, i32* %8
%34 = load i32, i32* %8
ret i32 %34
}

LLVM IR (-O2):
define i32 @xrop3_229_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %6, %5
%8 = and i32 %6, %4
%9 = or i32 %8, 255
%10 = xor i32 %7, %9
%11 = xor i32 %10, -1
ret i32 %11
}
int C_Utils_compare_sbyte(const signed char item1, const signed char item2) {
  if (item1 == item2)
    return 0;
  return item1 < item2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<C_Utils_compare_sbyte>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    112c <C_Utils_compare_sbyte+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1146 <C_Utils_compare_sbyte+0x46>
movsbl -0x5(%rbp),%edx
movsbl -0x6(%rbp),%esi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_Utils_compare_sbyte>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %sil,%dil
setge  %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @C_Utils_compare_sbyte(i8 signext %0, i8 signext %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 = sext i8 %6 to i32
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %20
12: ; preds = %2
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = icmp slt i32 %14, %16
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 -1, i32 1
store i32 %19, i32* %3
br label %20
20: ; preds = %12, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @C_Utils_compare_sbyte(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %0, %1
%4 = icmp slt i8 %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
int SIGPIPE;
int /*<<< orphan*/ writeLog(int, char *);
void death_handler(int signum) {
  if (signum == SIGPIPE) {
    writeLog(1, "Pipe broken signal received");
  }
  writeLog(1, "Server unexpectedly disconnected! Trying to reconnect...");
}


x86 assembly (clang, -O0):
<death_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ebb(%rip),%rcx
cmp    (%rcx),%eax
jne    113e <death_handler+0x2e>
mov    $0x1,%edi
lea    0xec7(%rip),%rsi
call   1030 <writeLog@plt>
mov    $0x1,%edi
lea    0xed2(%rip),%rsi
call   1030 <writeLog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<death_handler>:
push   %rax
mov    0x2ec8(%rip),%rax
cmp    %edi,(%rax)
jne    112d <death_handler+0x1d>
lea    0xedd(%rip),%rsi
mov    $0x1,%edi
call   1030 <writeLog@plt>
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
pop    %rax
jmp    1030 <writeLog@plt>

LLVM IR (-O0):
@SIGPIPE = global i32 0
@.str = [28 x i8] c"Pipe broken signal received\00"
@.str.1 = [57 x i8] c"Server unexpectedly disconnected! Trying to reconnect...\00"
define void @death_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGPIPE
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @writeLog(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = call i32 @writeLog(i32 1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@.str = [28 x i8] c"Pipe broken signal received\00"
@.str.1 = [57 x i8] c"Server unexpectedly disconnected! Trying to reconnect...\00"
define void @death_handler(i32 %0) {
%2 = load i32, i32* @SIGPIPE
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @writeLog(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @writeLog(i32 1, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_grid_area(int const *, int const *, double const *,
                                 double const *, double *);
void get_grid_area_(const int *nlon, const int *nlat, const double *lon,
                    const double *lat, double *area) {
  get_grid_area(nlon, nlat, lon, lat, area);
}


x86 assembly (clang, -O0):
<get_grid_area_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <get_grid_area@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_grid_area_>:
jmp    1030 <get_grid_area@plt>

LLVM IR (-O0):
define void @get_grid_area_(i32* %0, i32* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
store i32* %0, i32** %6
store i32* %1, i32** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load double*, double** %8
%14 = load double*, double** %9
%15 = load double*, double** %10
%16 = call i32 @get_grid_area(i32* %11, i32* %12, double* %13, double* %14, double* %15)
ret void
}

LLVM IR (-O2):
define void @get_grid_area_(i32* %0, i32* %1, double* %2, double* %3, double* %4) {
%6 = tail call i32 @get_grid_area(i32* %0, i32* %1, double* %2, double* %3, double* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void error(void) {
  printf("input error\r\n");
  exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"input error\0D\0A\00"
define void @error() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [13 x i8] c"input error\0D\00"
define void @error() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
char *check_realloc(int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *check_strdup(char *string) {
  char *newstring = check_realloc(NULL, (strlen(string) + 1) * sizeof(char),
                                  "Allocating string copy space.\n");
  strcpy(newstring, string);
  return newstring;
}


x86 assembly (clang, -O0):
<check_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edi
lea    0xea5(%rip),%rdx
call   1030 <check_realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%esi
lea    0xeba(%rip),%rdx
xor    %edi,%edi
call   1030 <check_realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Allocating string copy space.\0A\00"
define i8* @check_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i8* @check_realloc(i32* null, i32 %9, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [31 x i8] c"Allocating string copy space.\0A\00"
define i8* @check_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @check_realloc(i32* null, i32 %3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
scalar_t__ isdigit(char const);
int skip_atoi(const char **s) {
  int i = 0;
  while (isdigit(**s))
    i = i * 10 + *((*s)++) - '0';
  return i;
}


x86 assembly (clang, -O0):
<skip_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1161 <skip_atoi+0x51>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movsbl (%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <skip_atoi+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_atoi>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1154 <skip_atoi+0x44>
nopl   0x0(%rax)
lea    (%rbx,%rbx,4),%eax
mov    (%r14),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%r14)
movsbl (%rcx),%edx
lea    (%rdx,%rax,2),%ebx
add    $0xffffffd0,%ebx
movsbl 0x1(%rcx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1130 <skip_atoi+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @skip_atoi(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isdigit(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %14, %6 ], [ 0, %1 ]
%8 = mul nsw i32 %7, 10
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %0
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = add i32 %8, -48
%14 = add i32 %13, %12
%15 = load i8, i8* %10
%16 = tail call i64 @isdigit(i8 signext %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %6
18: ; preds = %6, %1
%19 = phi i32 [ 0, %1 ], [ %14, %6 ]
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ syscall(int, int, void *, int);
void write(int fd, void *d, int len) { syscall(1, fd, d, len); }


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

x86 assembly (clang, -O2):
<write>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define void @write(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @syscall(i32 1, i32 %0, i8* %1, i32 %2)
ret void
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
int strcasecmp(int /*<<< orphan*/, int /*<<< orphan*/);
int Falphasort(const struct dirent **const l, const struct dirent **const r) {
  return strcasecmp((*l)->d_name, (*r)->d_name);
}


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

x86 assembly (clang, -O2):
<Falphasort>:
mov    (%rdi),%rax
mov    (%rax),%edi
mov    (%rsi),%rax
mov    (%rax),%esi
jmp    1030 <strcasecmp@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @Falphasort(%struct.dirent** %0, %struct.dirent** %1) {
%3 = alloca %struct.dirent**
%4 = alloca %struct.dirent**
store %struct.dirent** %0, %struct.dirent*** %3
store %struct.dirent** %1, %struct.dirent*** %4
%5 = load %struct.dirent**, %struct.dirent*** %3
%6 = load %struct.dirent*, %struct.dirent** %5
%7 = getelementptr inbounds %struct.dirent, %struct.dirent* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load %struct.dirent**, %struct.dirent*** %4
%10 = load %struct.dirent*, %struct.dirent** %9
%11 = getelementptr inbounds %struct.dirent, %struct.dirent* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @strcasecmp(i32 %8, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @Falphasort(%struct.dirent** nocapture %0, %struct.dirent** nocapture %1) {
%3 = load %struct.dirent*, %struct.dirent** %0
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = load %struct.dirent*, %struct.dirent** %1
%7 = getelementptr inbounds %struct.dirent, %struct.dirent* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @strcasecmp(i32 %5, i32 %8)
ret i32 %9
}
/* Type definitions */
struct aiocb {
  int dummy;
};
typedef int /*<<< orphan*/ aio;

/* Variables and functions */
int /*<<< orphan*/ O_SYNC;
int aio_fsync(int /*<<< orphan*/, struct aiocb *);
int /*<<< orphan*/ memset(struct aiocb *, int /*<<< orphan*/, int);
int main(void) {
  struct aiocb aio;
  (void)memset(&aio, 0, sizeof(aio));
  return aio_fsync(O_SYNC, &aio);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <aio_fsync@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1040 <aio_fsync@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.aiocb = type { i32 }
@O_SYNC = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.aiocb
store i32 0, i32* %1
%3 = call i32 @memset(%struct.aiocb* %2, i32 0, i32 4)
%4 = load i32, i32* @O_SYNC
%5 = call i32 @aio_fsync(i32 %4, %struct.aiocb* %2)
ret i32 %5
}

LLVM IR (-O2):
%struct.aiocb = type { i32 }
@O_SYNC = global i32 0
define i32 @main() {
%1 = alloca %struct.aiocb
%2 = bitcast %struct.aiocb* %1 to i8*
%3 = call i32 @memset(%struct.aiocb* %1, i32 0, i32 4)
%4 = load i32, i32* @O_SYNC
%5 = call i32 @aio_fsync(i32 %4, %struct.aiocb* %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ AccessoryDesiredHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void AccessoryDesiredLogging() { UAVObjLogging(AccessoryDesiredHandle()); }


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

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

LLVM IR (-O0):
define void @AccessoryDesiredLogging() {
%1 = call i32 (...) @AccessoryDesiredHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @AccessoryDesiredLogging() {
%1 = tail call i32 (...) @AccessoryDesiredHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
int ObjectSize0(void *const p __attribute__((pass_object_size(0)))) {
  return __builtin_object_size(p, 0);
}


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

x86 assembly (clang, -O2):
<ObjectSize0>:
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i32 @ObjectSize0(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @ObjectSize0(i8* nocapture readnone %0, i64 %1) {
%3 = trunc i64 %1 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M557_f(char *s) {
  debug("M557_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M557_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M557_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M557_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M557_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M557_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M557_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_getrandom;
int /*<<< orphan*/ ehnlc_syscall3(int /*<<< orphan*/, void *, void *, void *);
ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
  return (ssize_t)ehnlc_syscall3(SYS_getrandom, buf, (void *)buflen,
                                 (void *)(size_t)flags);
}


x86 assembly (clang, -O0):
<getrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
call   1030 <ehnlc_syscall3@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrandom>:
mov    %rsi,%rax
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rcx
mov    (%rcx),%edi
mov    %edx,%ecx
mov    %rax,%rdx
jmp    1030 <ehnlc_syscall3@plt>

LLVM IR (-O0):
@SYS_getrandom = global i32 0
define i32 @getrandom(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* @SYS_getrandom
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = inttoptr i64 %9 to i8*
%11 = load i32, i32* %6
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i8*
%14 = call i32 @ehnlc_syscall3(i32 %7, i8* %8, i8* %10, i8* %13)
ret i32 %14
}

LLVM IR (-O2):
@SYS_getrandom = global i32 0
define i32 @getrandom(i8* %0, i64 %1, i32 %2) {
%4 = load i32, i32* @SYS_getrandom
%5 = inttoptr i64 %1 to i8*
%6 = zext i32 %2 to i64
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @ehnlc_syscall3(i32 %4, i8* %0, i8* %5, i8* %7)
ret i32 %8
}
void XdbeGetBackBufferAttributes() {}


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

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

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

LLVM IR (-O2):
define void @XdbeGetBackBufferAttributes() {
ret void
}