#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 *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int scanf(char *, int *);
void mine(void) {
  int array[100];
  int y, x = 0;
  puts("Enter some numbers separated by whitespaces:");
  while (scanf("%d", &array[x++]) == 1)
    ;
  int *ptr = malloc(x - 1 * sizeof(int));
  if (ptr != NULL) {
    ptr[0] = x - 1;
    for (y = 1; y < x; y++)
      ptr[y] = array[y - 1];
  }
  puts("Your numbers, in a dynamic allocated int array would be..");
  printf("%d: ", ptr[0]);
  x = 1;
  while (x < y) {
    printf("%d, ", ptr[x++]);
  }
  puts("\n");
}


x86 assembly (clang, -O0):
<mine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x198(%rbp)
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    -0x198(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x198(%rbp)
cltq
lea    -0x190(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea4(%rip),%rdi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    119c <mine+0x5c>
jmp    1161 <mine+0x21>
movslq -0x198(%rbp),%rax
sub    $0x4,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x1a0(%rbp)
cmpq   $0x0,-0x1a0(%rbp)
je     122d <mine+0xed>
mov    -0x198(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x1a0(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x194(%rbp)
mov    -0x194(%rbp),%eax
cmp    -0x198(%rbp),%eax
jge    1228 <mine+0xe8>
mov    -0x194(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x190(%rbp,%rax,4),%edx
mov    -0x1a0(%rbp),%rax
movslq -0x194(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    11df <mine+0x9f>
jmp    122d <mine+0xed>
lea    0xdfc(%rip),%rdi
call   1030 <puts@plt>
mov    -0x1a0(%rbp),%rax
mov    (%rax),%esi
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x198(%rbp)
mov    -0x198(%rbp),%eax
cmp    -0x194(%rbp),%eax
jge    1299 <mine+0x159>
mov    -0x1a0(%rbp),%rax
mov    -0x198(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x198(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xde0(%rip),%rdi
call   1040 <printf@plt>
jmp    1258 <mine+0x118>
lea    0xdd4(%rip),%rdi
call   1030 <puts@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mine>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x190,%rsp
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
xor    %r15d,%r15d
mov    $0x4,%ebp
mov    %rsp,%rbx
lea    0xeb0(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0xffffffff,%r15d
add    $0xfffffffffffffffc,%rbp
add    $0x4,%rbx
cmp    $0x1,%eax
je     1180 <mine+0x30>
mov    $0xfffffffc,%edi
sub    %r15d,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
test   %rax,%rax
je     11e4 <mine+0x94>
mov    %r15d,%eax
not    %eax
mov    %eax,(%r12)
cmp    $0xffffffff,%r15d
je     11e6 <mine+0x96>
mov    %r12,%rdi
add    $0x4,%rdi
neg    %rbp
movabs $0x3fffffffc,%rdx
and    %rbp,%rdx
mov    %rsp,%rsi
call   1050 <memcpy@plt>
neg    %r15d
jmp    11ec <mine+0x9c>
jmp    11ec <mine+0x9c>
mov    $0x1,%r15d
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
mov    (%r12),%esi
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x2,%r15d
jl     1235 <mine+0xe5>
mov    %r15d,%ebp
mov    $0x1,%ebx
lea    0xe52(%rip),%r14
nopl   (%rax)
mov    (%r12,%rbx,4),%esi
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    %rbx,%rbp
jne    1220 <mine+0xd0>
lea    0xe38(%rip),%rdi
call   1030 <puts@plt>
add    $0x190,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Enter some numbers separated by whitespaces:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [58 x i8] c"Your numbers, in a dynamic allocated int array would be..\00"
@.str.3 = [5 x i8] c"%d: \00"
@.str.4 = [5 x i8] c"%d, \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @mine() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %3
%5 = call i32 @puts(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %6
br label %6
14: ; preds = %6
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = sub i64 %16, 4
%18 = trunc i64 %17 to i32
%19 = call i32* @malloc(i32 %18)
store i32* %19, i32** %4
%20 = load i32*, i32** %4
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %45
22: ; preds = %14
%23 = load i32, i32* %3
%24 = sub nsw i32 %23, 1
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 0
store i32 %24, i32* %26
store i32 1, i32* %2
br label %27
27: ; preds = %41, %22
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %44
31: ; preds = %27
%32 = load i32, i32* %2
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = load i32*, i32** %4
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
store i32 %36, i32* %40
br label %41
41: ; preds = %31
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %27
44: ; preds = %27
br label %45
45: ; preds = %44, %14
%46 = call i32 @puts(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%47 = load i32*, i32** %4
%48 = getelementptr inbounds i32, i32* %47, i64 0
%49 = load i32, i32* %48
%50 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %49)
store i32 1, i32* %3
br label %51
51: ; preds = %55, %45
%52 = load i32, i32* %3
%53 = load i32, i32* %2
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %63
55: ; preds = %51
%56 = load i32*, i32** %4
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
%59 = sext i32 %57 to i64
%60 = getelementptr inbounds i32, i32* %56, i64 %59
%61 = load i32, i32* %60
%62 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %61)
br label %51
63: ; preds = %51
%64 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Enter some numbers separated by whitespaces:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [58 x i8] c"Your numbers, in a dynamic allocated int array would be..\00"
@.str.3 = [5 x i8] c"%d: \00"
@.str.4 = [5 x i8] c"%d, \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @mine() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ %6, %4 ], [ 0, %0 ]
%6 = add nuw i64 %5, 1
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %5
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = icmp eq i32 %8, 1
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = trunc i64 %5 to i32
%12 = add nsw i32 %11, -3
%13 = call i32* @malloc(i32 %12)
%14 = icmp eq i32* %13, null
br i1 %14, label %24, label %15
15: ; preds = %10
store i32 %11, i32* %13
%16 = icmp eq i32 %11, 0
br i1 %16, label %24, label %17
17: ; preds = %15
%18 = getelementptr i32, i32* %13, i64 1
%19 = bitcast i32* %18 to i8*
%20 = shl i64 %5, 2
%21 = and i64 %20, 17179869180
%22 = trunc i64 %5 to i32
%23 = add i32 %22, 1
br label %24
24: ; preds = %17, %15, %10
%25 = phi i32 [ undef, %10 ], [ 1, %15 ], [ %23, %17 ]
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %13
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = icmp sgt i32 %25, 1
br i1 %29, label %30, label %39
30: ; preds = %24
%31 = zext i32 %25 to i64
br label %32
32: ; preds = %30, %32
%33 = phi i64 [ 1, %30 ], [ %34, %32 ]
%34 = add nuw nsw i64 %33, 1
%35 = getelementptr inbounds i32, i32* %13, i64 %33
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = icmp eq i64 %34, %31
br i1 %38, label %39, label %32
39: ; preds = %32, %24
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}