#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*/ sub(int **, int /*<<< orphan*/, int /*<<< orphan*/, int,
                       int);
int uniquePathsWithObstacles(int **obstacleGrid, int obstacleGridRowSize,
                             int obstacleGridColSize) {
  if (!obstacleGrid || !obstacleGridRowSize || !obstacleGridColSize)
    return 0;
  else if (1 ==
               obstacleGrid[obstacleGridRowSize - 1][obstacleGridColSize - 1] ||
           1 == obstacleGrid[0][0])
    return 0;
  else if (1 == obstacleGridRowSize && 1 == obstacleGridColSize)
    return 1;
  obstacleGrid[obstacleGridRowSize - 1][obstacleGridColSize - 1] = ~1;
  sub(obstacleGrid, 0, 0, obstacleGridColSize, obstacleGridRowSize);
  return ~obstacleGrid[0][0];
}


x86 assembly (clang, -O0):
<uniquePathsWithObstacles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1141 <uniquePathsWithObstacles+0x31>
cmpl   $0x0,-0x14(%rbp)
je     1141 <uniquePathsWithObstacles+0x31>
cmpl   $0x0,-0x18(%rbp)
jne    114d <uniquePathsWithObstacles+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    120b <uniquePathsWithObstacles+0xfb>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
mov    $0x1,%eax
cmp    (%rcx,%rdx,4),%eax
je     1189 <uniquePathsWithObstacles+0x79>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    $0x1,%eax
cmp    (%rcx),%eax
jne    1195 <uniquePathsWithObstacles+0x85>
movl   $0x0,-0x4(%rbp)
jmp    120b <uniquePathsWithObstacles+0xfb>
mov    $0x1,%eax
cmp    -0x14(%rbp),%eax
jne    11bd <uniquePathsWithObstacles+0xad>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
jne    11bd <uniquePathsWithObstacles+0xad>
movl   $0x1,-0x4(%rbp)
jmp    120b <uniquePathsWithObstacles+0xfb>
jmp    11c2 <uniquePathsWithObstacles+0xb2>
jmp    11c7 <uniquePathsWithObstacles+0xb7>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0xfffffffe,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
xor    %edx,%edx
mov    %edx,%esi
call   1030 <sub@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniquePathsWithObstacles>:
push   %rbx
xor    %eax,%eax
test   %rdi,%rdi
je     1152 <uniquePathsWithObstacles+0x42>
mov    %esi,%r8d
test   %esi,%esi
je     1152 <uniquePathsWithObstacles+0x42>
mov    %edx,%ecx
test   %edx,%edx
je     1152 <uniquePathsWithObstacles+0x42>
mov    %rdi,%rbx
movslq %r8d,%rdx
mov    -0x8(%rdi,%rdx,8),%rdx
movslq %ecx,%rsi
cmpl   $0x1,-0x4(%rdx,%rsi,4)
je     1152 <uniquePathsWithObstacles+0x42>
mov    (%rbx),%rdi
cmpl   $0x1,(%rdi)
je     1152 <uniquePathsWithObstacles+0x42>
cmp    $0x1,%r8d
jne    1154 <uniquePathsWithObstacles+0x44>
mov    $0x1,%eax
cmp    $0x1,%ecx
jne    1154 <uniquePathsWithObstacles+0x44>
pop    %rbx
ret
add    $0xffffffffffffffff,%rsi
movl   $0xfffffffe,(%rdx,%rsi,4)
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <sub@plt>
mov    (%rbx),%rax
mov    (%rax),%eax
not    %eax
pop    %rbx
ret

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

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