#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 */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void writeINFHeader(FILE *fIn, FILE *fOut) {
  char tmp[1024];
  int i = 0;
  while ((i < 10) && (fgets(tmp, 1024, fIn) != NULL)) {
    fprintf(fOut, "%s", tmp);
    i++;
  }
}


x86 assembly (clang, -O0):
<writeINFHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x414(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x414(%rbp)
mov    %al,-0x415(%rbp)
jge    1174 <writeINFHeader+0x54>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x415(%rbp)
mov    -0x415(%rbp),%al
test   $0x1,%al
jne    1187 <writeINFHeader+0x67>
jmp    11b2 <writeINFHeader+0x92>
mov    -0x10(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xe67(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    113d <writeINFHeader+0x1d>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeINFHeader>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsp,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     12a5 <writeINFHeader+0x185>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @writeINFHeader(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [1024 x i8]
%6 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %6
br label %7
7: ; preds = %17, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = load i32*, i32** %3
%13 = call i32* @fgets(i8* %11, i32 1024, i32* %12)
%14 = icmp ne i32* %13, null
br label %15
15: ; preds = %10, %7
%16 = phi i1 [ false, %7 ], [ %14, %10 ]
br i1 %16, label %17, label %23
17: ; preds = %15
%18 = load i32*, i32** %4
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %7
23: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @writeINFHeader(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %45, label %7
7: ; preds = %2
%8 = call i32 @fputs(i8* %4, i32* %1)
%9 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%10 = icmp eq i32* %9, null
br i1 %10, label %45, label %11
11: ; preds = %7
%12 = call i32 @fputs(i8* %4, i32* %1)
%13 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%14 = icmp eq i32* %13, null
br i1 %14, label %45, label %15
15: ; preds = %11
%16 = call i32 @fputs(i8* %4, i32* %1)
%17 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%18 = icmp eq i32* %17, null
br i1 %18, label %45, label %19
19: ; preds = %15
%20 = call i32 @fputs(i8* %4, i32* %1)
%21 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%22 = icmp eq i32* %21, null
br i1 %22, label %45, label %23
23: ; preds = %19
%24 = call i32 @fputs(i8* %4, i32* %1)
%25 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%26 = icmp eq i32* %25, null
br i1 %26, label %45, label %27
27: ; preds = %23
%28 = call i32 @fputs(i8* %4, i32* %1)
%29 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%30 = icmp eq i32* %29, null
br i1 %30, label %45, label %31
31: ; preds = %27
%32 = call i32 @fputs(i8* %4, i32* %1)
%33 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%34 = icmp eq i32* %33, null
br i1 %34, label %45, label %35
35: ; preds = %31
%36 = call i32 @fputs(i8* %4, i32* %1)
%37 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%38 = icmp eq i32* %37, null
br i1 %38, label %45, label %39
39: ; preds = %35
%40 = call i32 @fputs(i8* %4, i32* %1)
%41 = call i32* @fgets(i8* %4, i32 1024, i32* %0)
%42 = icmp eq i32* %41, null
br i1 %42, label %45, label %43
43: ; preds = %39
%44 = call i32 @fputs(i8* %4, i32* %1)
br label %45
45: ; preds = %43, %39, %35, %31, %27, %23, %19, %15, %11, %7, %2
ret void
}