#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ fputs(char *, int /*<<< orphan*/ *);
int copie(FILE *in, FILE *out) {
  char buffer[50 + 1];
  while (fgets(buffer, 50, in) != NULL) {
    if (fputs(buffer, out) == EOF)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<copie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x32,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     117a <copie+0x5a>
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <fputs@plt>
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
jne    1175 <copie+0x55>
movl   $0x0,-0x4(%rbp)
jmp    1181 <copie+0x61>
jmp    1130 <copie+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copie>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    0x2ead(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x32,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     116a <copie+0x4a>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
cmp    (%r12),%rax
jne    1140 <copie+0x20>
xor    %eax,%eax
jmp    116f <copie+0x4f>
mov    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i64 0
define i32 @copie(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [51 x i8]
store i32* %0, i32** %4
store i32* %1, i32** %5
br label %7
7: ; preds = %19, %2
%8 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 0
%9 = load i32*, i32** %4
%10 = call i32* @fgets(i8* %8, i32 50, i32* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 0
%14 = load i32*, i32** %5
%15 = call i64 @fputs(i8* %13, i32* %14)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 0, i32* %3
br label %21
19: ; preds = %12
br label %7
20: ; preds = %7
store i32 1, i32* %3
br label %21
21: ; preds = %20, %18
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@EOF = global i64 0
define i32 @copie(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca [51 x i8]
%4 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %8, %2
%6 = call i32* @fgets(i8* %4, i32 50, i32* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = call i64 @fputs(i8* %4, i32* %1)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %5
12: ; preds = %5, %8
%13 = phi i32 [ 0, %8 ], [ 1, %5 ]
ret i32 %13
}