#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 scalar_t__ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ oerr();
int strlen(char const *);
scalar_t__ write(int /*<<< orphan*/, char const *, int);
void printfn(const char *fn, int print_nl) {
  if (print_nl)
    do {
      if (write(STDOUT_FILENO, "\n", 1) != (ssize_t)1)
        oerr();
    } while (0);
  do {
    if (write(STDOUT_FILENO, "==> ", 4) != (ssize_t)4)
      oerr();
  } while (0);
  do {
    if (write(STDOUT_FILENO, fn, strlen(fn)) != (ssize_t)strlen(fn))
      oerr();
  } while (0);
  do {
    if (write(STDOUT_FILENO, " <==\n", 5) != (ssize_t)5)
      oerr();
  } while (0);
}


x86 assembly (clang, -O0):
<printfn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1183 <printfn+0x53>
jmp    114e <printfn+0x1e>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%rax
je     1179 <printfn+0x49>
mov    $0x0,%al
call   1050 <oerr@plt>
jmp    117e <printfn+0x4e>
jmp    1183 <printfn+0x53>
jmp    1188 <printfn+0x58>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%rax
je     11b3 <printfn+0x83>
mov    $0x0,%al
call   1050 <oerr@plt>
jmp    11b8 <printfn+0x88>
jmp    11bd <printfn+0x8d>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
je     120e <printfn+0xde>
mov    $0x0,%al
call   1050 <oerr@plt>
jmp    1213 <printfn+0xe3>
jmp    1218 <printfn+0xe8>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    0xddd(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
cmp    $0x5,%rax
je     1243 <printfn+0x113>
mov    $0x0,%al
call   1050 <oerr@plt>
jmp    1248 <printfn+0x118>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printfn>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
test   %esi,%esi
je     1162 <printfn+0x32>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%rax
je     1162 <printfn+0x32>
xor    %eax,%eax
call   1050 <oerr@plt>
mov    0x2e87(%rip),%r14
mov    (%r14),%edi
lea    0xe8d(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%rax
je     118a <printfn+0x5a>
xor    %eax,%eax
call   1050 <oerr@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
je     11ba <printfn+0x8a>
xor    %eax,%eax
call   1050 <oerr@plt>
mov    (%r14),%edi
lea    0xe41(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
cmp    $0x5,%rax
jne    11d9 <printfn+0xa9>
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <oerr@plt>

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"==> \00"
@.str.2 = [6 x i8] c" <==\0A\00"
define void @printfn(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %2
br label %8
8: ; preds = %7
%9 = load i32, i32* @STDOUT_FILENO
%10 = call i64 @write(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%11 = icmp ne i64 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (...) @oerr()
br label %14
14: ; preds = %12, %8
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15, %2
br label %17
17: ; preds = %16
%18 = load i32, i32* @STDOUT_FILENO
%19 = call i64 @write(i32 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%20 = icmp ne i64 %19, 4
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 (...) @oerr()
br label %23
23: ; preds = %21, %17
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
%26 = load i32, i32* @STDOUT_FILENO
%27 = load i8*, i8** %3
%28 = load i8*, i8** %3
%29 = call i32 @strlen(i8* %28)
%30 = call i64 @write(i32 %26, i8* %27, i32 %29)
%31 = load i8*, i8** %3
%32 = call i32 @strlen(i8* %31)
%33 = sext i32 %32 to i64
%34 = icmp ne i64 %30, %33
br i1 %34, label %35, label %37
35: ; preds = %25
%36 = call i32 (...) @oerr()
br label %37
37: ; preds = %35, %25
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38
%40 = load i32, i32* @STDOUT_FILENO
%41 = call i64 @write(i32 %40, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%42 = icmp ne i64 %41, 5
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 (...) @oerr()
br label %45
45: ; preds = %43, %39
br label %46
46: ; preds = %45
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"==> \00"
@.str.2 = [6 x i8] c" <==\0A\00"
define void @printfn(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @STDOUT_FILENO
%6 = tail call i64 @write(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = icmp eq i64 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 (...) @oerr()
br label %10
10: ; preds = %2, %4, %8
%11 = load i32, i32* @STDOUT_FILENO
%12 = tail call i64 @write(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%13 = icmp eq i64 %12, 4
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = tail call i32 (...) @oerr()
br label %16
16: ; preds = %14, %10
%17 = load i32, i32* @STDOUT_FILENO
%18 = tail call i32 @strlen(i8* %0)
%19 = tail call i64 @write(i32 %17, i8* %0, i32 %18)
%20 = tail call i32 @strlen(i8* %0)
%21 = sext i32 %20 to i64
%22 = icmp eq i64 %19, %21
br i1 %22, label %25, label %23
23: ; preds = %16
%24 = tail call i32 (...) @oerr()
br label %25
25: ; preds = %23, %16
%26 = load i32, i32* @STDOUT_FILENO
%27 = tail call i64 @write(i32 %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%28 = icmp eq i64 %27, 5
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = tail call i32 (...) @oerr()
br label %31
31: ; preds = %25, %29
ret void
}