#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 findSingleInt(int *, int, int *);
int /*<<< orphan*/ getInput(int **, int *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int *zArr;
  int result;
  int n;
  int success;
  getInput(&zArr, &n);
  success = findSingleInt(zArr, n, &result);
  if (success == 1)
    printf("Single integer is: %d\n", result);
  else if (success > 1)
    printf("More than one single integer was found\n");
  else
    printf("No single integer found\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <getInput@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
lea    -0x14(%rbp),%rdx
call   1030 <findSingleInt@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    117f <main+0x4f>
mov    -0x14(%rbp),%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11af <main+0x7f>
cmpl   $0x1,-0x1c(%rbp)
jle    119c <main+0x6c>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11aa <main+0x7a>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11af <main+0x7f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1060 <getInput@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%esi
lea    0xc(%rsp),%rdx
call   1040 <findSingleInt@plt>
cmp    $0x1,%eax
jne    117f <main+0x3f>
mov    0xc(%rsp),%esi
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1196 <main+0x56>
jle    118a <main+0x4a>
lea    0xea7(%rip),%rdi
jmp    1191 <main+0x51>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Single integer is: %d\0A\00"
@.str.1 = [40 x i8] c"More than one single integer was found\0A\00"
@.str.2 = [25 x i8] c"No single integer found\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @getInput(i32** %2, i32* %4)
%7 = load i32*, i32** %2
%8 = load i32, i32* %4
%9 = call i32 @findSingleInt(i32* %7, i32 %8, i32* %3)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %23
15: ; preds = %0
%16 = load i32, i32* %5
%17 = icmp sgt i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
br label %23
23: ; preds = %22, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Single integer is: %d\0A\00"
@str = [24 x i8] c"No single integer found\00"
@str.3 = [39 x i8] c"More than one single integer was found\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32** %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @getInput(i32** %1, i32* %3)
%8 = load i32*, i32** %1
%9 = load i32, i32* %3
%10 = call i32 @findSingleInt(i32* %8, i32 %9, i32* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %21
15: ; preds = %0
%16 = icmp sgt i32 %10, 1
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.3, i64 0, i64 0))
br label %21
19: ; preds = %15
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %21
21: ; preds = %17, %19, %12
ret i32 0
}