#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 */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int testFail(int argc, char *argv[]) {
  char *env = getenv("DASHBOARD_TEST_FROM_CTEST");
  int oldCtest = 0;
  if (env) {
    if (strcmp(env, "1") == 0) {
      oldCtest = 1;
    }
    printf("DASHBOARD_TEST_FROM_CTEST = %s\n", env);
  }
  printf("%s: This test intentionally fails\n", argv[0]);
  if (oldCtest) {
    printf("The version of ctest is not able to handle intentionally failing "
           "tests, so pass.\n");
    return 0;
  }
  return argc;
}


x86 assembly (clang, -O0):
<testFail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1194 <testFail+0x64>
mov    -0x18(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1182 <testFail+0x52>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     11cd <testFail+0x9d>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <testFail+0xa3>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testFail>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
lea    0xeac(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1189 <testFail+0x49>
mov    %rax,%rbp
lea    0xeb2(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
test   %rbx,%rbx
je     119c <testFail+0x5c>
mov    (%r15),%rsi
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11bc <testFail+0x7c>
mov    (%r15),%rsi
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"DASHBOARD_TEST_FROM_CTEST\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [32 x i8] c"DASHBOARD_TEST_FROM_CTEST = %s\0A\00"
@.str.3 = [35 x i8] c"%s: This test intentionally fails\0A\00"
@.str.4 = [82 x i8] c"The version of ctest is not able to handle intentionally failing tests, so pass.\0A\00"
define i32 @testFail(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i8* @getenv(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %6
store i32 0, i32* %7
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %7
br label %16
16: ; preds = %15, %11
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %30
28: ; preds = %19
%29 = load i32, i32* %4
store i32 %29, i32* %3
br label %30
30: ; preds = %28, %26
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [26 x i8] c"DASHBOARD_TEST_FROM_CTEST\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [32 x i8] c"DASHBOARD_TEST_FROM_CTEST = %s\0A\00"
@.str.3 = [35 x i8] c"%s: This test intentionally fails\0A\00"
@str = [81 x i8] c"The version of ctest is not able to handle intentionally failing tests, so pass.\00"
define i32 @testFail(i32 %0, i8** nocapture %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br i1 %7, label %12, label %9
9: ; preds = %5, %2
%10 = load i8*, i8** %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %16
12: ; preds = %5
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0))
br label %16
16: ; preds = %9, %12
%17 = phi i32 [ 0, %12 ], [ %0, %9 ]
ret i32 %17
}