#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*/ fill_page(int /*<<< orphan*/ *, int *, int *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int lpp(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ print_report_header(int /*<<< orphan*/ *, int *, int *,
                                       char *, int, int);
void output_line(char *line, FILE *output_file, int *line_counter,
                 int *page_counter, char *title, int print_date, int print_page,
                 int double_space) {
  fputs(line, output_file);
  *line_counter = *line_counter + 1;
  if (*line_counter >= (lpp(0, 0) - 5)) {
    fill_page(output_file, line_counter, page_counter);
    print_report_header(output_file, line_counter, page_counter, title,
                        print_date, print_page);
  }
  if (double_space) {
    fputs("\n", output_file);
    *line_counter = *line_counter + 1;
    if (*line_counter >= (lpp(0, 0) - 5)) {
      fill_page(output_file, line_counter, page_counter);
      print_report_header(output_file, line_counter, page_counter, title,
                          print_date, print_page);
    }
  }
}


x86 assembly (clang, -O0):
<output_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <fputs@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1060 <lpp@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
sub    $0x5,%ecx
cmp    %ecx,%eax
jl     11d2 <output_line+0x92>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <fill_page@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    0x10(%rbp),%r9d
call   1030 <print_report_header@plt>
cmpl   $0x0,0x18(%rbp)
je     1250 <output_line+0x110>
mov    -0x10(%rbp),%rsi
lea    0xe19(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1060 <lpp@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
sub    $0x5,%ecx
cmp    %ecx,%eax
jl     124b <output_line+0x10b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <fill_page@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    0x10(%rbp),%r9d
call   1030 <print_report_header@plt>
jmp    1250 <output_line+0x110>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebp
mov    %r8,0x10(%rsp)
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%r12
mov    0x58(%rsp),%r14d
mov    0x50(%rsp),%eax
mov    %eax,0xc(%rsp)
call   1050 <fputs@plt>
mov    (%rbx),%r15d
add    $0x1,%r15d
mov    %r15d,(%rbx)
xor    %edi,%edi
xor    %esi,%esi
call   1070 <lpp@plt>
add    $0xfffffffb,%eax
cmp    %eax,%r15d
jl     11c5 <output_line+0x75>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1040 <fill_page@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    0x10(%rsp),%rcx
mov    %ebp,%r8d
mov    0xc(%rsp),%r9d
call   1030 <print_report_header@plt>
test   %r14d,%r14d
je     11f1 <output_line+0xa1>
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    %ebp,%r14d
mov    (%rbx),%ebp
add    $0x1,%ebp
mov    %ebp,(%rbx)
xor    %edi,%edi
xor    %esi,%esi
call   1070 <lpp@plt>
add    $0xfffffffb,%eax
cmp    %eax,%ebp
jge    1200 <output_line+0xb0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1040 <fill_page@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    0x10(%rsp),%rcx
mov    %r14d,%r8d
mov    0xc(%rsp),%r9d
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <print_report_header@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @output_line(i8* %0, i32* %1, i32* %2, i32* %3, i8* %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i32* %3, i32** %12
store i8* %4, i8** %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i8*, i8** %9
%18 = load i32*, i32** %10
%19 = call i32 @fputs(i8* %17, i32* %18)
%20 = load i32*, i32** %11
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
%23 = load i32*, i32** %11
store i32 %22, i32* %23
%24 = load i32*, i32** %11
%25 = load i32, i32* %24
%26 = call i32 @lpp(i32 0, i32 0)
%27 = sub nsw i32 %26, 5
%28 = icmp sge i32 %25, %27
br i1 %28, label %29, label %41
29: ; preds = %8
%30 = load i32*, i32** %10
%31 = load i32*, i32** %11
%32 = load i32*, i32** %12
%33 = call i32 @fill_page(i32* %30, i32* %31, i32* %32)
%34 = load i32*, i32** %10
%35 = load i32*, i32** %11
%36 = load i32*, i32** %12
%37 = load i8*, i8** %13
%38 = load i32, i32* %14
%39 = load i32, i32* %15
%40 = call i32 @print_report_header(i32* %34, i32* %35, i32* %36, i8* %37, i32 %38, i32 %39)
br label %41
41: ; preds = %29, %8
%42 = load i32, i32* %16
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %69
44: ; preds = %41
%45 = load i32*, i32** %10
%46 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %45)
%47 = load i32*, i32** %11
%48 = load i32, i32* %47
%49 = add nsw i32 %48, 1
%50 = load i32*, i32** %11
store i32 %49, i32* %50
%51 = load i32*, i32** %11
%52 = load i32, i32* %51
%53 = call i32 @lpp(i32 0, i32 0)
%54 = sub nsw i32 %53, 5
%55 = icmp sge i32 %52, %54
br i1 %55, label %56, label %68
56: ; preds = %44
%57 = load i32*, i32** %10
%58 = load i32*, i32** %11
%59 = load i32*, i32** %12
%60 = call i32 @fill_page(i32* %57, i32* %58, i32* %59)
%61 = load i32*, i32** %10
%62 = load i32*, i32** %11
%63 = load i32*, i32** %12
%64 = load i8*, i8** %13
%65 = load i32, i32* %14
%66 = load i32, i32* %15
%67 = call i32 @print_report_header(i32* %61, i32* %62, i32* %63, i8* %64, i32 %65, i32 %66)
br label %68
68: ; preds = %56, %44
br label %69
69: ; preds = %68, %41
ret void
}

LLVM IR (-O2):
define void @output_line(i8* nocapture %0, i32* %1, i32* %2, i32* %3, i8* %4, i32 %5, i32 %6, i32 %7) {
%9 = tail call i32 @fputs(i8* %0, i32* %1)
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
%12 = tail call i32 @lpp(i32 0, i32 0)
%13 = add nsw i32 %12, -5
%14 = icmp slt i32 %11, %13
br i1 %14, label %18, label %15
15: ; preds = %8
%16 = tail call i32 @fill_page(i32* %1, i32* %2, i32* %3)
%17 = tail call i32 @print_report_header(i32* %1, i32* %2, i32* %3, i8* %4, i32 %5, i32 %6)
br label %18
18: ; preds = %15, %8
%19 = icmp eq i32 %7, 0
br i1 %19, label %30, label %20
20: ; preds = %18
%21 = tail call i32 @fputc(i32 10, i32* %1)
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
%24 = tail call i32 @lpp(i32 0, i32 0)
%25 = add nsw i32 %24, -5
%26 = icmp slt i32 %23, %25
br i1 %26, label %30, label %27
27: ; preds = %20
%28 = tail call i32 @fill_page(i32* %1, i32* %2, i32* %3)
%29 = tail call i32 @print_report_header(i32* %1, i32* %2, i32* %3, i8* %4, i32 %5, i32 %6)
br label %30
30: ; preds = %20, %27, %18
ret void
}