#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 */
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ piece(char *, char, char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stdin;
void for_each_row_output_each_field(char **header_array) {
  char input_buffer[128];
  char piece_buffer[128];
  int i;
  while (get_line(input_buffer, stdin)) {
    if (*input_buffer == '|' && *(input_buffer + 1) != '-') {
      for (i = 0; header_array[i]; i++) {
        piece(piece_buffer, '|', input_buffer, i + 1);
        printf("%s|%s\n", header_array[i], piece_buffer);
      }
    } else {
    }
  }
}


x86 assembly (clang, -O0):
<for_each_row_output_each_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     1204 <for_each_row_output_each_field+0xd4>
movsbl -0x90(%rbp),%eax
cmp    $0x7c,%eax
jne    11fa <for_each_row_output_each_field+0xca>
movsbl -0x8f(%rbp),%eax
cmp    $0x2d,%eax
je     11fa <for_each_row_output_each_field+0xca>
movl   $0x0,-0x114(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x114(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11f5 <for_each_row_output_each_field+0xc5>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rdx
mov    -0x114(%rbp),%ecx
add    $0x1,%ecx
mov    $0x7c,%esi
call   1050 <piece@plt>
mov    -0x8(%rbp),%rax
movslq -0x114(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x110(%rbp),%rdx
lea    0xe24(%rip),%rdi
call   1040 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1188 <for_each_row_output_each_field+0x58>
jmp    11ff <for_each_row_output_each_field+0xcf>
jmp    11ff <for_each_row_output_each_field+0xcf>
jmp    113f <for_each_row_output_each_field+0xf>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<for_each_row_output_each_field>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%r13
mov    0x2e9d(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11d0 <for_each_row_output_each_field+0xa0>
lea    0x80(%rsp),%r14
mov    %rsp,%r15
lea    0xe93(%rip),%r12
jmp    1180 <for_each_row_output_each_field+0x50>
nop
mov    0x0(%rbp),%esi
mov    %r15,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11d0 <for_each_row_output_each_field+0xa0>
cmpb   $0x7c,(%rsp)
jne    1170 <for_each_row_output_each_field+0x40>
cmpb   $0x2d,0x1(%rsp)
je     1170 <for_each_row_output_each_field+0x40>
cmpq   $0x0,0x0(%r13)
je     1170 <for_each_row_output_each_field+0x40>
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x7c,%esi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1050 <piece@plt>
mov    -0x8(%r13,%rbx,8),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1040 <printf@plt>
cmpq   $0x0,0x0(%r13,%rbx,8)
lea    0x1(%rbx),%rbx
jne    11a0 <for_each_row_output_each_field+0x70>
jmp    1170 <for_each_row_output_each_field+0x40>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [7 x i8] c"%s|%s\0A\00"
define void @for_each_row_output_each_field(i8** %0) {
%2 = alloca i8**
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca i32
store i8** %0, i8*** %2
br label %6
6: ; preds = %48, %1
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i64 @get_line(i8* %7, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %49
11: ; preds = %6
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 124
br i1 %15, label %16, label %47
16: ; preds = %11
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 45
br i1 %21, label %22, label %47
22: ; preds = %16
store i32 0, i32* %5
br label %23
23: ; preds = %43, %22
%24 = load i8**, i8*** %2
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %46
30: ; preds = %23
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
%35 = call i32 @piece(i8* %31, i8 signext 124, i8* %32, i32 %34)
%36 = load i8**, i8*** %2
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %40, i8* %41)
br label %43
43: ; preds = %30
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %23
46: ; preds = %23
br label %48
47: ; preds = %16, %11
br label %48
48: ; preds = %47, %46
br label %6
49: ; preds = %6
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [7 x i8] c"%s|%s\0A\00"
define void @for_each_row_output_each_field(i8** nocapture %0) {
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i64 @get_line(i8* %4, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %35, label %9
9: ; preds = %1
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 1
br label %11
11: ; preds = %9, %31
%12 = load i8, i8* %4
%13 = icmp eq i8 %12, 124
%14 = load i8, i8* %10
%15 = icmp ne i8 %14, 45
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %17, label %31
17: ; preds = %11
%18 = load i8*, i8** %0
%19 = icmp eq i8* %18, null
br i1 %19, label %31, label %20
20: ; preds = %17, %20
%21 = phi i64 [ %23, %20 ], [ 0, %17 ]
%22 = phi i8** [ %28, %20 ], [ %0, %17 ]
%23 = add nuw nsw i64 %21, 1
%24 = trunc i64 %23 to i32
%25 = call i32 @piece(i8* %5, i8 signext 124, i8* %4, i32 %24)
%26 = load i8*, i8** %22
%27 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %26, i8* %5)
%28 = getelementptr inbounds i8*, i8** %0, i64 %23
%29 = load i8*, i8** %28
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %20
31: ; preds = %20, %17, %11
%32 = load i32, i32* @stdin
%33 = call i64 @get_line(i8* %4, i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %11
35: ; preds = %31, %1
ret void
}