#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ traverse(int **, int, int, int **);
int uniquePathsWithObstacles1(int **grid, int rSize, int cSize) {
  int **arrs = (int **)malloc(sizeof(int *) * rSize);
  for (int i = 0; i < rSize; i++) {
    arrs[i] = (int *)malloc(sizeof(int) * cSize);
    for (int j = 0; j < cSize; j++)
      arrs[i][j] = -1;
  }
  traverse(grid, rSize - 1, cSize - 1, arrs);
  return arrs[rSize - 1][cSize - 1];
}


x86 assembly (clang, -O0):
<uniquePathsWithObstacles1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c1 <uniquePathsWithObstacles1+0xa1>
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ae <uniquePathsWithObstacles1+0x8e>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117d <uniquePathsWithObstacles1+0x5d>
jmp    11b3 <uniquePathsWithObstacles1+0x93>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <uniquePathsWithObstacles1+0x2c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%rcx
call   1030 <traverse@plt>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniquePathsWithObstacles1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,0x10(%rsp)
lea    0x0(,%rbp,8),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,0x8(%rsp)
test   %ebp,%ebp
jle    11ab <uniquePathsWithObstacles1+0x7b>
lea    0x0(,%r15,4),%ebp
mov    %r15d,%r13d
shl    $0x2,%r13
mov    0x8(%rsp),%r12d
xor    %r14d,%r14d
jmp    1189 <uniquePathsWithObstacles1+0x59>
nopl   0x0(%rax)
add    $0x1,%r14
cmp    %r14,%r12
je     11ab <uniquePathsWithObstacles1+0x7b>
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,(%rbx,%r14,8)
test   %r15d,%r15d
jle    1180 <uniquePathsWithObstacles1+0x50>
mov    %rax,%rdi
mov    $0xff,%esi
mov    %r13,%rdx
call   1040 <memset@plt>
jmp    1180 <uniquePathsWithObstacles1+0x50>
mov    0x8(%rsp),%rbp
lea    -0x1(%rbp),%esi
lea    -0x1(%r15),%edx
mov    0x10(%rsp),%rdi
mov    %rbx,%rcx
call   1030 <traverse@plt>
movslq %ebp,%rax
mov    -0x8(%rbx,%rax,8),%rax
movslq %r15d,%rcx
mov    -0x4(%rax,%rcx,4),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @uniquePathsWithObstacles1(i32** %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32**
%8 = alloca i32
%9 = alloca i32
store i32** %0, i32*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32**
store i32** %15, i32*** %7
store i32 0, i32* %8
br label %16
16: ; preds = %48, %3
%17 = load i32, i32* %8
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %51
20: ; preds = %16
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = mul i64 4, %22
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to i32*
%27 = load i32**, i32*** %7
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32*, i32** %27, i64 %29
store i32* %26, i32** %30
store i32 0, i32* %9
br label %31
31: ; preds = %44, %20
%32 = load i32, i32* %9
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %47
35: ; preds = %31
%36 = load i32**, i32*** %7
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32*, i32** %36, i64 %38
%40 = load i32*, i32** %39
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
store i32 -1, i32* %43
br label %44
44: ; preds = %35
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %31
47: ; preds = %31
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %16
51: ; preds = %16
%52 = load i32**, i32*** %4
%53 = load i32, i32* %5
%54 = sub nsw i32 %53, 1
%55 = load i32, i32* %6
%56 = sub nsw i32 %55, 1
%57 = load i32**, i32*** %7
%58 = call i32 @traverse(i32** %52, i32 %54, i32 %56, i32** %57)
%59 = load i32**, i32*** %7
%60 = load i32, i32* %5
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32*, i32** %59, i64 %62
%64 = load i32*, i32** %63
%65 = load i32, i32* %6
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %64, i64 %67
%69 = load i32, i32* %68
ret i32 %69
}

LLVM IR (-O2):
define i32 @uniquePathsWithObstacles1(i32** %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 3
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i32**
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = shl i32 %2, 2
%10 = icmp sgt i32 %2, 0
%11 = zext i32 %2 to i64
%12 = shl nuw nsw i64 %11, 2
%13 = zext i32 %1 to i64
br label %24
14: ; preds = %31, %3
%15 = add nsw i32 %1, -1
%16 = add nsw i32 %2, -1
%17 = tail call i32 @traverse(i32** %0, i32 %15, i32 %16, i32** %6)
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds i32*, i32** %6, i64 %18
%20 = load i32*, i32** %19
%21 = sext i32 %16 to i64
%22 = getelementptr inbounds i32, i32* %20, i64 %21
%23 = load i32, i32* %22
ret i32 %23
24: ; preds = %8, %31
%25 = phi i64 [ 0, %8 ], [ %32, %31 ]
%26 = tail call i64 @malloc(i32 %9)
%27 = inttoptr i64 %26 to i32*
%28 = getelementptr inbounds i32*, i32** %6, i64 %25
store i32* %27, i32** %28
br i1 %10, label %29, label %31
29: ; preds = %24
%30 = inttoptr i64 %26 to i8*
br label %31
31: ; preds = %29, %24
%32 = add nuw nsw i64 %25, 1
%33 = icmp eq i64 %32, %13
br i1 %33, label %14, label %24
}