#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ scanf(char *);
int main(void) {
  int i, j;
  int x = 5;
  int y = 5;
  printf("zorg er voor dat in.txt bestaat voor u verder gaat!");
  scanf("%*c");
  FILE *fin = fopen("in.txt", "r");
  FILE *fuit = fopen("uit.txt", "w");
  putc('(', fuit);
  for (i = 0; i < y; i++) {
    putc('\t', fuit);
    putc('(', fuit);
    for (j = 0; j < x; j++) {
      getc(fin);
      getc(fin);
      getc(fin);
      putc('x', fuit);
      putc('"', fuit);
      putc(getc(fin), fuit);
      putc(getc(fin), fuit);
      putc('"', fuit);
      if (j != x - 1) {
        putc(',', fuit);
        getc(fin);
      } else {
        putc(')', fuit);
        if (i != y - 1)
          getc(fin);
      }
    }
    getc(fin);
    putc(')', fuit);
    if (i != y - 1) {
      putc('\n', fuit);
    } else {
      putc(')', fuit);
    }
    putc(',', fuit);
  }
  fclose(fin);
  fclose(fuit);
  printf("OK!");
  scanf("%*c");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
call   1060 <scanf@plt>
lea    0xe9c(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    0xe8e(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    $0x28,%edi
call   1050 <putc@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1354 <main+0x1f4>
mov    -0x28(%rbp),%rsi
mov    $0x9,%edi
call   1050 <putc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x28,%edi
call   1050 <putc@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12ef <main+0x18f>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x78,%edi
call   1050 <putc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x22,%edi
call   1050 <putc@plt>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1050 <putc@plt>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
mov    -0x28(%rbp),%rsi
movsbl %al,%edi
call   1050 <putc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x22,%edi
call   1050 <putc@plt>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     12af <main+0x14f>
mov    -0x28(%rbp),%rsi
mov    $0x2c,%edi
call   1050 <putc@plt>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
jmp    12dc <main+0x17c>
mov    -0x28(%rbp),%rsi
mov    $0x29,%edi
call   1050 <putc@plt>
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     12d7 <main+0x177>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
jmp    12dc <main+0x17c>
jmp    12e1 <main+0x181>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1207 <main+0xa7>
mov    -0x20(%rbp),%rdi
call   1080 <getc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x29,%edi
call   1050 <putc@plt>
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     132a <main+0x1ca>
mov    -0x28(%rbp),%rsi
mov    $0xa,%edi
call   1050 <putc@plt>
jmp    1338 <main+0x1d8>
mov    -0x28(%rbp),%rsi
mov    $0x29,%edi
call   1050 <putc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x2c,%edi
call   1050 <putc@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d8 <main+0x78>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xcde(%rip),%rdi
call   1040 <printf@plt>
lea    0xcbb(%rip),%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
call   1060 <scanf@plt>
lea    0xeb2(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
lea    0xea5(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    $0x28,%edi
mov    %rax,%rsi
call   1050 <putc@plt>
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    $0x9,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x28,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x4,%ebp
nop
mov    %r14,%rdi
call   1080 <getc@plt>
mov    %r14,%rdi
call   1080 <getc@plt>
mov    %r14,%rdi
call   1080 <getc@plt>
mov    $0x78,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x22,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    %r14,%rdi
call   1080 <getc@plt>
movsbl %al,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    %r14,%rdi
call   1080 <getc@plt>
movsbl %al,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x22,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
sub    $0x1,%ebp
jb     1270 <main+0x110>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    %r14,%rdi
call   1080 <getc@plt>
jmp    11e0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x29,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    %r14,%rdi
call   1080 <getc@plt>
cmp    $0x4,%r15d
je     12c3 <main+0x163>
mov    %r14,%rdi
call   1080 <getc@plt>
mov    $0x29,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
add    $0x1,%r15d
jmp    11c0 <main+0x60>
mov    $0x29,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x29,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    $0x2c,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xd4a(%rip),%rdi
call   1040 <printf@plt>
lea    0xd27(%rip),%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"zorg er voor dat in.txt bestaat voor u verder gaat!\00"
@.str.1 = [4 x i8] c"%*c\00"
@.str.2 = [7 x i8] c"in.txt\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [8 x i8] c"uit.txt\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [4 x i8] c"OK!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %1
store i32 5, i32* %4
store i32 5, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %10, i32** %6
%11 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = call i32 @putc(i8 signext 40, i32* %12)
store i32 0, i32* %2
br label %14
14: ; preds = %90, %0
%15 = load i32, i32* %2
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %93
18: ; preds = %14
%19 = load i32*, i32** %7
%20 = call i32 @putc(i8 signext 9, i32* %19)
%21 = load i32*, i32** %7
%22 = call i32 @putc(i8 signext 40, i32* %21)
store i32 0, i32* %3
br label %23
23: ; preds = %69, %18
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %72
27: ; preds = %23
%28 = load i32*, i32** %6
%29 = call signext i8 @getc(i32* %28)
%30 = load i32*, i32** %6
%31 = call signext i8 @getc(i32* %30)
%32 = load i32*, i32** %6
%33 = call signext i8 @getc(i32* %32)
%34 = load i32*, i32** %7
%35 = call i32 @putc(i8 signext 120, i32* %34)
%36 = load i32*, i32** %7
%37 = call i32 @putc(i8 signext 34, i32* %36)
%38 = load i32*, i32** %6
%39 = call signext i8 @getc(i32* %38)
%40 = load i32*, i32** %7
%41 = call i32 @putc(i8 signext %39, i32* %40)
%42 = load i32*, i32** %6
%43 = call signext i8 @getc(i32* %42)
%44 = load i32*, i32** %7
%45 = call i32 @putc(i8 signext %43, i32* %44)
%46 = load i32*, i32** %7
%47 = call i32 @putc(i8 signext 34, i32* %46)
%48 = load i32, i32* %3
%49 = load i32, i32* %4
%50 = sub nsw i32 %49, 1
%51 = icmp ne i32 %48, %50
br i1 %51, label %52, label %57
52: ; preds = %27
%53 = load i32*, i32** %7
%54 = call i32 @putc(i8 signext 44, i32* %53)
%55 = load i32*, i32** %6
%56 = call signext i8 @getc(i32* %55)
br label %68
57: ; preds = %27
%58 = load i32*, i32** %7
%59 = call i32 @putc(i8 signext 41, i32* %58)
%60 = load i32, i32* %2
%61 = load i32, i32* %5
%62 = sub nsw i32 %61, 1
%63 = icmp ne i32 %60, %62
br i1 %63, label %64, label %67
64: ; preds = %57
%65 = load i32*, i32** %6
%66 = call signext i8 @getc(i32* %65)
br label %67
67: ; preds = %64, %57
br label %68
68: ; preds = %67, %52
br label %69
69: ; preds = %68
%70 = load i32, i32* %3
%71 = add nsw i32 %70, 1
store i32 %71, i32* %3
br label %23
72: ; preds = %23
%73 = load i32*, i32** %6
%74 = call signext i8 @getc(i32* %73)
%75 = load i32*, i32** %7
%76 = call i32 @putc(i8 signext 41, i32* %75)
%77 = load i32, i32* %2
%78 = load i32, i32* %5
%79 = sub nsw i32 %78, 1
%80 = icmp ne i32 %77, %79
br i1 %80, label %81, label %84
81: ; preds = %72
%82 = load i32*, i32** %7
%83 = call i32 @putc(i8 signext 10, i32* %82)
br label %87
84: ; preds = %72
%85 = load i32*, i32** %7
%86 = call i32 @putc(i8 signext 41, i32* %85)
br label %87
87: ; preds = %84, %81
%88 = load i32*, i32** %7
%89 = call i32 @putc(i8 signext 44, i32* %88)
br label %90
90: ; preds = %87
%91 = load i32, i32* %2
%92 = add nsw i32 %91, 1
store i32 %92, i32* %2
br label %14
93: ; preds = %14
%94 = load i32*, i32** %6
%95 = call i32 @fclose(i32* %94)
%96 = load i32*, i32** %7
%97 = call i32 @fclose(i32* %96)
%98 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%99 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [52 x i8] c"zorg er voor dat in.txt bestaat voor u verder gaat!\00"
@.str.1 = [4 x i8] c"%*c\00"
@.str.2 = [7 x i8] c"in.txt\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [8 x i8] c"uit.txt\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [4 x i8] c"OK!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%5 = tail call i32 @putc(i8 signext 40, i32* %4)
br label %6
6: ; preds = %27, %0
%7 = phi i32 [ 0, %0 ], [ %32, %27 ]
%8 = tail call i32 @putc(i8 signext 9, i32* %4)
%9 = tail call i32 @putc(i8 signext 40, i32* %4)
%10 = icmp eq i32 %7, 4
br label %11
11: ; preds = %33, %6
%12 = phi i32 [ 0, %6 ], [ %36, %33 ]
%13 = tail call signext i8 @getc(i32* %3)
%14 = tail call signext i8 @getc(i32* %3)
%15 = tail call signext i8 @getc(i32* %3)
%16 = tail call i32 @putc(i8 signext 120, i32* %4)
%17 = tail call i32 @putc(i8 signext 34, i32* %4)
%18 = tail call signext i8 @getc(i32* %3)
%19 = tail call i32 @putc(i8 signext %18, i32* %4)
%20 = tail call signext i8 @getc(i32* %3)
%21 = tail call i32 @putc(i8 signext %20, i32* %4)
%22 = tail call i32 @putc(i8 signext 34, i32* %4)
%23 = icmp eq i32 %12, 4
br i1 %23, label %24, label %33
24: ; preds = %11
%25 = tail call i32 @putc(i8 signext 41, i32* %4)
%26 = tail call signext i8 @getc(i32* %3)
br i1 %10, label %37, label %27
27: ; preds = %24
%28 = tail call signext i8 @getc(i32* %3)
%29 = tail call i32 @putc(i8 signext 41, i32* %4)
%30 = tail call i32 @putc(i8 signext 10, i32* %4)
%31 = tail call i32 @putc(i8 signext 44, i32* %4)
%32 = add nuw nsw i32 %7, 1
br label %6
33: ; preds = %11
%34 = tail call i32 @putc(i8 signext 44, i32* %4)
%35 = tail call signext i8 @getc(i32* %3)
%36 = add nuw nsw i32 %12, 1
br label %11
37: ; preds = %24
%38 = tail call i32 @putc(i8 signext 41, i32* %4)
%39 = tail call i32 @putc(i8 signext 41, i32* %4)
%40 = tail call i32 @putc(i8 signext 44, i32* %4)
%41 = tail call i32 @fclose(i32* %3)
%42 = tail call i32 @fclose(i32* %4)
%43 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%44 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}