#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 max(int, int, int, int);
int min(int, int, int, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int sum(int, int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int test_implementations_by_sending_three_elements() {
  srand(time(NULL));
  int elements[3];
  elements[0] = rand() % (1000000 - 1 + 1) + 1;
  elements[1] = rand() % (1000000 - 1 + 1) + 1;
  elements[2] = rand() % (1000000 - 1 + 1) + 1;
  fprintf(stderr, "Sending following three elements:\n");
  for (int i = 0; i < 3; i++)
    fprintf(stderr, "%d\n", elements[i]);
  int elements_sum = sum(3, elements[0], elements[1], elements[2]);
  int minimum_element = min(3, elements[0], elements[1], elements[2]);
  int maximum_element = max(3, elements[0], elements[1], elements[2]);
  fprintf(stderr, "Your output is:\n");
  fprintf(stderr, "Elements sum is %d\n", elements_sum);
  fprintf(stderr, "Minimum element is %d\n", minimum_element);
  fprintf(stderr, "Maximum element is %d\n\n", maximum_element);
  int expected_elements_sum = 0;
  for (int i = 0; i < 3; i++) {
    if (elements[i] < minimum_element)
      return 0;
    if (elements[i] > maximum_element)
      return 0;
    expected_elements_sum += elements[i];
  }
  return elements_sum == expected_elements_sum;
}


x86 assembly (clang, -O0):
<test_implementations_by_sending_three_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    121c <test_implementations_by_sending_three_elements+0xac>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
movslq -0x14(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%edx
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e5 <test_implementations_by_sending_three_elements+0x75>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    $0x3,%edi
call   1070 <sum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    $0x3,%edi
call   1030 <min@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    $0x3,%edi
call   1040 <max@plt>
mov    %eax,-0x20(%rbp)
mov    0x2d7b(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xda6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
lea    0xda3(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jge    1331 <test_implementations_by_sending_three_elements+0x1c1>
movslq -0x28(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
cmp    -0x1c(%rbp),%eax
jge    12f8 <test_implementations_by_sending_three_elements+0x188>
movl   $0x0,-0x4(%rbp)
jmp    1342 <test_implementations_by_sending_three_elements+0x1d2>
movslq -0x28(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
cmp    -0x20(%rbp),%eax
jle    1315 <test_implementations_by_sending_three_elements+0x1a5>
movl   $0x0,-0x4(%rbp)
jmp    1342 <test_implementations_by_sending_three_elements+0x1d2>
movslq -0x28(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12d1 <test_implementations_by_sending_three_elements+0x161>
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_implementations_by_sending_three_elements>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1090 <rand@plt>
movslq %eax,%rcx
imul   $0x431bde83,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rdx
add    %ecx,%edx
imul   $0xf4240,%edx,%ecx
mov    %ecx,0x18(%rsp)
neg    %ecx
mov    %rax,0x30(%rsp)
lea    (%rax,%rcx,1),%r12d
add    $0x1,%r12d
xor    %eax,%eax
call   1090 <rand@plt>
movslq %eax,%rcx
imul   $0x431bde83,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rdx
add    %ecx,%edx
imul   $0xf4240,%edx,%ecx
mov    %ecx,0x14(%rsp)
neg    %ecx
mov    %rax,0x28(%rsp)
lea    (%rax,%rcx,1),%r14d
add    $0x1,%r14d
xor    %eax,%eax
call   1090 <rand@plt>
movslq %eax,%rcx
imul   $0x431bde83,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rdx
add    %ecx,%edx
imul   $0xf4240,%edx,%ecx
mov    %ecx,0xc(%rsp)
neg    %ecx
mov    %rax,0x20(%rsp)
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
mov    0x2daa(%rip),%r15
mov    (%r15),%edi
lea    0xdc0(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xdf3(%rip),%rbp
mov    %rbp,%rsi
mov    %r12d,0x1c(%rsp)
mov    %r12d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
mov    %rbp,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
mov    %rbp,%rsi
mov    %r14d,%ebp
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x3,%edi
mov    %r12d,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1070 <sum@plt>
mov    %eax,%r14d
mov    $0x3,%edi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <min@plt>
mov    %eax,%r13d
mov    $0x3,%edi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %ebx,0x10(%rsp)
mov    %ebx,%ecx
call   1040 <max@plt>
mov    %eax,%r12d
mov    (%r15),%edi
lea    0xd53(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xd53(%rip),%rsi
mov    %r14d,0x8(%rsp)
mov    %r14d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xd4e(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%edi
lea    0xd51(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x1c(%rsp),%ebx
cmp    %r13d,%ebx
jl     136d <test_implementations_by_sending_three_elements+0x1fd>
mov    0x30(%rsp),%rax
sub    0x18(%rsp),%eax
cmp    %r12d,%eax
jge    136d <test_implementations_by_sending_three_elements+0x1fd>
cmp    %r13d,%ebp
jl     136d <test_implementations_by_sending_three_elements+0x1fd>
mov    0x28(%rsp),%rax
sub    0x14(%rsp),%eax
cmp    %r12d,%eax
jge    136d <test_implementations_by_sending_three_elements+0x1fd>
mov    0x10(%rsp),%ecx
cmp    %r13d,%ecx
jl     136d <test_implementations_by_sending_three_elements+0x1fd>
mov    0x20(%rsp),%rax
sub    0xc(%rsp),%eax
cmp    %r12d,%eax
mov    $0x0,%eax
jge    136f <test_implementations_by_sending_three_elements+0x1ff>
add    %ebx,%ebp
add    %ebp,%ecx
xor    %eax,%eax
cmp    %ecx,0x8(%rsp)
sete   %al
jmp    136f <test_implementations_by_sending_three_elements+0x1ff>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Sending following three elements:\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [17 x i8] c"Your output is:\0A\00"
@.str.3 = [20 x i8] c"Elements sum is %d\0A\00"
@.str.4 = [23 x i8] c"Minimum element is %d\0A\00"
@.str.5 = [24 x i8] c"Maximum element is %d\0A\0A\00"
define i32 @test_implementations_by_sending_three_elements() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = call i32 @time(i32* null)
%10 = call i32 @srand(i32 %9)
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 1000000
%13 = add nsw i32 %12, 1
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 %13, i32* %14
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 1000000
%17 = add nsw i32 %16, 1
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 %17, i32* %18
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 1000000
%21 = add nsw i32 %20, 1
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 %21, i32* %22
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %25
25: ; preds = %35, %0
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 3
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %28
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %25
38: ; preds = %25
%39 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%40 = load i32, i32* %39
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%42 = load i32, i32* %41
%43 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%44 = load i32, i32* %43
%45 = call i32 @sum(i32 3, i32 %40, i32 %42, i32 %44)
store i32 %45, i32* %4
%46 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%47 = load i32, i32* %46
%48 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%49 = load i32, i32* %48
%50 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%51 = load i32, i32* %50
%52 = call i32 @min(i32 3, i32 %47, i32 %49, i32 %51)
store i32 %52, i32* %5
%53 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%54 = load i32, i32* %53
%55 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%56 = load i32, i32* %55
%57 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%58 = load i32, i32* %57
%59 = call i32 @max(i32 3, i32 %54, i32 %56, i32 %58)
store i32 %59, i32* %6
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%62 = load i32, i32* @stderr
%63 = load i32, i32* %4
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = load i32, i32* @stderr
%66 = load i32, i32* %5
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = load i32, i32* @stderr
%69 = load i32, i32* %6
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %69)
store i32 0, i32* %7
store i32 0, i32* %8
br label %71
71: ; preds = %97, %38
%72 = load i32, i32* %8
%73 = icmp slt i32 %72, 3
br i1 %73, label %74, label %100
74: ; preds = %71
%75 = load i32, i32* %8
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = load i32, i32* %5
%80 = icmp slt i32 %78, %79
br i1 %80, label %81, label %82
81: ; preds = %74
store i32 0, i32* %1
br label %105
82: ; preds = %74
%83 = load i32, i32* %8
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = load i32, i32* %6
%88 = icmp sgt i32 %86, %87
br i1 %88, label %89, label %90
89: ; preds = %82
store i32 0, i32* %1
br label %105
90: ; preds = %82
%91 = load i32, i32* %8
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %92
%94 = load i32, i32* %93
%95 = load i32, i32* %7
%96 = add nsw i32 %95, %94
store i32 %96, i32* %7
br label %97
97: ; preds = %90
%98 = load i32, i32* %8
%99 = add nsw i32 %98, 1
store i32 %99, i32* %8
br label %71
100: ; preds = %71
%101 = load i32, i32* %4
%102 = load i32, i32* %7
%103 = icmp eq i32 %101, %102
%104 = zext i1 %103 to i32
store i32 %104, i32* %1
br label %105
105: ; preds = %100, %89, %81
%106 = load i32, i32* %1
ret i32 %106
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Sending following three elements:\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [17 x i8] c"Your output is:\0A\00"
@.str.3 = [20 x i8] c"Elements sum is %d\0A\00"
@.str.4 = [23 x i8] c"Minimum element is %d\0A\00"
@.str.5 = [24 x i8] c"Maximum element is %d\0A\0A\00"
define i32 @test_implementations_by_sending_three_elements() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 1000000
%5 = add nsw i32 %4, 1
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 1000000
%8 = add nsw i32 %7, 1
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 1000000
%11 = add nsw i32 %10, 1
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%20 = tail call i32 @sum(i32 3, i32 %5, i32 %8, i32 %11)
%21 = tail call i32 @min(i32 3, i32 %5, i32 %8, i32 %11)
%22 = tail call i32 @max(i32 3, i32 %5, i32 %8, i32 %11)
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %22)
%31 = icmp slt i32 %5, %21
%32 = icmp sge i32 %4, %22
%33 = select i1 %31, i1 true, i1 %32
br i1 %33, label %47, label %34
34: ; preds = %0
%35 = icmp slt i32 %8, %21
%36 = icmp sge i32 %7, %22
%37 = select i1 %35, i1 true, i1 %36
br i1 %37, label %47, label %38
38: ; preds = %34
%39 = icmp slt i32 %11, %21
%40 = icmp sge i32 %10, %22
%41 = select i1 %39, i1 true, i1 %40
br i1 %41, label %47, label %42
42: ; preds = %38
%43 = add nsw i32 %8, %5
%44 = add nsw i32 %11, %43
%45 = icmp eq i32 %20, %44
%46 = zext i1 %45 to i32
br label %47
47: ; preds = %0, %34, %38, %42
%48 = phi i32 [ %46, %42 ], [ 0, %38 ], [ 0, %34 ], [ 0, %0 ]
ret i32 %48
}