#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  FILE *in;
  char line[256];
  int i = 0;
  if (argc != 2) {
    fprintf(stderr, "usage: splitlndscp.exe datafile\n");
    exit(1);
  }
  if ((in = fopen(argv[1], "r")) == NULL) {
    fprintf(stderr, "could not open datafile: %s\n", argv[1]);
    exit(1);
  }
  while (!feof(in)) {
    fgets(line, 256, in);
    if (i++ == 50) {
      printf("\n\n");
      i = 0;
    } else {
      fputs(line, stdout);
    }
  }
  fclose(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x124(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11ce <main+0x4e>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe44(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1219 <main+0x99>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe1b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    121e <main+0x9e>
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    123c <main+0xbc>
jmp    12a0 <main+0x120>
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1060 <fgets@plt>
mov    -0x124(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x124(%rbp)
cmp    $0x32,%eax
jne    1286 <main+0x106>
lea    0xdce(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x124(%rbp)
jmp    129b <main+0x11b>
lea    -0x120(%rbp),%rdi
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    121e <main+0x9e>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
cmp    $0x2,%edi
jne    123c <main+0xbc>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe7b(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     125d <main+0xdd>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     11dd <main+0x5d>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
mov    %rsp,%r14
lea    0xe36(%rip),%r15
mov    0x2de8(%rip),%r12
jmp    121b <main+0x9b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
mov    (%r12),%esi
mov    %r14,%rdi
call   1050 <fputs@plt>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    11c3 <main+0x43>
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
cmp    $0x32,%ebp
jne    1200 <main+0x80>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
jmp    120f <main+0x8f>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
lea    0xdb4(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xdb2(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"usage: splitlndscp.exe datafile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"could not open datafile: %s\0A\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [256 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %19, i32** %6
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %28
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %15
br label %29
29: ; preds = %47, %28
%30 = load i32*, i32** %6
%31 = call i32 @feof(i32* %30)
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br i1 %33, label %34, label %48
34: ; preds = %29
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%36 = load i32*, i32** %6
%37 = call i32 @fgets(i8* %35, i32 256, i32* %36)
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
%40 = icmp eq i32 %38, 50
br i1 %40, label %41, label %43
41: ; preds = %34
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %8
br label %47
43: ; preds = %34
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%45 = load i32, i32* @stdout
%46 = call i32 @fputs(i8* %44, i32 %45)
br label %47
47: ; preds = %43, %41
br label %29
48: ; preds = %29
%49 = load i32*, i32** %6
%50 = call i32 @fclose(i32* %49)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"usage: splitlndscp.exe datafile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"could not open datafile: %s\0A\00"
@stdout = global i32 0
@str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = call i32 @feof(i32* %13)
%17 = icmp eq i32 %16, 0
br i1 %17, label %23, label %37
18: ; preds = %10
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %11
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = tail call i32 @exit(i32 1)
unreachable
23: ; preds = %15, %33
%24 = phi i32 [ %34, %33 ], [ 0, %15 ]
%25 = call i32 @fgets(i8* %4, i32 256, i32* %13)
%26 = icmp eq i32 %24, 50
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %33
29: ; preds = %23
%30 = add nsw i32 %24, 1
%31 = load i32, i32* @stdout
%32 = call i32 @fputs(i8* %4, i32 %31)
br label %33
33: ; preds = %29, %27
%34 = phi i32 [ 0, %27 ], [ %30, %29 ]
%35 = call i32 @feof(i32* %13)
%36 = icmp eq i32 %35, 0
br i1 %36, label %23, label %37
37: ; preds = %33, %15
%38 = call i32 @fclose(i32* %13)
ret i32 0
}