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

/* Variables and functions */
int /*<<< orphan*/ safe_printf(char *, ...);
int /*<<< orphan*/ safe_vprintf(char const *, int /*<<< orphan*/);
void print_tap_result(const char *result_str, unsigned long testnum,
                      const char *msg, va_list ap) {
  safe_printf("%s %lu", result_str, testnum);
  if (!msg) {
    return;
  }
  safe_printf(" - ");
  safe_vprintf(msg, ap);
}


x86 assembly (clang, -O0):
<print_tap_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <safe_printf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    115d <print_tap_result+0x3d>
jmp    1177 <print_tap_result+0x57>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <safe_printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <safe_vprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tap_result>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <safe_printf@plt>
test   %rbx,%rbx
je     115f <print_tap_result+0x3f>
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <safe_printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <safe_vprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s %lu\00"
@.str.1 = [4 x i8] c" - \00"
define void @print_tap_result(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 (i8*, ...) @safe_printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i64 %10)
%12 = load i8*, i8** %7
%13 = icmp ne i8* %12, null
br i1 %13, label %15, label %14
14: ; preds = %4
br label %20
15: ; preds = %4
%16 = call i32 (i8*, ...) @safe_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 @safe_vprintf(i8* %17, i32 %18)
br label %20
20: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s %lu\00"
@.str.1 = [4 x i8] c" - \00"
define void @print_tap_result(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i32 (i8*, ...) @safe_printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1)
%6 = icmp eq i8* %2, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @safe_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @safe_vprintf(i8* %2, i32 %3)
br label %10
10: ; preds = %4, %7
ret void
}