#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char const *, char *);
int finished(const char *cmd, int status) {
  if (!strcmp(cmd, "not"))
    return !status;
  if (!strcmp(cmd, "should")) {
    if (status)
      fprintf(stderr, "TEST WARNING: Ignoring command failure.\n");
    return 0;
  }
  return 6;
}


x86 assembly (clang, -O0):
<finished>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115e <finished+0x3e>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a9 <finished+0x89>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a2 <finished+0x82>
cmpl   $0x0,-0x14(%rbp)
je     1196 <finished+0x76>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <finished+0x89>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finished>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     116d <finished+0x4d>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0x6,%ebx
test   %eax,%eax
jne    1174 <finished+0x54>
xor    %ebx,%ebx
test   %ebp,%ebp
je     1174 <finished+0x54>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1174 <finished+0x54>
xor    %ebx,%ebx
test   %ebp,%ebp
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"not\00"
@.str.1 = [7 x i8] c"should\00"
@stderr = global i32 0
@.str.2 = [41 x i8] c"TEST WARNING: Ignoring command failure.\0A\00"
define i32 @finished(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
store i32 %13, i32* %3
br label %26
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %25, label %18
18: ; preds = %14
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %21, %18
store i32 0, i32* %3
br label %26
25: ; preds = %14
store i32 6, i32* %3
br label %26
26: ; preds = %25, %24, %9
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"not\00"
@.str.1 = [7 x i8] c"should\00"
@stderr = global i32 0
@.str.2 = [41 x i8] c"TEST WARNING: Ignoring command failure.\0A\00"
define i32 @finished(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = icmp eq i32 %1, 0
%7 = zext i1 %6 to i32
br label %16
8: ; preds = %2
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = icmp eq i32 %1, 0
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %8, %11, %13, %5
%17 = phi i32 [ %7, %5 ], [ 0, %13 ], [ 0, %11 ], [ 6, %8 ]
ret i32 %17
}