#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 *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strlen(char *);
void bail(char *msg, int status) {
  extern FILE *Output_File;
  void exit(int);
  if (msg != NULL && (int)strlen(msg) > 0) {
    printf("%s\n", msg);
    if (Output_File != NULL) {
      fprintf(Output_File, "%s\n", msg);
    }
  }
  exit(status);
}


x86 assembly (clang, -O0):
<bail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ac <bail+0x6c>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jle    11ac <bail+0x6c>
mov    -0x8(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e65(%rip),%rax
cmpq   $0x0,(%rax)
je     11a7 <bail+0x67>
mov    0x2e54(%rip),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe5e(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11ac <bail+0x6c>
mov    -0xc(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<bail>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
test   %rdi,%rdi
je     1183 <bail+0x43>
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    1183 <bail+0x43>
lea    0xea3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     1183 <bail+0x43>
lea    0xe85(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
mov    %ebp,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@Output_File = external global i32*
define void @bail(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %22
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = trunc i64 %9 to i32
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32*, i32** @Output_File
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32*, i32** @Output_File
%19 = load i8*, i8** %3
%20 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %17, %12
br label %22
22: ; preds = %21, %7, %2
%23 = load i32, i32* %4
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@Output_File = external global i32*
define void @bail(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %14, label %4
4: ; preds = %2
%5 = tail call i64 @strlen(i8* %0)
%6 = trunc i64 %5 to i32
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%10 = load i32*, i32** @Output_File
%11 = icmp eq i32* %10, null
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %14
14: ; preds = %8, %12, %4, %2
tail call void @exit(i32 %1)
unreachable
}