#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 int32_t;

/* Variables and functions */
int /*<<< orphan*/ fputs_unlocked(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fread_unlocked(int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ getchar_unlocked();
int /*<<< orphan*/ readchar();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
void transform_binary(void) {
  int32_t count;
  fread_unlocked(&count, 4, 1, stdin);
  getchar_unlocked();
  fputs_unlocked("__binary", stdout);
  for (int i = 0; i < count; i++) {
    readchar();
  }
}


x86 assembly (clang, -O0):
<transform_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%ecx
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <fread_unlocked@plt>
mov    $0x0,%al
call   1040 <getchar_unlocked@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
lea    0xe85(%rip),%rdi
call   1060 <fputs_unlocked@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a8 <transform_binary+0x68>
mov    $0x0,%al
call   1030 <readchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1187 <transform_binary+0x47>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transform_binary>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <fread_unlocked@plt>
xor    %eax,%eax
call   1040 <getchar_unlocked@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
lea    0xe87(%rip),%rdi
call   1060 <fputs_unlocked@plt>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <transform_binary+0x60>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <readchar@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1190 <transform_binary+0x50>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [9 x i8] c"__binary\00"
@stdout = global i32 0
define void @transform_binary() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @stdin
%4 = call i32 @fread_unlocked(i32* %1, i32 4, i32 1, i32 %3)
%5 = call i32 (...) @getchar_unlocked()
%6 = load i32, i32* @stdout
%7 = call i32 @fputs_unlocked(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 0, i32* %2
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = call i32 (...) @readchar()
br label %14
14: ; preds = %12
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %8
17: ; preds = %8
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [9 x i8] c"__binary\00"
@stdout = global i32 0
define void @transform_binary() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @stdin
%4 = call i32 @fread_unlocked(i32* %1, i32 4, i32 1, i32 %3)
%5 = call i32 (...) @getchar_unlocked()
%6 = load i32, i32* @stdout
%7 = call i32 @fputs_unlocked(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %11, %0
ret void
11: ; preds = %0, %11
%12 = phi i32 [ %14, %11 ], [ 0, %0 ]
%13 = call i32 (...) @readchar()
%14 = add nuw nsw i32 %12, 1
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %11, label %10
}