#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 */
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  int length;
  TYPE_1__ *data;
};
struct TYPE_5__ {
  int /*<<< orphan*/ *data;
};
typedef TYPE_2__ ARRAYofARRAY8;
typedef int /*<<< orphan*/ ARRAY8;

/* Variables and functions */
int TRUE;
int XdmcpAllocARRAYofARRAY8(TYPE_2__ *, int);
int /*<<< orphan*/ XdmcpDisposeARRAYofARRAY8(TYPE_2__ *);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *);
void TestZeroFillARRAYofARRAY8(void) {
  ARRAYofARRAY8 aa;
  int result;
  char *noise;
  printf("Checking XdmcpAllocARRAYofARRAY8 zero fills array...\n");
  noise = malloc(32 * sizeof(ARRAY8));
  memset(noise, 0xdeadbeef, 32 * sizeof(ARRAY8));
  free(noise);
  result = XdmcpAllocARRAYofARRAY8(&aa, 32);
  assert(result == TRUE);
  assert(aa.length == 32);
  assert(aa.data[4].data == NULL);
  printf("Checking XdmcpReallocARRAYofARRAY8 zero fills array...\n");
  result = XdmcpAllocARRAYofARRAY8(&aa, 48);
  assert(result == TRUE);
  assert(aa.length == 48);
  assert(aa.data[40].data == NULL);
  XdmcpDisposeARRAYofARRAY8(&aa);
}


x86 assembly (clang, -O0):
<TestZeroFillARRAYofARRAY8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
mov    $0x80,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0xdeadbeef,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
lea    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1080 <XdmcpAllocARRAYofARRAY8@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e1f(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpl   $0x20,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x20(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    0xe30(%rip),%rdi
call   1050 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0x30,%esi
call   1080 <XdmcpAllocARRAYofARRAY8@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2dc2(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpl   $0x30,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x140(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
lea    -0x10(%rbp),%rdi
call   1040 <XdmcpDisposeARRAYofARRAY8@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestZeroFillARRAYofARRAY8>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
mov    $0x80,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xdeadbeef,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1080 <XdmcpAllocARRAYofARRAY8@plt>
mov    0x2e25(%rip),%rbx
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpl   $0x20,0x8(%rsp)
sete   %dil
call   1070 <assert@plt>
mov    0x10(%rsp),%rax
xor    %edi,%edi
cmpq   $0x0,0x20(%rax)
sete   %dil
call   1070 <assert@plt>
lea    0xe39(%rip),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    $0x30,%esi
call   1080 <XdmcpAllocARRAYofARRAY8@plt>
xor    %edi,%edi
cmp    (%rbx),%eax
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpl   $0x30,0x8(%rsp)
sete   %dil
call   1070 <assert@plt>
mov    0x10(%rsp),%rax
xor    %edi,%edi
cmpq   $0x0,0x140(%rax)
sete   %dil
call   1070 <assert@plt>
mov    %r14,%rdi
call   1040 <XdmcpDisposeARRAYofARRAY8@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, %struct.TYPE_5__* }
%struct.TYPE_5__ = type { i32* }
@.str = [54 x i8] c"Checking XdmcpAllocARRAYofARRAY8 zero fills array...\0A\00"
@TRUE = global i32 0
@.str.1 = [56 x i8] c"Checking XdmcpReallocARRAYofARRAY8 zero fills array...\0A\00"
define void @TestZeroFillARRAYofARRAY8() {
%1 = alloca %struct.TYPE_6__
%2 = alloca i32
%3 = alloca i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%5 = call i8* @malloc(i32 128)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @memset(i8* %6, i32 -559038737, i32 128)
%8 = load i8*, i8** %3
%9 = call i32 @free(i8* %8)
%10 = call i32 @XdmcpAllocARRAYofARRAY8(%struct.TYPE_6__* %1, i32 32)
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = load i32, i32* @TRUE
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i32 0, i32 0
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 32
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i32 0, i32 1
%22 = load %struct.TYPE_5__*, %struct.TYPE_5__** %21
%23 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %22, i64 4
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %23, i32 0, i32 0
%25 = load i32*, i32** %24
%26 = icmp eq i32* %25, null
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @XdmcpAllocARRAYofARRAY8(%struct.TYPE_6__* %1, i32 48)
store i32 %30, i32* %2
%31 = load i32, i32* %2
%32 = load i32, i32* @TRUE
%33 = icmp eq i32 %31, %32
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i32 0, i32 0
%37 = load i32, i32* %36
%38 = icmp eq i32 %37, 48
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i32 0, i32 1
%42 = load %struct.TYPE_5__*, %struct.TYPE_5__** %41
%43 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %42, i64 40
%44 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %43, i32 0, i32 0
%45 = load i32*, i32** %44
%46 = icmp eq i32* %45, null
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = call i32 @XdmcpDisposeARRAYofARRAY8(%struct.TYPE_6__* %1)
ret void
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32, %struct.TYPE_5__* }
%struct.TYPE_5__ = type { i32* }
@TRUE = global i32 0
@str = [53 x i8] c"Checking XdmcpAllocARRAYofARRAY8 zero fills array...\00"
@str.2 = [55 x i8] c"Checking XdmcpReallocARRAYofARRAY8 zero fills array...\00"
define void @TestZeroFillARRAYofARRAY8() {
%1 = alloca %struct.TYPE_6__
%2 = bitcast %struct.TYPE_6__* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%4 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%5 = tail call i32 @memset(i8* %4, i32 -559038737, i32 128)
%6 = tail call i32 @free(i8* %4)
%7 = call i32 @XdmcpAllocARRAYofARRAY8(%struct.TYPE_6__* %1, i32 32)
%8 = load i32, i32* @TRUE
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 0
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 32
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 1
%18 = load %struct.TYPE_5__*, %struct.TYPE_5__** %17
%19 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %18, i64 4, i32 0
%20 = load i32*, i32** %19
%21 = icmp eq i32* %20, null
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.2, i64 0, i64 0))
%25 = call i32 @XdmcpAllocARRAYofARRAY8(%struct.TYPE_6__* %1, i32 48)
%26 = load i32, i32* @TRUE
%27 = icmp eq i32 %25, %26
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i32, i32* %12
%31 = icmp eq i32 %30, 48
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load %struct.TYPE_5__*, %struct.TYPE_5__** %17
%35 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %34, i64 40, i32 0
%36 = load i32*, i32** %35
%37 = icmp eq i32* %36, null
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = call i32 @XdmcpDisposeARRAYofARRAY8(%struct.TYPE_6__* %1)
ret void
}