#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*/ printf(char *, ...);
void printParan(int n, int pos[n][n], int a, int b) {
  if (a == b) {
    printf("A_%d", a);
    return;
  }
  if (a == b - 1) {
    printf("A_%dA_%d", a, b);
    return;
  }
  printf("(");
  printParan(n, pos, a, pos[a][b]);
  printf(")(");
  printParan(n, pos, pos[a][b] + 1, b);
  printf(")");
}


x86 assembly (clang, -O0):
<printParan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    115e <printParan+0x3e>
mov    -0x14(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120f <printParan+0xef>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1188 <printParan+0x68>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120f <printParan+0xef>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%r8
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %r8,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
call   1030 <printParan@plt>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdx
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1030 <printParan@plt>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printParan>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
cmp    %ecx,%edx
jne    115f <printParan+0x2f>
lea    0xebc(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    %ecx,%ebx
lea    -0x1(%rbx),%eax
cmp    %ebp,%eax
jne    1188 <printParan+0x58>
lea    0xe91(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    %rsi,%r14
mov    %edi,%r15d
mov    %edi,%r12d
mov    $0x28,%edi
call   1030 <putchar@plt>
movslq %ebp,%rax
imul   %r12,%rax
lea    (%r14,%rax,4),%r12
movslq %ebx,%r13
mov    (%r12,%r13,4),%ecx
mov    %r15d,%edi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <printParan@plt>
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r12,%r13,4),%edx
add    $0x1,%edx
mov    %r15d,%edi
mov    %r14,%rsi
mov    %ebx,%ecx
call   1040 <printParan@plt>
mov    $0x29,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"A_%d\00"
@.str.1 = [9 x i8] c"A_%dA_%d\00"
@.str.2 = [2 x i8] c"(\00"
@.str.3 = [3 x i8] c")(\00"
@.str.4 = [2 x i8] c")\00"
define void @printParan(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = load i32, i32* %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %57
19: ; preds = %4
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = sub nsw i32 %21, 1
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %26)
br label %57
28: ; preds = %19
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* %5
%31 = load i32*, i32** %6
%32 = load i32, i32* %7
%33 = load i32*, i32** %6
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = mul nsw i64 %35, %12
%37 = getelementptr inbounds i32, i32* %33, i64 %36
%38 = load i32, i32* %8
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* %5
%44 = load i32*, i32** %6
%45 = load i32*, i32** %6
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = mul nsw i64 %47, %12
%49 = getelementptr inbounds i32, i32* %45, i64 %48
%50 = load i32, i32* %8
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = load i32, i32* %52
%54 = add nsw i32 %53, 1
%55 = load i32, i32* %8
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %57
57: ; preds = %28, %24, %16
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"A_%d\00"
@.str.1 = [9 x i8] c"A_%dA_%d\00"
@.str.3 = [3 x i8] c")(\00"
define void @printParan(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = zext i32 %0 to i64
%6 = icmp eq i32 %2, %3
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %14
9: ; preds = %4
%10 = add nsw i32 %3, -1
%11 = icmp eq i32 %10, %2
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
br label %14
14: ; preds = %7, %12, %15
ret void
15: ; preds = %9
%16 = tail call i32 @putchar(i32 40)
%17 = sext i32 %2 to i64
%18 = mul nsw i64 %17, %5
%19 = getelementptr inbounds i32, i32* %1, i64 %18
%20 = sext i32 %3 to i64
%21 = getelementptr inbounds i32, i32* %19, i64 %20
%22 = load i32, i32* %21
tail call void @printParan(i32 %0, i32* %1, i32 %2, i32 %22)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%24 = load i32, i32* %21
%25 = add nsw i32 %24, 1
tail call void @printParan(i32 %0, i32* %1, i32 %25, i32 %3)
%26 = tail call i32 @putchar(i32 41)
br label %14
}