#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 printParenth(int **s, int i, int j) {
  if (i == j) {
    printf("%d", i);
  } else {
    printf("(");
    printParenth(s, i, s[i][j]);
    printParenth(s, s[i][j] + 1, j);
    printf(")");
  }
}


x86 assembly (clang, -O0):
<printParenth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1154 <printParenth+0x34>
mov    -0xc(%rbp),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <printParenth+0x91>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1040 <printParenth@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <printParenth@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printParenth>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
cmp    %edx,%esi
jne    1156 <printParenth+0x26>
lea    0xebb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    %edx,%r14d
mov    %rdi,%rbx
mov    $0x28,%edi
call   1030 <putchar@plt>
movslq %ebp,%r15
mov    (%rbx,%r15,8),%rax
movslq %r14d,%r12
mov    (%rax,%r12,4),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <printParenth@plt>
mov    (%rbx,%r15,8),%rax
mov    (%rax,%r12,4),%esi
add    $0x1,%esi
mov    %rbx,%rdi
mov    %r14d,%edx
call   1050 <printParenth@plt>
mov    $0x29,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"(\00"
@.str.2 = [2 x i8] c")\00"
define void @printParenth(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %39
13: ; preds = %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32**, i32*** %4
%16 = load i32, i32* %5
%17 = load i32**, i32*** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32*, i32** %17, i64 %19
%21 = load i32*, i32** %20
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = load i32**, i32*** %4
%27 = load i32**, i32*** %4
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32*, i32** %27, i64 %29
%31 = load i32*, i32** %30
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %13, %10
ret void
}

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