#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*/ ksft_print_cnts();
int /*<<< orphan*/ ksft_test_result_error(char *, char const *);
int /*<<< orphan*/ ksft_test_result_fail(char *, char const *);
int /*<<< orphan*/ ksft_test_result_pass(char *, char const *);
void print_result(const char *test_name, int ret) {
  switch (ret) {
  case 0:
    ksft_test_result_pass("%s\n", test_name);
    ksft_print_cnts();
    return;
  case -1:
    ksft_test_result_error("%s\n", test_name);
    ksft_print_cnts();
    return;
  case -2:
    ksft_test_result_fail("%s\n", test_name);
    ksft_print_cnts();
    return;
  }
}


x86 assembly (clang, -O0):
<print_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xfffffffe,%eax
je     11bc <print_result+0x7c>
jmp    1163 <print_result+0x23>
mov    -0x10(%rbp),%eax
sub    $0xffffffff,%eax
je     11a0 <print_result+0x60>
jmp    1174 <print_result+0x34>
mov    -0x10(%rbp),%eax
test   %eax,%eax
jne    11d3 <print_result+0x93>
jmp    1184 <print_result+0x44>
mov    -0x8(%rbp),%rsi
lea    0xe71(%rip),%rdi
call   1030 <ksft_test_result_pass@plt>
mov    $0x0,%al
call   1060 <ksft_print_cnts@plt>
jmp    11d3 <print_result+0x93>
mov    -0x8(%rbp),%rsi
lea    0xe55(%rip),%rdi
call   1040 <ksft_test_result_error@plt>
mov    $0x0,%al
call   1060 <ksft_print_cnts@plt>
jmp    11d3 <print_result+0x93>
mov    -0x8(%rbp),%rsi
lea    0xe39(%rip),%rdi
call   1050 <ksft_test_result_fail@plt>
mov    $0x0,%al
call   1060 <ksft_print_cnts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_result>:
push   %rax
mov    %rdi,%rax
cmp    $0xfffffffe,%esi
je     1163 <print_result+0x23>
cmp    $0xffffffff,%esi
je     1174 <print_result+0x34>
test   %esi,%esi
jne    118b <print_result+0x4b>
lea    0xea7(%rip),%rdi
mov    %rax,%rsi
call   1030 <ksft_test_result_pass@plt>
jmp    1183 <print_result+0x43>
lea    0xe96(%rip),%rdi
mov    %rax,%rsi
call   1050 <ksft_test_result_fail@plt>
jmp    1183 <print_result+0x43>
lea    0xe85(%rip),%rdi
mov    %rax,%rsi
call   1040 <ksft_test_result_error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <ksft_print_cnts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @print_result(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
switch i32 %5, label %18 [
i32 0, label %6
i32 -1, label %10
i32 -2, label %14
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @ksft_test_result_pass(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 (...) @ksft_print_cnts()
br label %18
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @ksft_test_result_error(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 (...) @ksft_print_cnts()
br label %18
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = call i32 @ksft_test_result_fail(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 (...) @ksft_print_cnts()
br label %18
18: ; preds = %6, %10, %14, %2
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print_result(i8* %0, i32 %1) {
switch i32 %1, label %11 [
i32 0, label %3
i32 -1, label %5
i32 -2, label %7
]
3: ; preds = %2
%4 = tail call i32 @ksft_test_result_pass(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
5: ; preds = %2
%6 = tail call i32 @ksft_test_result_error(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
7: ; preds = %2
%8 = tail call i32 @ksft_test_result_fail(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %5, %3
%10 = tail call i32 (...) @ksft_print_cnts()
br label %11
11: ; preds = %9, %2
ret void
}