#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 */

/* Variables and functions */
int EOF;
int format_line(char *, int, int, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char vet[100];
  int c;
  while ((c = format_line(vet, 100, 4, 4)) != EOF)
    if (c != '\n')
      printf("%s", vet);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
mov    $0x4,%ecx
mov    %ecx,%edx
call   1030 <format_line@plt>
mov    %eax,-0x74(%rbp)
mov    0x2e97(%rip),%rcx
cmp    (%rcx),%eax
je     1178 <main+0x58>
cmpl   $0xa,-0x74(%rbp)
je     1173 <main+0x53>
lea    -0x70(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
call   1030 <format_line@plt>
mov    0x2ea1(%rip),%r15
cmp    (%r15),%eax
jne    1158 <main+0x38>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rsp,%rbx
lea    0xe9e(%rip),%r14
jmp    118c <main+0x6c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x64,%esi
mov    $0x4,%edx
mov    $0x4,%ecx
call   1030 <format_line@plt>
cmp    (%r15),%eax
je     114c <main+0x2c>
cmp    $0xa,%eax
je     1170 <main+0x50>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    1170 <main+0x50>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %15, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @format_line(i8* %5, i32 100, i32 4, i32 4)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %4
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %9
br label %4
16: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @format_line(i8* %2, i32 100, i32 4, i32 4)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %0, %11
%7 = phi i32 [ %12, %11 ], [ %3, %0 ]
%8 = icmp eq i32 %7, 10
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %11
11: ; preds = %9, %6
%12 = call i32 @format_line(i8* %2, i32 100, i32 4, i32 4)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %6
15: ; preds = %11, %0
ret i32 0
}