void generateParenthesisMain(voia) {
  int returnSize = 0;
  char **result = generateParenthesis(4, &returnSize);
  while (returnSize > 0) {
    printf("%s\n", result[returnSize - 1]);
    free(result[returnSize - 1]);
    returnSize--;
  }
  free(result);
}


x86 assembly (clang, -O0):
<generateParenthesisMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x4,%edi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <generateParenthesis@plt>
cltq
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11a5 <generateParenthesisMain+0x75>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <generateParenthesisMain+0x28>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateParenthesisMain>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x4,%edi
xor    %eax,%eax
call   1050 <generateParenthesis@plt>
movslq %eax,%rbx
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    118b <generateParenthesisMain+0x5b>
nopl   0x0(%rax)
add    $0xffffffff,%eax
mov    (%rbx,%rax,8),%rdi
call   1040 <puts@plt>
movslq 0xc(%rsp),%rax
mov    -0x8(%rbx,%rax,8),%rdi
call   1030 <free@plt>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x1,%ecx
jg     1160 <generateParenthesisMain+0x30>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @generateParenthesisMain(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @generateParenthesis to i32 (i32, i32*, ...)*)(i32 4, i32* %3)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8**
store i8** %7, i8*** %4
br label %8
8: ; preds = %11, %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i8**, i8*** %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %12, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i8**, i8*** %4
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %19, i64 %22
%24 = load i8*, i8** %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
br label %8
27: ; preds = %8
%28 = load i8**, i8*** %4
%29 = bitcast i8** %28 to i8*
ret void
}

LLVM IR (-O2):
define void @generateParenthesisMain(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @generateParenthesis to i32 (i32, i32*, ...)*)(i32 4, i32* %2)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8**
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %1, %9
%10 = phi i32 [ %22, %9 ], [ %7, %1 ]
%11 = add nsw i32 %10, -1
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %6, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @puts(i8* dereferenceable(1) %14)
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %6, i64 %18
%20 = load i8*, i8** %19
%21 = load i32, i32* %2
%22 = add nsw i32 %21, -1
store i32 %22, i32* %2
%23 = icmp sgt i32 %21, 1
br i1 %23, label %9, label %24
24: ; preds = %9, %1
%25 = inttoptr i64 %5 to i8*
ret void
}