#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
void complete_js(FILE *js, char fin[]) {
  puts("\n aan de vervollediging...\n");
  FILE *in = fopen(fin, "r");
  fputs("//@ EINDE toegevoegde regels\n", js);
  char x;
  while (x = fgetc(in), x != '@')
    ;
  while (x = fgetc(in), x != '\n')
    ;
  while (x = fgetc(in), x != EOF)
    fputc(x, js);
  fclose(in);
}


x86 assembly (clang, -O0):
<complete_js>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1050 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x40,%eax
je     11be <complete_js+0x5e>
jmp    11a0 <complete_js+0x40>
jmp    11c3 <complete_js+0x63>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
je     11e1 <complete_js+0x81>
jmp    11c3 <complete_js+0x63>
jmp    11e6 <complete_js+0x86>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    0x2deb(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     121c <complete_js+0xbc>
mov    -0x19(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1070 <fputc@plt>
jmp    11e6 <complete_js+0x86>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<complete_js>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xe8e(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0x40,%al
jne    11b0 <complete_js+0x50>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0xa,%al
jne    11c0 <complete_js+0x60>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
mov    0x2e0d(%rip),%r15
cmp    (%r15),%al
je     11f8 <complete_js+0x98>
movsbl %al,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    (%r15),%al
jne    11e0 <complete_js+0x80>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"\0A aan de vervollediging...\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [30 x i8] c"//@ EINDE toegevoegde regels\0A\00"
@EOF = global i8 0
define void @complete_js(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %9, i32** %5
%10 = load i32*, i32** %3
%11 = call i32 @fputs(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32* %10)
br label %12
12: ; preds = %18, %2
%13 = load i32*, i32** %5
%14 = call signext i8 @fgetc(i32* %13)
store i8 %14, i8* %6
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 64
br i1 %17, label %18, label %19
18: ; preds = %12
br label %12
19: ; preds = %12
br label %20
20: ; preds = %26, %19
%21 = load i32*, i32** %5
%22 = call signext i8 @fgetc(i32* %21)
store i8 %22, i8* %6
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 10
br i1 %25, label %26, label %27
26: ; preds = %20
br label %20
27: ; preds = %20
br label %28
28: ; preds = %36, %27
%29 = load i32*, i32** %5
%30 = call signext i8 @fgetc(i32* %29)
store i8 %30, i8* %6
%31 = load i8, i8* %6
%32 = sext i8 %31 to i32
%33 = load i8, i8* @EOF
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %32, %34
br i1 %35, label %36, label %40
36: ; preds = %28
%37 = load i8, i8* %6
%38 = load i32*, i32** %3
%39 = call i32 @fputc(i8 signext %37, i32* %38)
br label %28
40: ; preds = %28
%41 = load i32*, i32** %5
%42 = call i32 @fclose(i32* %41)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"\0A aan de vervollediging...\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [30 x i8] c"//@ EINDE toegevoegde regels\0A\00"
@EOF = global i8 0
define void @complete_js(i32* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 29, i64 1, i32* %0)
br label %6
6: ; preds = %6, %2
%7 = tail call signext i8 @fgetc(i32* %4)
%8 = icmp eq i8 %7, 64
br i1 %8, label %9, label %6
9: ; preds = %6, %9
%10 = tail call signext i8 @fgetc(i32* %4)
%11 = icmp eq i8 %10, 10
br i1 %11, label %12, label %9
12: ; preds = %9
%13 = tail call signext i8 @fgetc(i32* %4)
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %22, label %16
16: ; preds = %12, %16
%17 = phi i8 [ %19, %16 ], [ %13, %12 ]
%18 = tail call i32 @fputc(i8 signext %17, i32* %0)
%19 = tail call signext i8 @fgetc(i32* %4)
%20 = load i8, i8* @EOF
%21 = icmp eq i8 %19, %20
br i1 %21, label %22, label %16
22: ; preds = %16, %12
%23 = tail call i32 @fclose(i32* %4)
ret void
}