#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 */

/* Variables and functions */
int /*<<< orphan*/ fail();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int print_header(char *key, char *val) {
  if (key && val) {
    printf("  "
           "%s: %s\n",
           key, val);
  } else if (key || val) {
    fprintf(stderr, "  "
                    "Header contained null field\n");
    printf("  "
           "%s: %s\n",
           key, val);
    fail();
  } else {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<print_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116f <print_header+0x3f>
cmpq   $0x0,-0x18(%rbp)
je     116f <print_header+0x3f>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
jmp    11cb <print_header+0x9b>
cmpq   $0x0,-0x10(%rbp)
jne    1185 <print_header+0x55>
cmpq   $0x0,-0x18(%rbp)
je     11ba <print_header+0x8a>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <fail@plt>
jmp    11c6 <print_header+0x96>
movl   $0x0,-0x4(%rbp)
jmp    11d2 <print_header+0xa2>
jmp    11cb <print_header+0x9b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_header>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
je     1158 <print_header+0x28>
test   %r14,%r14
je     1158 <print_header+0x28>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
jmp    1190 <print_header+0x60>
xor    %eax,%eax
mov    %rbx,%rcx
or     %r14,%rcx
je     1195 <print_header+0x65>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <fail@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c" %s: %s\0A\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c" Header contained null field\0A\00"
define i32 @print_header(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
br label %30
15: ; preds = %8, %2
%16 = load i8*, i8** %4
%17 = icmp ne i8* %16, null
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i8*, i8** %5
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %28
21: ; preds = %18, %15
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8*, i8** %4
%25 = load i8*, i8** %5
%26 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %25)
%27 = call i32 (...) @fail()
br label %29
28: ; preds = %18
store i32 0, i32* %3
br label %31
29: ; preds = %21
br label %30
30: ; preds = %29, %11
store i32 1, i32* %3
br label %31
31: ; preds = %30, %28
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [10 x i8] c" %s: %s\0A\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c" Header contained null field\0A\00"
define i32 @print_header(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %15
8: ; preds = %2
%9 = or i1 %3, %4
br i1 %9, label %10, label %15
10: ; preds = %8
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%14 = tail call i32 (...) @fail()
br label %15
15: ; preds = %6, %10, %8
%16 = phi i32 [ 0, %8 ], [ 1, %10 ], [ 1, %6 ]
ret i32 %16
}