#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 */
scalar_t__ isten(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int passT1 = 0;
  int passT2 = 0;
  int t1 = 10;
  int t2 = 12;
  int numPass = 0;
  int totTest = 2;
  if (isten(t1)) {
    passT1 = 1;
    numPass++;
  }
  if (!isten(t2)) {
    passT2 = 1;
    numPass++;
  }
  printf("libisten test results:\n");
  printf("%d/%d passed\n", numPass, totTest);
  if (numPass == totTest) {
    printf("All tests passed!\n");
  }
  return !(numPass == totTest);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
movl   $0xc,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <isten@plt>
cmp    $0x0,%rax
je     117b <main+0x5b>
movl   $0x1,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <isten@plt>
cmp    $0x0,%rax
jne    119d <main+0x7d>
movl   $0x1,-0xc(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11d9 <main+0xb9>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xa,%edi
call   1050 <isten@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    $0xc,%edi
call   1050 <isten@plt>
lea    0x1(%rbx),%ebp
test   %rax,%rax
cmovne %ebx,%ebp
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe95(%rip),%rdi
mov    %ebp,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
jne    118a <main+0x5a>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
cmp    $0x2,%ebp
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"libisten test results:\0A\00"
@.str.1 = [14 x i8] c"%d/%d passed\0A\00"
@.str.2 = [19 x i8] c"All tests passed!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 10, i32* %4
store i32 12, i32* %5
store i32 0, i32* %6
store i32 2, i32* %7
%8 = load i32, i32* %4
%9 = call i64 @isten(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %0
store i32 1, i32* %2
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
br label %14
14: ; preds = %11, %0
%15 = load i32, i32* %5
%16 = call i64 @isten(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
store i32 1, i32* %3
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %21
21: ; preds = %18, %14
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %21
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %21
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = icmp eq i32 %32, %33
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
ret i32 %36
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"%d/%d passed\0A\00"
@str = [23 x i8] c"libisten test results:\00"
@str.3 = [18 x i8] c"All tests passed!\00"
define i32 @main() {
%1 = tail call i64 @isten(i32 10)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i64 @isten(i32 12)
%5 = icmp eq i64 %4, 0
%6 = select i1 %2, i32 2, i32 1
%7 = select i1 %5, i32 %6, i32 %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 2)
%10 = icmp eq i32 %7, 2
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %0
%14 = xor i1 %10, true
%15 = zext i1 %14 to i32
ret i32 %15
}