#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;
int /*<<< orphan*/ error(int, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ getc(int /*<<< orphan*/ *);
scalar_t__ putc(int /*<<< orphan*/, int /*<<< orphan*/ *);
void piccopy(FILE *fp_in, FILE *fp_out, long total) {
  long i;
  for (i = 0; i < total; i++)
    if (putc(getc(fp_in), fp_out) == EOF)
      error(1, "error copying in-line picture file");
  fflush(fp_out);
}


x86 assembly (clang, -O0):
<piccopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11b5 <piccopy+0x75>
mov    -0x8(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <putc@plt>
mov    0x2e63(%rip),%rcx
cmp    (%rcx),%rax
jne    119f <piccopy+0x5f>
mov    $0x1,%edi
lea    0xe66(%rip),%rsi
call   1050 <error@plt>
jmp    11a4 <piccopy+0x64>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    115c <piccopy+0x1c>
mov    -0x10(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<piccopy>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
test   %rdx,%rdx
jle    119d <piccopy+0x5d>
mov    %rdx,%rbx
mov    %rdi,%r15
mov    0x2e8a(%rip),%r13
lea    0xe9b(%rip),%r12
jmp    1176 <piccopy+0x36>
nopw   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rbx
je     119d <piccopy+0x5d>
mov    %r15,%rdi
call   1060 <getc@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
cmp    0x0(%r13),%rax
jne    1170 <piccopy+0x30>
mov    $0x1,%edi
mov    %r12,%rsi
call   1050 <error@plt>
jmp    1170 <piccopy+0x30>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@EOF = global i64 0
@.str = [35 x i8] c"error copying in-line picture file\00"
define void @piccopy(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
store i64 0, i64* %7
br label %8
8: ; preds = %22, %3
%9 = load i64, i64* %7
%10 = load i64, i64* %6
%11 = icmp slt i64 %9, %10
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i32*, i32** %4
%14 = call i32 @getc(i32* %13)
%15 = load i32*, i32** %5
%16 = call i64 @putc(i32 %14, i32* %15)
%17 = load i64, i64* @EOF
%18 = icmp eq i64 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 @error(i32 1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %12
br label %22
22: ; preds = %21
%23 = load i64, i64* %7
%24 = add nsw i64 %23, 1
store i64 %24, i64* %7
br label %8
25: ; preds = %8
%26 = load i32*, i32** %5
%27 = call i32 @fflush(i32* %26)
ret void
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [35 x i8] c"error copying in-line picture file\00"
define void @piccopy(i32* nocapture %0, i32* nocapture %1, i64 %2) {
%4 = icmp sgt i64 %2, 0
br i1 %4, label %5, label %16
5: ; preds = %3, %13
%6 = phi i64 [ %14, %13 ], [ 0, %3 ]
%7 = tail call i32 @getc(i32* %0)
%8 = tail call i64 @putc(i32 %7, i32* %1)
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %5, %11
%14 = add nuw nsw i64 %6, 1
%15 = icmp eq i64 %14, %2
br i1 %15, label %16, label %5
16: ; preds = %13, %3
%17 = tail call i32 @fflush(i32* %1)
ret void
}