#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__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
char getByte(int /*<<< orphan*/ *);
void VIPtoBinary(FILE *in, FILE *out) {
  char onebyte_data;
  while (!feof(in)) {
    onebyte_data = getByte(in);
    if (feof(in))
      continue;
    fwrite(&onebyte_data, sizeof(char), 1, out);
  }
}


x86 assembly (clang, -O0):
<VIPtoBinary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115f <VIPtoBinary+0x2f>
jmp    119c <VIPtoBinary+0x6c>
mov    -0x8(%rbp),%rdi
call   1030 <getByte@plt>
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%rax
je     1183 <VIPtoBinary+0x53>
jmp    1140 <VIPtoBinary+0x10>
mov    -0x10(%rbp),%rcx
lea    -0x11(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1050 <fwrite@plt>
jmp    1140 <VIPtoBinary+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIPtoBinary>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
jmp    1143 <VIPtoBinary+0x13>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %rax,%rax
jne    1172 <VIPtoBinary+0x42>
mov    %rbx,%rdi
call   1030 <getByte@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %rax,%rax
jne    1140 <VIPtoBinary+0x10>
movsbl %bpl,%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
jmp    1140 <VIPtoBinary+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @VIPtoBinary(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %18, %17, %2
%7 = load i32*, i32** %3
%8 = call i64 @feof(i32* %7)
%9 = icmp ne i64 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = load i32*, i32** %3
%13 = call signext i8 @getByte(i32* %12)
store i8 %13, i8* %5
%14 = load i32*, i32** %3
%15 = call i64 @feof(i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
br label %6
18: ; preds = %11
%19 = load i32*, i32** %4
%20 = call i32 @fwrite(i8* %5, i32 1, i32 1, i32* %19)
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @VIPtoBinary(i32* %0, i32* nocapture %1) {
%3 = tail call i64 @feof(i32* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %2, %12
%6 = tail call signext i8 @getByte(i32* %0)
%7 = tail call i64 @feof(i32* %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = sext i8 %6 to i32
%11 = tail call i32 @fputc(i32 %10, i32* %1)
br label %12
12: ; preds = %9, %5
%13 = tail call i64 @feof(i32* %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %5, label %15
15: ; preds = %12, %2
ret void
}