#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 EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
scalar_t__ isalpha(int);
scalar_t__ isdigit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ scanf(char *, char *);
main() {
  FILE *fin, *fout;
  int c, j, k, l;
  char f_name[256];
  printf("data file converter: *.dat => *.txt\ninput data file?\n");
  scanf("%s", f_name);
  fin = fopen(f_name, "r");
  if (fin == NULL) {
    printf("no input file : %s\n", f_name);
    exit(1);
  }
  printf("output txt file?\n");
  scanf("%s", f_name);
  fout = fopen(f_name, "r");
  if (fout != NULL) {
    printf("error : %s exists\n", f_name);
    exit(1);
  }
  fout = fopen(f_name, "w");
  j = 0;
  k = 0;
  l = 0;
  while ((c = getc(fin)) != EOF) {
    if (isdigit(c) == 0) {
      if (isalpha(c) != 0) {
        putc('\n', fout);
        putc('\n', fout);
      }
      putc(c, fout);
      putc('\n', fout);
      putc('\n', fout);
      j = 0;
      k = 0;
      l = 0;
      continue;
    }
    putc(c, fout);
    if (++j >= 10) {
      j = 0;
      if (++k >= 5) {
        k = 0;
        putc('\n', fout);
        if (++l >= 20) {
          l = 0;
          putc('\n', fout);
        }
      } else {
        putc(' ', fout);
      }
    }
  }
  fclose(fout);
  fclose(fin);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x130(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1204 <main+0x74>
lea    -0x130(%rbp),%rsi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x130(%rbp),%rsi
lea    0xe16(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x130(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1266 <main+0xd6>
lea    -0x130(%rbp),%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    -0x130(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d43(%rip),%rcx
cmp    (%rcx),%eax
je     13c5 <main+0x235>
mov    -0x1c(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1332 <main+0x1a2>
mov    -0x1c(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     12ed <main+0x15d>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <putc@plt>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <putc@plt>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1060 <putc@plt>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <putc@plt>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <putc@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
jmp    1292 <main+0x102>
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1060 <putc@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmp    $0xa,%eax
jl     13c0 <main+0x230>
movl   $0x0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmp    $0x5,%eax
jl     13ad <main+0x21d>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <putc@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmp    $0x14,%eax
jl     13a8 <main+0x218>
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <putc@plt>
jmp    13bb <main+0x22b>
mov    -0x18(%rbp),%rsi
mov    $0x20,%edi
call   1060 <putc@plt>
jmp    13c0 <main+0x230>
jmp    1292 <main+0x102>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xe76(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3c(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <scanf@plt>
lea    0xe2d(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     134e <main+0x1ae>
mov    %rax,%r14
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
lea    0xe03(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <scanf@plt>
lea    0xdf4(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
jne    1357 <main+0x1b7>
lea    0xe05(%rip),%rsi
mov    %rsp,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r13
mov    %r14,%rdi
call   10c0 <getc@plt>
mov    %eax,%ebp
mov    0x2da5(%rip),%rax
cmp    (%rax),%ebp
jne    126b <main+0xcb>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r12d,%r12d
xor    %r15d,%r15d
xor    %ebx,%ebx
jmp    1298 <main+0xf8>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
mov    %r14,%rdi
call   10c0 <getc@plt>
mov    %eax,%ebp
mov    0x2d54(%rip),%rax
cmp    (%rax),%ebp
je     1247 <main+0xa7>
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     12d0 <main+0x130>
movsbl %bpl,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
cmp    $0x9,%ebx
jl     1280 <main+0xe0>
cmp    $0x4,%r15d
jge    132b <main+0x18b>
add    $0x1,%r15d
mov    $0x20,%al
mov    %r15d,%ebx
jmp    1316 <main+0x176>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1080 <isalpha@plt>
test   %rax,%rax
je     12f6 <main+0x156>
mov    $0xa,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
movsbl %bpl,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
mov    $0xa,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
xor    %ebx,%ebx
mov    $0xa,%al
xor    %r12d,%r12d
mov    %ebx,%r15d
movzbl %al,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
xor    %ebx,%ebx
jmp    1283 <main+0xe3>
mov    $0xa,%edi
mov    %r13,%rsi
call   1070 <putc@plt>
xor    %ebx,%ebx
mov    $0xa,%al
cmp    $0x12,%r12d
jg     1313 <main+0x173>
add    $0x1,%r12d
xor    %r15d,%r15d
jmp    1283 <main+0xe3>
lea    0xcb0(%rip),%rdi
jmp    135e <main+0x1be>
lea    0xcbb(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"data file converter: *.dat => *.txt\0Ainput data file?\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [20 x i8] c"no input file : %s\0A\00"
@.str.4 = [18 x i8] c"output txt file?\0A\00"
@.str.5 = [19 x i8] c"error : %s exists\0A\00"
@.str.6 = [2 x i8] c"w\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x i8]
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%13 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %13, i32** %2
%14 = load i32*, i32** %2
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %0
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %3
%26 = load i32*, i32** %3
%27 = icmp ne i32* %26, null
br i1 %27, label %28, label %32
28: ; preds = %20
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %20
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%34 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %34, i32** %3
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %35
35: ; preds = %88, %53, %32
%36 = load i32*, i32** %2
%37 = call i32 @getc(i32* %36)
store i32 %37, i32* %4
%38 = load i32, i32* @EOF
%39 = icmp ne i32 %37, %38
br i1 %39, label %40, label %89
40: ; preds = %35
%41 = load i32, i32* %4
%42 = call i64 @isdigit(i32 %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %62
44: ; preds = %40
%45 = load i32, i32* %4
%46 = call i64 @isalpha(i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = load i32*, i32** %3
%50 = call i32 @putc(i8 signext 10, i32* %49)
%51 = load i32*, i32** %3
%52 = call i32 @putc(i8 signext 10, i32* %51)
br label %53
53: ; preds = %48, %44
%54 = load i32, i32* %4
%55 = trunc i32 %54 to i8
%56 = load i32*, i32** %3
%57 = call i32 @putc(i8 signext %55, i32* %56)
%58 = load i32*, i32** %3
%59 = call i32 @putc(i8 signext 10, i32* %58)
%60 = load i32*, i32** %3
%61 = call i32 @putc(i8 signext 10, i32* %60)
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %35
62: ; preds = %40
%63 = load i32, i32* %4
%64 = trunc i32 %63 to i8
%65 = load i32*, i32** %3
%66 = call i32 @putc(i8 signext %64, i32* %65)
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
%69 = icmp sge i32 %68, 10
br i1 %69, label %70, label %88
70: ; preds = %62
store i32 0, i32* %5
%71 = load i32, i32* %6
%72 = add nsw i32 %71, 1
store i32 %72, i32* %6
%73 = icmp sge i32 %72, 5
br i1 %73, label %74, label %84
74: ; preds = %70
store i32 0, i32* %6
%75 = load i32*, i32** %3
%76 = call i32 @putc(i8 signext 10, i32* %75)
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
%79 = icmp sge i32 %78, 20
br i1 %79, label %80, label %83
80: ; preds = %74
store i32 0, i32* %7
%81 = load i32*, i32** %3
%82 = call i32 @putc(i8 signext 10, i32* %81)
br label %83
83: ; preds = %80, %74
br label %87
84: ; preds = %70
%85 = load i32*, i32** %3
%86 = call i32 @putc(i8 signext 32, i32* %85)
br label %87
87: ; preds = %84, %83
br label %88
88: ; preds = %87, %62
br label %35
89: ; preds = %35
%90 = load i32*, i32** %3
%91 = call i32 @fclose(i32* %90)
%92 = load i32*, i32** %2
%93 = call i32 @fclose(i32* %92)
%94 = load i32, i32* %1
ret i32 %94
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [20 x i8] c"no input file : %s\0A\00"
@.str.5 = [19 x i8] c"error : %s exists\0A\00"
@.str.6 = [2 x i8] c"w\00"
@EOF = global i32 0
@str = [53 x i8] c"data file converter: *.dat => *.txt\0Ainput data file?\00"
@str.7 = [17 x i8] c"output txt file?\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%13 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %10
%19 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @getc(i32* %5)
%21 = load i32, i32* @EOF
%22 = icmp eq i32 %20, %21
br i1 %22, label %65, label %23
23: ; preds = %18, %45
%24 = phi i32 [ %49, %45 ], [ %20, %18 ]
%25 = phi i32 [ %48, %45 ], [ 0, %18 ]
%26 = phi i32 [ %47, %45 ], [ 0, %18 ]
%27 = phi i32 [ %46, %45 ], [ 0, %18 ]
%28 = call i64 @isdigit(i32 %24)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %52
30: ; preds = %23
%31 = call i64 @isalpha(i32 %24)
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = call i32 @putc(i8 signext 10, i32* %19)
%35 = call i32 @putc(i8 signext 10, i32* %19)
br label %36
36: ; preds = %33, %30
%37 = trunc i32 %24 to i8
%38 = call i32 @putc(i8 signext %37, i32* %19)
%39 = call i32 @putc(i8 signext 10, i32* %19)
br label %40
40: ; preds = %59, %36, %63
%41 = phi i8 [ 32, %63 ], [ 10, %36 ], [ 10, %59 ]
%42 = phi i32 [ %64, %63 ], [ 0, %36 ], [ 0, %59 ]
%43 = phi i32 [ %25, %63 ], [ 0, %36 ], [ 0, %59 ]
%44 = call i32 @putc(i8 signext %41, i32* %19)
br label %45
45: ; preds = %40, %52, %59
%46 = phi i32 [ 0, %59 ], [ %55, %52 ], [ 0, %40 ]
%47 = phi i32 [ 0, %59 ], [ %26, %52 ], [ %42, %40 ]
%48 = phi i32 [ %61, %59 ], [ %25, %52 ], [ %43, %40 ]
%49 = call i32 @getc(i32* %5)
%50 = load i32, i32* @EOF
%51 = icmp eq i32 %49, %50
br i1 %51, label %65, label %23
52: ; preds = %23
%53 = trunc i32 %24 to i8
%54 = call i32 @putc(i8 signext %53, i32* %19)
%55 = add nsw i32 %27, 1
%56 = icmp sgt i32 %27, 8
br i1 %56, label %57, label %45
57: ; preds = %52
%58 = icmp sgt i32 %26, 3
br i1 %58, label %59, label %63
59: ; preds = %57
%60 = call i32 @putc(i8 signext 10, i32* %19)
%61 = add nsw i32 %25, 1
%62 = icmp sgt i32 %25, 18
br i1 %62, label %40, label %45
63: ; preds = %57
%64 = add nsw i32 %26, 1
br label %40
65: ; preds = %45, %18
%66 = call i32 @fclose(i32* %19)
%67 = call i32 @fclose(i32* %5)
ret i32 0
}