#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int length;
  scalar_t__ data;
};
typedef TYPE_1__ *ARRAYofARRAY8Ptr;
typedef scalar_t__ ARRAY8Ptr;
typedef int /*<<< orphan*/ ARRAY8;

/* Variables and functions */
int FALSE;
int TRUE;
scalar_t__ Xrealloc(scalar_t__, int);
int XdmcpReallocARRAYofARRAY8(ARRAYofARRAY8Ptr array, int length) {
  ARRAY8Ptr newData;
  newData = (ARRAY8Ptr)Xrealloc(array->data, length * sizeof(ARRAY8));
  if (!newData)
    return FALSE;
  array->length = length;
  array->data = newData;
  return TRUE;
}


x86 assembly (clang, -O0):
<XdmcpReallocARRAYofARRAY8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
call   1030 <Xrealloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1156 <XdmcpReallocARRAYofARRAY8+0x46>
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <XdmcpReallocARRAYofARRAY8+0x67>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XdmcpReallocARRAYofARRAY8>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
mov    0x8(%rdi),%rdi
lea    0x0(,%r14,4),%esi
call   1030 <Xrealloc@plt>
test   %rax,%rax
je     1140 <XdmcpReallocARRAYofARRAY8+0x30>
mov    %r14d,(%rbx)
mov    %rax,0x8(%rbx)
mov    0x2eaa(%rip),%rax
jmp    1147 <XdmcpReallocARRAYofARRAY8+0x37>
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @XdmcpReallocARRAYofARRAY8(%struct.TYPE_3__* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_3__*
%5 = alloca i32
%6 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %4
store i32 %1, i32* %5
%7 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%8 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 1
%9 = load i64, i64* %8
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 4
%13 = trunc i64 %12 to i32
%14 = call i64 @Xrealloc(i64 %9, i32 %13)
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = icmp ne i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = load i32, i32* @FALSE
store i32 %18, i32* %3
br label %27
19: ; preds = %2
%20 = load i32, i32* %5
%21 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 0
store i32 %20, i32* %22
%23 = load i64, i64* %6
%24 = load %struct.TYPE_3__*, %struct.TYPE_3__** %4
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %24, i32 0, i32 1
store i64 %23, i64* %25
%26 = load i32, i32* @TRUE
store i32 %26, i32* %3
br label %27
27: ; preds = %19, %17
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @XdmcpReallocARRAYofARRAY8(%struct.TYPE_3__* nocapture %0, i32 %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%4 = load i64, i64* %3
%5 = shl i32 %1, 2
%6 = tail call i64 @Xrealloc(i64 %4, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
store i32 %1, i32* %9
store i64 %6, i64* %3
br label %10
10: ; preds = %2, %8
%11 = phi i32* [ @TRUE, %8 ], [ @FALSE, %2 ]
%12 = load i32, i32* %11
ret i32 %12
}