#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ putc(int /*<<< orphan*/, int /*<<< orphan*/ *);
int empty(int *store, int k, FILE *ofp) {
  while (k-- > 0)
    if (putc(*store++, ofp) == EOF)
      return -1;
  return 0;
}


x86 assembly (clang, -O0):
<empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jle    1172 <empty+0x62>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
call   1030 <putc@plt>
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%rax
jne    116d <empty+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1179 <empty+0x69>
jmp    1123 <empty+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<empty>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ec2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    1151 <empty+0x41>
add    $0xffffffff,%ebp
mov    (%rbx),%edi
add    $0x4,%rbx
mov    %r14,%rsi
call   1030 <putc@plt>
cmp    (%r15),%rax
jne    1130 <empty+0x20>
mov    $0xffffffff,%eax
jmp    1153 <empty+0x43>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i64 0
define i32 @empty(i32* nocapture %0, i32 %1, i32* nocapture %2) {
br label %4
4: ; preds = %8, %3
%5 = phi i32* [ %0, %3 ], [ %10, %8 ]
%6 = phi i32 [ %1, %3 ], [ %9, %8 ]
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = add nsw i32 %6, -1
%10 = getelementptr inbounds i32, i32* %5, i64 1
%11 = load i32, i32* %5
%12 = tail call i64 @putc(i32 %11, i32* %2)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %4
15: ; preds = %4, %8
%16 = phi i32 [ -1, %8 ], [ 0, %4 ]
ret i32 %16
}