#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*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, char *,
                           char *, char *, ...);
int /*<<< orphan*/ t_error(char *);
void write_turtle(FILE *outputfile, char *creator, char *inputs) {
  if (outputfile == NULL) {
    t_error("An attempt was made towrite on a not opened file");
  } else if (inputs == NULL && creator == NULL) {
    fprintf(outputfile, "%3s %21s created on %s at %s %2s \n", "/**",
            "This_is_a_turtle_file", "Mar 15 2022", "23:24:58", "*/");
  } else if (inputs == NULL) {
    fprintf(outputfile, "%3s %21s created on %s at %s by %s %2s\n", "/**",
            "This_is_a_turtle_file", "Mar 15 2022", "23:24:58", creator, "*/");
  } else if (creator == NULL) {
    fprintf(outputfile,
            "%3s %21s created on %s at %s\n inputs processed: %s %2s\n", "/**",
            "This_is_a_turtle_file", "Mar 15 2022", "23:24:58", inputs, "*/");
  } else {
    fprintf(outputfile,
            "%3s %21s created on %s at %s  by %s \n inputs processed :%s %s\n",
            "/**", "This_is_a_turtle_file", "Mar 15 2022", "23:24:58", creator,
            inputs, "*/");
  }
}


x86 assembly (clang, -O0):
<write_turtle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1150 <write_turtle+0x30>
lea    0xeba(%rip),%rdi
call   1040 <t_error@plt>
jmp    12a2 <write_turtle+0x182>
cmpq   $0x0,-0x18(%rbp)
jne    11a4 <write_turtle+0x84>
cmpq   $0x0,-0x10(%rbp)
jne    11a4 <write_turtle+0x84>
mov    -0x8(%rbp),%rdi
lea    0xec0(%rip),%rsi
lea    0xedc(%rip),%rdx
lea    0xed9(%rip),%rcx
lea    0xee8(%rip),%r8
lea    0xeed(%rip),%r9
lea    0xeef(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    129d <write_turtle+0x17d>
cmpq   $0x0,-0x18(%rbp)
jne    11f6 <write_turtle+0xd6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%r10
lea    0xec8(%rip),%rsi
lea    0xe8f(%rip),%rdx
lea    0xe8c(%rip),%rcx
lea    0xe9b(%rip),%r8
lea    0xea0(%rip),%r9
lea    0xea2(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1298 <write_turtle+0x178>
cmpq   $0x0,-0x10(%rbp)
jne    1248 <write_turtle+0x128>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%r10
lea    0xe9e(%rip),%rsi
lea    0xe3d(%rip),%rdx
lea    0xe3a(%rip),%rcx
lea    0xe49(%rip),%r8
lea    0xe4e(%rip),%r9
lea    0xe50(%rip),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1293 <write_turtle+0x173>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%r11
mov    -0x18(%rbp),%r10
lea    0xe8b(%rip),%rsi
lea    0xdf2(%rip),%rdx
lea    0xdef(%rip),%rcx
lea    0xdfe(%rip),%r8
lea    0xe03(%rip),%r9
lea    0xe05(%rip),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1298 <write_turtle+0x178>
jmp    129d <write_turtle+0x17d>
jmp    12a2 <write_turtle+0x182>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_turtle>:
push   %rbx
test   %rdi,%rdi
je     1169 <write_turtle+0x49>
mov    %rdx,%r11
mov    %rsi,%r10
mov    %rsi,%rax
or     %rdx,%rax
jne    1176 <write_turtle+0x56>
sub    $0x8,%rsp
lea    0xf44(%rip),%r10
lea    0xeeb(%rip),%rsi
lea    0xf07(%rip),%rdx
lea    0xf04(%rip),%rcx
lea    0xf13(%rip),%r8
lea    0xf18(%rip),%r9
xor    %eax,%eax
jmp    11ee <write_turtle+0xce>
lea    0xe90(%rip),%rdi
pop    %rbx
jmp    1040 <t_error@plt>
test   %r11,%r11
je     11c0 <write_turtle+0xa0>
test   %r10,%r10
je     11fb <write_turtle+0xdb>
sub    $0x8,%rsp
lea    0xef8(%rip),%rbx
lea    0xf54(%rip),%rsi
lea    0xebb(%rip),%rdx
lea    0xeb8(%rip),%rcx
lea    0xec7(%rip),%r8
lea    0xecc(%rip),%r9
xor    %eax,%eax
push   %rbx
push   %r11
push   %r10
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbx
ret
lea    0xebc(%rip),%r11
lea    0xeb8(%rip),%rsi
lea    0xe7f(%rip),%rdx
lea    0xe7c(%rip),%rcx
lea    0xe8b(%rip),%r8
lea    0xe90(%rip),%r9
xor    %eax,%eax
push   %r11
push   %r10
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe81(%rip),%r10
lea    0xea5(%rip),%rsi
lea    0xe44(%rip),%rdx
lea    0xe41(%rip),%rcx
lea    0xe50(%rip),%r8
lea    0xe55(%rip),%r9
xor    %eax,%eax
push   %r10
push   %r11
jmp    11f0 <write_turtle+0xd0>

LLVM IR (-O0):
@.str = [49 x i8] c"An attempt was made towrite on a not opened file\00"
@.str.1 = [35 x i8] c"%3s %21s created on %s at %s %2s \0A\00"
@.str.2 = [4 x i8] c"/**\00"
@.str.3 = [22 x i8] c"This_is_a_turtle_file\00"
@.str.4 = [12 x i8] c"Mar 15 2022\00"
@.str.5 = [9 x i8] c"23:24:58\00"
@.str.6 = [3 x i8] c"*/\00"
@.str.7 = [40 x i8] c"%3s %21s created on %s at %s by %s %2s\0A\00"
@.str.8 = [56 x i8] c"%3s %21s created on %s at %s\0A inputs processed: %s %2s\0A\00"
@.str.9 = [63 x i8] c"%3s %21s created on %s at %s by %s \0A inputs processed :%s %s\0A\00"
define void @write_turtle(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @t_error(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %42
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i8*, i8** %5
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32*, i32** %4
%19 = call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %41
20: ; preds = %14, %11
%21 = load i8*, i8** %6
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32*, i32** %4
%25 = load i8*, i8** %5
%26 = call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %40
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32*, i32** %4
%32 = load i8*, i8** %6
%33 = call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %39
34: ; preds = %27
%35 = load i32*, i32** %4
%36 = load i8*, i8** %5
%37 = load i8*, i8** %6
%38 = call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %36, i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %39
39: ; preds = %34, %30
br label %40
40: ; preds = %39, %23
br label %41
41: ; preds = %40, %17
br label %42
42: ; preds = %41, %9
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"An attempt was made towrite on a not opened file\00"
@.str.1 = [35 x i8] c"%3s %21s created on %s at %s %2s \0A\00"
@.str.2 = [4 x i8] c"/**\00"
@.str.3 = [22 x i8] c"This_is_a_turtle_file\00"
@.str.4 = [12 x i8] c"Mar 15 2022\00"
@.str.5 = [9 x i8] c"23:24:58\00"
@.str.6 = [3 x i8] c"*/\00"
@.str.7 = [40 x i8] c"%3s %21s created on %s at %s by %s %2s\0A\00"
@.str.8 = [56 x i8] c"%3s %21s created on %s at %s\0A inputs processed: %s %2s\0A\00"
@.str.9 = [63 x i8] c"%3s %21s created on %s at %s by %s \0A inputs processed :%s %s\0A\00"
define void @write_turtle(i32* %0, i8* %1, i8* %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @t_error(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %21
7: ; preds = %3
%8 = icmp eq i8* %2, null
%9 = icmp eq i8* %1, null
%10 = and i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %21
13: ; preds = %7
br i1 %8, label %14, label %16
14: ; preds = %13
%15 = tail call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %21
16: ; preds = %13
br i1 %9, label %17, label %19
17: ; preds = %16
%18 = tail call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %21
19: ; preds = %16
%20 = tail call i32 (i32*, i8*, i8*, i8*, i8*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %1, i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %11, %17, %19, %14, %5
ret void
}