#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*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int check_result(char name[], char actual[], char expect[]) {
  if (actual == 0 || expect == 0) {
    printf("\nERROR: %s\n", name);
    printf("    Test parameters missing.\n");
    printf("    Missing a comma?\n");
    return 1;
  }
  if (strcmp(actual, expect) != 0) {
    printf("\nFAIL: %s\n", name);
    printf("    Expected: %s\n", expect);
    printf("    Got:      %s\n", actual);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <check_result+0x2a>
cmpq   $0x0,-0x20(%rbp)
jne    1184 <check_result+0x64>
mov    -0x10(%rbp),%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e4 <check_result+0xc4>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11dd <check_result+0xbd>
mov    -0x10(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e4 <check_result+0xc4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_result>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
test   %rsi,%rsi
je     118d <check_result+0x5d>
mov    %rdx,%rbx
test   %rdx,%rdx
je     118d <check_result+0x5d>
mov    %rsi,%r14
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c1 <check_result+0x91>
lea    0xead(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11b6 <check_result+0x86>
lea    0xe6c(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
jmp    11bb <check_result+0x8b>

LLVM IR (-O0):
@.str = [12 x i8] c"\0AERROR: %s\0A\00"
@.str.1 = [30 x i8] c" Test parameters missing.\0A\00"
@.str.2 = [22 x i8] c" Missing a comma?\0A\00"
@.str.3 = [11 x i8] c"\0AFAIL: %s\0A\00"
@.str.4 = [18 x i8] c" Expected: %s\0A\00"
@.str.5 = [18 x i8] c" Got: %s\0A\00"
define i32 @check_result(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %6
%9 = icmp eq i8* %8, null
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %10, %3
%14 = load i8*, i8** %5
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %31
18: ; preds = %10
%19 = load i8*, i8** %6
%20 = load i8*, i8** %7
%21 = call i64 @strcmp(i8* %19, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = load i8*, i8** %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %24)
%26 = load i8*, i8** %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %28)
store i32 1, i32* %4
br label %31
30: ; preds = %18
store i32 0, i32* %4
br label %31
31: ; preds = %30, %23, %13
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
@.str = [12 x i8] c"\0AERROR: %s\0A\00"
@.str.3 = [11 x i8] c"\0AFAIL: %s\0A\00"
@.str.4 = [18 x i8] c" Expected: %s\0A\00"
@.str.5 = [18 x i8] c" Got: %s\0A\00"
@str = [29 x i8] c" Test parameters missing.\00"
@str.6 = [21 x i8] c" Missing a comma?\00"
define i32 @check_result(i8* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %1, null
%5 = icmp eq i8* %2, null
%6 = or i1 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
br label %18
11: ; preds = %3
%12 = tail call i64 @strcmp(i8* %1, i8* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %1)
br label %18
18: ; preds = %11, %14, %7
%19 = phi i32 [ 1, %7 ], [ 1, %14 ], [ 0, %11 ]
ret i32 %19
}