#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*/ errPointer(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, char *);
scalar_t__ isdigit(char);
int *malloc(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int *manage_size(int *size, int *sol) {
  int ok = 0;
  char trash;
  while (!ok) {
    fprintf(stdout, "\nEnter maximum size string to generate: ");
    fscanf(stdin, "%1s", &trash);
    fflush(stdin);
    if (isdigit(trash))
      ok = 1;
  }
  (*size) = trash - '0';
  sol = malloc((*size) * sizeof(int));
  if (sol == NULL)
    errPointer(-2);
  return sol;
}


x86 assembly (clang, -O0):
<manage_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118d <manage_size+0x2d>
jmp    11e8 <manage_size+0x88>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe63(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
lea    -0x15(%rbp),%rdx
call   1040 <fscanf@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
movsbl -0x15(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11e3 <manage_size+0x83>
movl   $0x1,-0x14(%rbp)
jmp    1177 <manage_size+0x17>
movsbl -0x15(%rbp),%ecx
sub    $0x30,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1220 <manage_size+0xc0>
mov    $0xfffffffe,%edi
call   1080 <errPointer@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manage_size>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e63(%rip),%r13
lea    0xe84(%rip),%r15
mov    0x2e65(%rip),%rbp
lea    0xe9f(%rip),%r12
lea    0x7(%rsp),%rbx
nop
mov    0x0(%r13),%edi
mov    %r15,%rsi
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <fscanf@plt>
mov    0x0(%rbp),%edi
call   1070 <fflush@plt>
movsbl 0x7(%rsp),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1190 <manage_size+0x30>
movsbl 0x7(%rsp),%eax
lea    -0x30(%rax),%ecx
mov    %ecx,(%r14)
lea    -0xc0(,%rax,4),%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11ea <manage_size+0x8a>
mov    $0xfffffffe,%edi
call   1080 <errPointer@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [41 x i8] c"\0AEnter maximum size string to generate: \00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%1s\00"
define i32* @manage_size(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %7
7: ; preds = %22, %2
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stdin
%15 = call i32 @fscanf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%16 = load i32, i32* @stdin
%17 = call i32 @fflush(i32 %16)
%18 = load i8, i8* %6
%19 = call i64 @isdigit(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %11
store i32 1, i32* %5
br label %22
22: ; preds = %21, %11
br label %7
23: ; preds = %7
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 48
%27 = load i32*, i32** %3
store i32 %26, i32* %27
%28 = load i32*, i32** %3
%29 = load i32, i32* %28
%30 = sext i32 %29 to i64
%31 = mul i64 %30, 4
%32 = trunc i64 %31 to i32
%33 = call i32* @malloc(i32 %32)
store i32* %33, i32** %4
%34 = load i32*, i32** %4
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %38
36: ; preds = %23
%37 = call i32 @errPointer(i32 -2)
br label %38
38: ; preds = %36, %23
%39 = load i32*, i32** %4
ret i32* %39
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [41 x i8] c"\0AEnter maximum size string to generate: \00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%1s\00"
define noalias i32* @manage_size(i32* nocapture writeonly %0, i32* nocapture readnone %1) {
%3 = alloca i8
br label %4
4: ; preds = %2, %4
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32 @fscanf(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%9 = load i32, i32* @stdin
%10 = call i32 @fflush(i32 %9)
%11 = load i8, i8* %3
%12 = call i64 @isdigit(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %4, label %14
14: ; preds = %4
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = add nsw i32 %16, -48
store i32 %17, i32* %0
%18 = shl nsw i32 %17, 2
%19 = call i32* @malloc(i32 %18)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @errPointer(i32 -2)
br label %23
23: ; preds = %21, %14
ret i32* %19
}