#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 */
unsigned int *malloc(unsigned int);
int /*<<< orphan*/ memset(unsigned int *, int /*<<< orphan*/, unsigned int);
scalar_t__ scanf(char *, unsigned int *);
void pi26_array1_ui_read_stdin(unsigned int **array, unsigned int size) {
  unsigned int *result, input;
  unsigned int i = 0;
  result = malloc(size * sizeof(unsigned int));
  memset(result, 0, size * sizeof(unsigned int));
  while (i < size && scanf("%x", &input) > 0) {
    result[i] = input;
    i++;
  }
  (*array) = result;
}


x86 assembly (clang, -O0):
<pi26_array1_ui_read_stdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x20(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x21(%rbp)
jae    1197 <pi26_array1_ui_read_stdin+0x67>
lea    0xe7c(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x0,%rax
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11a7 <pi26_array1_ui_read_stdin+0x77>
jmp    11c2 <pi26_array1_ui_read_stdin+0x92>
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116c <pi26_array1_ui_read_stdin+0x3c>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pi26_array1_ui_read_stdin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x0(,%r15,4),%ebp
mov    %ebp,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
test   %r15d,%r15d
je     11a2 <pi26_array1_ui_read_stdin+0x72>
mov    %r15d,%ebp
xor    %ebx,%ebx
lea    0xe90(%rip),%r15
lea    0x4(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
jle    11a2 <pi26_array1_ui_read_stdin+0x72>
mov    0x4(%rsp),%eax
mov    %eax,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <pi26_array1_ui_read_stdin+0x50>
mov    %r13,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
define void @pi26_array1_ui_read_stdin(i32** %0, i32 %1) {
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32** %0, i32*** %3
store i32 %1, i32* %4
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = mul i64 %9, 4
%11 = trunc i64 %10 to i32
%12 = call i32* @malloc(i32 %11)
store i32* %12, i32** %5
%13 = load i32*, i32** %5
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = mul i64 %15, 4
%17 = trunc i64 %16 to i32
%18 = call i32 @memset(i32* %13, i32 0, i32 %17)
br label %19
19: ; preds = %28, %2
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = icmp ult i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%25 = icmp sgt i64 %24, 0
br label %26
26: ; preds = %23, %19
%27 = phi i1 [ false, %19 ], [ %25, %23 ]
br i1 %27, label %28, label %36
28: ; preds = %26
%29 = load i32, i32* %6
%30 = load i32*, i32** %5
%31 = load i32, i32* %7
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
%34 = load i32, i32* %7
%35 = add i32 %34, 1
store i32 %35, i32* %7
br label %19
36: ; preds = %26
%37 = load i32*, i32** %5
%38 = load i32**, i32*** %3
store i32* %37, i32** %38
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define void @pi26_array1_ui_read_stdin(i32** nocapture writeonly %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = shl i32 %1, 2
%6 = tail call i32* @malloc(i32 %5)
%7 = tail call i32 @memset(i32* %6, i32 0, i32 %5)
%8 = icmp eq i32 %1, 0
br i1 %8, label %20, label %9
9: ; preds = %2
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %9, %15
%12 = phi i64 [ 0, %9 ], [ %18, %15 ]
%13 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = icmp sgt i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i32, i32* %3
%17 = getelementptr inbounds i32, i32* %6, i64 %12
store i32 %16, i32* %17
%18 = add nuw nsw i64 %12, 1
%19 = icmp eq i64 %18, %10
br i1 %19, label %20, label %11
20: ; preds = %11, %15, %2
store i32* %6, i32** %0
ret void
}