#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;
void use_result(int test_failures, char *testname, int *failures) {
  *failures += test_failures;
  if (test_failures == 0) {
    fprintf(stderr, "Passed: %s\n", testname);
  } else {
    fprintf(stderr, "FAILED: %s\n", testname);
    fprintf(stderr, "        %d errors.\n", test_failures);
  }
}


x86 assembly (clang, -O0):
<use_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
cmpl   $0x0,-0x4(%rbp)
jne    1158 <use_result+0x48>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    118d <use_result+0x7d>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_result>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
add    %edi,(%rdx)
mov    %rsi,%rdx
mov    0x2ebe(%rip),%r14
mov    (%r14),%edi
test   %ebx,%ebx
je     1151 <use_result+0x41>
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xed7(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>
lea    0xea8(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"Passed: %s\0A\00"
@.str.1 = [12 x i8] c"FAILED: %s\0A\00"
@.str.2 = [20 x i8] c" %d errors.\0A\00"
define void @use_result(i32 %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %6
%9 = load i32, i32* %8
%10 = add nsw i32 %9, %7
store i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %5
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %24
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %5
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @stderr
%22 = load i32, i32* %4
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %17, %13
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"Passed: %s\0A\00"
@.str.1 = [12 x i8] c"FAILED: %s\0A\00"
@.str.2 = [20 x i8] c" %d errors.\0A\00"
define void @use_result(i32 %0, i8* %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = add nsw i32 %4, %0
store i32 %5, i32* %2
%6 = icmp eq i32 %0, 0
%7 = load i32, i32* @stderr
br i1 %6, label %8, label %10
8: ; preds = %3
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %14
10: ; preds = %3
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %14
14: ; preds = %10, %8
ret void
}