#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*/ assert(int);
int mean(int *, int, int *);
int /*<<< orphan*/ printf(char *);
void test_mean2(void) {
  int test_arr_1[] = {1, 2, 3, 4};
  int ret;
  int res;
  printf("Test mean using assert:      ");
  ret = mean(test_arr_1, 4, &res);
  assert(ret == 0);
  assert(res == 3);
  printf(" OK\n");
}


x86 assembly (clang, -O0):
<test_mean2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
lea    -0x18(%rbp),%rdx
call   1050 <mean@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x3,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mean2>:
sub    $0x28,%rsp
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0x4,%esi
call   1060 <mean@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x3,0xc(%rsp)
sete   %dil
call   1050 <assert@plt>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_mean2.test_arr_1 = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [30 x i8] c"Test mean using assert: \00"
@.str.1 = [5 x i8] c" OK\0A\00"
define void @test_mean2() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [4 x i32]* %1 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%7 = call i32 @mean(i32* %6, i32 4, i32* %3)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 3
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_mean2.test_arr_1 = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [30 x i8] c"Test mean using assert: \00"
@str = [4 x i8] c" OK\00"
define void @test_mean2() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = bitcast [4 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%7 = call i32 @mean(i32* %6, i32 4, i32* %2)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 3
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}