#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*/ assert(int /*<<< orphan*/);
int **flipAndInvertImage(int **, int, int *, int **, int *);
int main(int argc, char **argv) {
  int a1[] = {1, 1, 0};
  int a2[] = {1, 0, 1};
  int a3[] = {0, 0, 0};
  int *A[] = {a1, a2, a3};
  int ARowSize = 3;
  int AColSizes[] = {3, 3, 3};
  int *columnSizes = NULL;
  int returnSize = 0;
  int **retval = flipAndInvertImage((int **)A, ARowSize, AColSizes,
                                    &columnSizes, &returnSize);
  assert(retval != NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xeae(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea6(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x34(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
lea    -0x1c(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x34(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x3,-0x54(%rbp)
mov    0xe71(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe6f(%rip),%eax
mov    %eax,-0x58(%rbp)
movq   $0x0,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
lea    -0x60(%rbp),%rdx
lea    -0x68(%rbp),%rcx
lea    -0x6c(%rbp),%r8
call   1040 <flipAndInvertImage@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x48(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x40(%rsp)
mov    0xed4(%rip),%eax
mov    %eax,0x38(%rsp)
mov    0xec1(%rip),%rax
mov    %rax,0x30(%rsp)
movl   $0x0,0x28(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x40(%rsp),%rax
mov    %rax,0x50(%rsp)
lea    0x30(%rsp),%rax
mov    %rax,0x58(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,0x60(%rsp)
mov    0xe9b(%rip),%eax
mov    %eax,0x18(%rsp)
mov    0xe88(%rip),%rax
mov    %rax,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x50(%rsp),%rdi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    $0x3,%esi
call   1030 <flipAndInvertImage@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.main.a1 = [3 x i32] [i32 1, i32 1, i32 0]
@__const.main.a2 = [3 x i32] [i32 1, i32 0, i32 1]
@__const.main.AColSizes = [3 x i32] [i32 3, i32 3, i32 3]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i32]
%7 = alloca [3 x i32]
%8 = alloca [3 x i32]
%9 = alloca [3 x i32*]
%10 = alloca i32
%11 = alloca [3 x i32]
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [3 x i32]* %6 to i8*
%16 = bitcast [3 x i32]* %7 to i8*
%17 = bitcast [3 x i32]* %8 to i8*
%18 = getelementptr inbounds [3 x i32*], [3 x i32*]* %9, i64 0, i64 0
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
store i32* %19, i32** %18
%20 = getelementptr inbounds i32*, i32** %18, i64 1
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32* %21, i32** %20
%22 = getelementptr inbounds i32*, i32** %20, i64 1
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
store i32* %23, i32** %22
store i32 3, i32* %10
%24 = bitcast [3 x i32]* %11 to i8*
store i32* null, i32** %12
store i32 0, i32* %13
%25 = getelementptr inbounds [3 x i32*], [3 x i32*]* %9, i64 0, i64 0
%26 = load i32, i32* %10
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 0
%28 = call i32** @flipAndInvertImage(i32** %25, i32 %26, i32* %27, i32** %12, i32* %13)
store i32** %28, i32*** %14
%29 = load i32**, i32*** %14
%30 = icmp ne i32** %29, null
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a1 = [3 x i32] [i32 1, i32 1, i32 0]
@__const.main.a2 = [3 x i32] [i32 1, i32 0, i32 1]
@__const.main.AColSizes = [3 x i32] [i32 3, i32 3, i32 3]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i32]
%4 = alloca [3 x i32]
%5 = alloca [3 x i32]
%6 = alloca [3 x i32*]
%7 = alloca [3 x i32]
%8 = alloca i32*
%9 = alloca i32
%10 = bitcast [3 x i32]* %3 to i8*
%11 = bitcast [3 x i32]* %4 to i8*
%12 = bitcast [3 x i32]* %5 to i8*
%13 = bitcast [3 x i32*]* %6 to i8*
%14 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 0
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32* %15, i32** %14
%16 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 1
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32* %17, i32** %16
%18 = getelementptr inbounds [3 x i32*], [3 x i32*]* %6, i64 0, i64 2
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
store i32* %19, i32** %18
%20 = bitcast [3 x i32]* %7 to i8*
%21 = bitcast i32** %8 to i8*
store i32* null, i32** %8
%22 = bitcast i32* %9 to i8*
store i32 0, i32* %9
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%24 = call i32** @flipAndInvertImage(i32** %14, i32 3, i32* %23, i32** %8, i32* %9)
%25 = icmp ne i32** %24, null
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
ret i32 0
}