#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 average(int, ...);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  if (average(2, 3, 4, -1) != 3) {
    printf("Error %d\n", (int)1);
    exit(1);
  };
  if (average(5, 7, 9, 11, 13, -1) != 9) {
    printf("Error %d\n", (int)2);
    exit(2);
  };
  if (average(-1) != 0) {
    printf("Error %d\n", (int)3);
    exit(3);
  };
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1040 <average@plt>
cmp    $0x3,%eax
je     1180 <main+0x50>
lea    0xe96(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    $0x5,%edi
mov    $0x7,%esi
mov    $0x9,%edx
mov    $0xb,%ecx
mov    $0xd,%r8d
mov    $0xffffffff,%r9d
mov    $0x0,%al
call   1040 <average@plt>
cmp    $0x9,%eax
je     11cd <main+0x9d>
lea    0xe49(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    $0xffffffff,%edi
mov    $0x0,%al
call   1040 <average@plt>
cmp    $0x0,%eax
je     11ff <main+0xcf>
lea    0xe17(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
call   1050 <exit@plt>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1050 <average@plt>
cmp    $0x3,%eax
jne    11b0 <main+0x70>
mov    $0x5,%edi
mov    $0x7,%esi
mov    $0x9,%edx
mov    $0xb,%ecx
mov    $0xd,%r8d
mov    $0xffffffff,%r9d
xor    %eax,%eax
call   1050 <average@plt>
cmp    $0x9,%eax
jne    11cd <main+0x8d>
mov    $0xffffffff,%edi
xor    %eax,%eax
call   1050 <average@plt>
test   %eax,%eax
jne    11ea <main+0xaa>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>
lea    0xe49(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xe2c(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
call   1060 <exit@plt>
lea    0xe0f(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Error %d\0A\00"
@.str.1 = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i32, ...) @average(i32 2, i32 3, i32 4, i32 -1)
%3 = icmp ne i32 %2, 3
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = call i32 (i32, ...) @average(i32 5, i32 7, i32 9, i32 11, i32 13, i32 -1)
%9 = icmp ne i32 %8, 9
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2)
%12 = call i32 @exit(i32 2)
unreachable
13: ; preds = %7
%14 = call i32 (i32, ...) @average(i32 -1)
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3)
%18 = call i32 @exit(i32 3)
unreachable
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"Error %d\0A\00"
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 (i32, ...) @average(i32 2, i32 3, i32 4, i32 -1)
%2 = icmp eq i32 %1, 3
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
%7 = tail call i32 (i32, ...) @average(i32 5, i32 7, i32 9, i32 11, i32 13, i32 -1)
%8 = icmp eq i32 %7, 9
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2)
%11 = tail call i32 @exit(i32 2)
unreachable
12: ; preds = %6
%13 = tail call i32 (i32, ...) @average(i32 -1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 3)
%17 = tail call i32 @exit(i32 3)
unreachable
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 0)
unreachable
}