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


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    0xe85(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11c3 <main+0x73>
mov    -0x14(%rbp),%eax
sub    $0x6e,%eax
jne    11b9 <main+0x69>
jmp    11a3 <main+0x53>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11be <main+0x6e>
jmp    11be <main+0x6e>
jmp    116d <main+0x1d>
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
xor    %edx,%edx
call   1040 <combine@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%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    0xe96(%rip),%r15
mov    0x2e87(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
je     11a5 <main+0x55>
cmp    $0x6e,%eax
jne    1180 <main+0x30>
mov    (%r12),%edi
call   1070 <atoi@plt>
mov    %eax,%r14d
jmp    1180 <main+0x30>
lea    0x0(,%r14,4),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1040 <combine@plt>
mov    %rbx,%rdi
call   1030 <free@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 = sext i32 %23 to i64
%25 = mul i64 4, %24
%26 = trunc i64 %25 to i32
%27 = call i64 @malloc(i32 %26)
%28 = inttoptr i64 %27 to i32*
store i32* %28, i32** %9
%29 = load i32*, i32** %9
%30 = load i32, i32* %7
%31 = call i32 @combine(i32* %29, i32 %30, i32 0)
%32 = load i32*, i32** %9
%33 = call i32 @free(i32* %32)
%34 = load i32, i32* %3
ret i32 %34
}

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 = shl i32 %4, 2
%12 = tail call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
%14 = tail call i32 @combine(i32* %13, i32 %4, i32 0)
%15 = tail call i32 @free(i32* %13)
ret i32 0
}