#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 atoi(int /*<<< orphan*/);
int /*<<< orphan*/ devideNum(int *, int, int, int);
int getopt(int, char **, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ optarg;
int main(int argc, char **argv) {
  int ch, num = 6;
  int *arr, i;
  while (-1 != (ch = getopt(argc, argv, "n:"))) {
    switch (ch) {
    case 'n': {
      num = atoi(optarg);
      break;
    }
    default: {
      break;
    }
    }
  }
  arr = (int *)malloc(sizeof(int) * (num + 1));
  arr[0] = 0;
  devideNum(arr, num + 1, num, num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x6,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe95(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11b3 <main+0x73>
mov    -0x14(%rbp),%eax
sub    $0x6e,%eax
jne    11a9 <main+0x69>
jmp    1193 <main+0x53>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11ae <main+0x6e>
jmp    11ae <main+0x6e>
jmp    115d <main+0x1d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1040 <devideNum@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x6,%r14d
lea    0xea6(%rip),%r15
mov    0x2e97(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
je     1195 <main+0x55>
cmp    $0x6e,%eax
jne    1170 <main+0x30>
mov    (%r12),%edi
call   1060 <atoi@plt>
mov    %eax,%r14d
jmp    1170 <main+0x30>
lea    0x1(%r14),%ebx
lea    0x4(,%r14,4),%edi
call   1030 <malloc@plt>
movl   $0x0,(%rax)
mov    %rax,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r14d,%ecx
call   1040 <devideNum@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"n:\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 6, i32* %7
br label %10
10: ; preds = %21, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %6
%14 = icmp ne i32 -1, %13
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = load i32, i32* %6
switch i32 %16, label %20 [
i32 110, label %17
]
17: ; preds = %15
%18 = load i32, i32* @optarg
%19 = call i32 @atoi(i32 %18)
store i32 %19, i32* %7
br label %21
20: ; preds = %15
br label %21
21: ; preds = %20, %17
br label %10
22: ; preds = %10
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = mul i64 4, %25
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to i32*
store i32* %29, i32** %8
%30 = load i32*, i32** %8
%31 = getelementptr inbounds i32, i32* %30, i64 0
store i32 0, i32* %31
%32 = load i32*, i32** %8
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
%35 = load i32, i32* %7
%36 = load i32, i32* %7
%37 = call i32 @devideNum(i32* %32, i32 %34, i32 %35, i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"n:\00"
@optarg = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i32 [ %9, %7 ], [ 6, %2 ]
br label %5
5: ; preds = %3, %5
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %5 [
i32 -1, label %10
i32 110, label %7
]
7: ; preds = %5
%8 = load i32, i32* @optarg
%9 = tail call i32 @atoi(i32 %8)
br label %3
10: ; preds = %5
%11 = add nsw i32 %4, 1
%12 = shl i32 %11, 2
%13 = tail call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32*
store i32 0, i32* %14
%15 = tail call i32 @devideNum(i32* %14, i32 %11, i32 %4, i32 %4)
ret i32 0
}