#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 move(int, int, int *, int /*<<< orphan*/, int /*<<< orphan*/);
int move_dyn(int, int, int *);
int move_mem(int, int, int *, int *, int /*<<< orphan*/, int /*<<< orphan*/);
int test_partially_blocked() {
  int grid[] = {1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1,
                0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1};
  int mem[25] = {0};
  return 1 == move(5, 5, grid, 0, 0) && 1 == move_mem(5, 5, grid, mem, 0, 0) &&
         1 == move_dyn(5, 5, grid);
}


x86 assembly (clang, -O0):
<test_partially_blocked>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
lea    -0x70(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x64,%edx
call   1040 <memcpy@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1030 <memset@plt>
lea    -0x70(%rbp),%rdx
mov    $0x5,%esi
xor    %r8d,%r8d
mov    %esi,%edi
mov    %r8d,%ecx
call   1070 <move@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0xe1(%rbp)
jne    1206 <test_partially_blocked+0xb6>
lea    -0x70(%rbp),%rdx
lea    -0xe0(%rbp),%rcx
mov    $0x5,%esi
xor    %r9d,%r9d
mov    %esi,%edi
mov    %r9d,%r8d
call   1060 <move_mem@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %edx,%ecx
mov    %al,-0xe1(%rbp)
jne    1206 <test_partially_blocked+0xb6>
lea    -0x70(%rbp),%rdx
mov    $0x5,%esi
mov    %esi,%edi
call   1050 <move_dyn@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_partially_blocked>:
push   %rbx
sub    $0xe0,%rsp
mov    0xf22(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xf07(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe7b(%rip),%xmm0
movaps %xmm0,(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movl   $0x0,0xd0(%rsp)
mov    %rsp,%rdx
xor    %ebx,%ebx
mov    $0x5,%edi
mov    $0x5,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <move@plt>
cmp    $0x1,%eax
jne    1220 <test_partially_blocked+0xf0>
mov    %rsp,%rdx
lea    0x70(%rsp),%rcx
xor    %ebx,%ebx
mov    $0x5,%edi
mov    $0x5,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <move_mem@plt>
cmp    $0x1,%eax
jne    1220 <test_partially_blocked+0xf0>
mov    %rsp,%rdx
mov    $0x5,%edi
mov    $0x5,%esi
call   1030 <move_dyn@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
mov    %ebx,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test_partially_blocked.grid = [25 x i32] [i32 1, i32 1, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1, i32 1]
define i32 @test_partially_blocked() {
%1 = alloca [25 x i32]
%2 = alloca [25 x i32]
%3 = bitcast [25 x i32]* %1 to i8*
%4 = bitcast [25 x i32]* %2 to i8*
%5 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 0
%6 = call i32 @move(i32 5, i32 5, i32* %5, i32 0, i32 0)
%7 = icmp eq i32 1, %6
br i1 %7, label %8, label %17
8: ; preds = %0
%9 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 0
%10 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 0
%11 = call i32 @move_mem(i32 5, i32 5, i32* %9, i32* %10, i32 0, i32 0)
%12 = icmp eq i32 1, %11
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 0
%15 = call i32 @move_dyn(i32 5, i32 5, i32* %14)
%16 = icmp eq i32 1, %15
br label %17
17: ; preds = %13, %8, %0
%18 = phi i1 [ false, %8 ], [ false, %0 ], [ %16, %13 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
@__const.test_partially_blocked.grid = [25 x i32] [i32 1, i32 1, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1, i32 1]
define i32 @test_partially_blocked() {
%1 = alloca [25 x i32]
%2 = alloca [25 x i32]
%3 = bitcast [25 x i32]* %1 to i8*
%4 = bitcast [25 x i32]* %2 to i8*
%5 = getelementptr inbounds [25 x i32], [25 x i32]* %1, i64 0, i64 0
%6 = call i32 @move(i32 5, i32 5, i32* %5, i32 0, i32 0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %16
8: ; preds = %0
%9 = getelementptr inbounds [25 x i32], [25 x i32]* %2, i64 0, i64 0
%10 = call i32 @move_mem(i32 5, i32 5, i32* %5, i32* %9, i32 0, i32 0)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = call i32 @move_dyn(i32 5, i32 5, i32* %5)
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %8, %0
%17 = phi i32 [ 0, %8 ], [ 0, %0 ], [ %15, %12 ]
ret i32 %17
}