#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*/ dm_FailVariation();
int /*<<< orphan*/ dm_LogPrintf(int, char *, char *, int, ...);
int /*<<< orphan*/ dm_PassVariation();
int /*<<< orphan*/ errno;
void dm_EndVariation_SuccessExpected(char *funcname, int expectedRC,
                                     int actualRC) {
  if (actualRC == expectedRC) {
    dm_LogPrintf(3, "%s passed with expected rc = %d\n", funcname, expectedRC);
    dm_PassVariation();
  } else {
    dm_LogPrintf(1, "%s failed with unexpected rc = %d (errno = %d)\n",
                 funcname, actualRC, errno);
    dm_FailVariation();
  }
}


x86 assembly (clang, -O0):
<dm_EndVariation_SuccessExpected>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1174 <dm_EndVariation_SuccessExpected+0x44>
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x3,%edi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <dm_LogPrintf@plt>
mov    $0x0,%al
call   1050 <dm_PassVariation@plt>
jmp    119f <dm_EndVariation_SuccessExpected+0x6f>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    0x2e5e(%rip),%rax
mov    (%rax),%r8d
mov    $0x1,%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1030 <dm_LogPrintf@plt>
mov    $0x0,%al
call   1040 <dm_FailVariation@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dm_EndVariation_SuccessExpected>:
push   %rax
mov    %edx,%ecx
mov    %rdi,%rdx
cmp    %esi,%ecx
jne    1155 <dm_EndVariation_SuccessExpected+0x25>
lea    0xebf(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <dm_LogPrintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <dm_PassVariation@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%r8d
lea    0xebb(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <dm_LogPrintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <dm_FailVariation@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"%s passed with expected rc = %d\0A\00"
@.str.1 = [48 x i8] c"%s failed with unexpected rc = %d (errno = %d)\0A\00"
@errno = global i32 0
define void @dm_EndVariation_SuccessExpected(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %5
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i32, i32* %5
%13 = call i32 (i32, i8*, i8*, i32, ...) @dm_LogPrintf(i32 3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12)
%14 = call i32 (...) @dm_PassVariation()
br label %21
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = load i32, i32* %6
%18 = load i32, i32* @errno
%19 = call i32 (i32, i8*, i8*, i32, ...) @dm_LogPrintf(i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32 %17, i32 %18)
%20 = call i32 (...) @dm_FailVariation()
br label %21
21: ; preds = %15, %10
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"%s passed with expected rc = %d\0A\00"
@.str.1 = [48 x i8] c"%s failed with unexpected rc = %d (errno = %d)\0A\00"
@errno = global i32 0
define void @dm_EndVariation_SuccessExpected(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, %1
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 (i32, i8*, i8*, i32, ...) @dm_LogPrintf(i32 3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2)
%7 = tail call i32 (...) @dm_PassVariation()
br label %12
8: ; preds = %3
%9 = load i32, i32* @errno
%10 = tail call i32 (i32, i8*, i8*, i32, ...) @dm_LogPrintf(i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %2, i32 %9)
%11 = tail call i32 (...) @dm_FailVariation()
br label %12
12: ; preds = %8, %5
ret void
}