#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void init_tag() {
  FILE *motd = NULL;
  char buf[256];
  motd = fopen("../files/bulot410.ansi", "r");
  if (motd != NULL) {
    while (fgets(buf, 256, motd) != NULL) {
      printf("%s", buf);
    }
    fclose(motd);
  } else {
    printf("\n-------------------------------------------------\n");
    printf("\tWelcome to bulOt-shell version 0.0\n");
    printf("\n-------------------------------------------------\n");
  }
}


x86 assembly (clang, -O0):
<init_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movq   $0x0,-0x8(%rbp)
lea    0xea6(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11c1 <init_tag+0x81>
jmp    117a <init_tag+0x3a>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x100,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11b3 <init_tag+0x73>
lea    -0x110(%rbp),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117a <init_tag+0x3a>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11eb <init_tag+0xab>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_tag>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xe9d(%rip),%rdi
lea    0xead(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11d7 <init_tag+0x87>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11c2 <init_tag+0x72>
lea    0xe86(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
jne    11a0 <init_tag+0x50>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe62(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"../files/bulot410.ansi\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [52 x i8] c"\0A-------------------------------------------------\0A\00"
@.str.4 = [37 x i8] c"\09Welcome to bulOt-shell version 0.0\0A\00"
define void @init_tag() {
%1 = alloca i32*
%2 = alloca [256 x i8]
store i32* null, i32** %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %18
6: ; preds = %0
br label %7
7: ; preds = %12, %6
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%9 = load i32*, i32** %1
%10 = call i32* @fgets(i8* %8, i32 256, i32* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %7
15: ; preds = %7
%16 = load i32*, i32** %1
%17 = call i32 @fclose(i32* %16)
br label %22
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %18, %15
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"../files/bulot410.ansi\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@str.5 = [36 x i8] c"\09Welcome to bulOt-shell version 0.0\00"
@str.6 = [51 x i8] c"\0A-------------------------------------------------\00"
define void @init_tag() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %14, label %5
5: ; preds = %0
%6 = call i32* @fgets(i8* %2, i32 256, i32* %3)
%7 = icmp eq i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %5, %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%10 = call i32* @fgets(i8* %2, i32 256, i32* %3)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %8
12: ; preds = %8, %5
%13 = call i32 @fclose(i32* %3)
br label %18
14: ; preds = %0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.6, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.5, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.6, i64 0, i64 0))
br label %18
18: ; preds = %14, %12
ret void
}