#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*/ ecc200placementbit(int *, int, int, int, int, int, int);
void ecc200placementcornerD(int *array, int NR, int NC, int p) {
  ecc200placementbit(array, NR, NC, NR - 1, 0, p, 7);
  ecc200placementbit(array, NR, NC, NR - 1, NC - 1, p, 6);
  ecc200placementbit(array, NR, NC, 0, NC - 3, p, 5);
  ecc200placementbit(array, NR, NC, 0, NC - 2, p, 4);
  ecc200placementbit(array, NR, NC, 0, NC - 1, p, 3);
  ecc200placementbit(array, NR, NC, 1, NC - 3, p, 2);
  ecc200placementbit(array, NR, NC, 1, NC - 2, p, 1);
  ecc200placementbit(array, NR, NC, 1, NC - 1, p, 0);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x14(%rbp),%r9d
xor    %r8d,%r8d
movl   $0x7,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x14(%rbp),%r9d
movl   $0x6,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x3,%r8d
mov    -0x14(%rbp),%r9d
xor    %ecx,%ecx
movl   $0x5,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x2,%r8d
mov    -0x14(%rbp),%r9d
xor    %ecx,%ecx
movl   $0x4,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x14(%rbp),%r9d
xor    %ecx,%ecx
movl   $0x3,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x3,%r8d
mov    -0x14(%rbp),%r9d
mov    $0x1,%ecx
movl   $0x2,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x2,%r8d
mov    -0x14(%rbp),%r9d
mov    $0x1,%ecx
movl   $0x1,(%rsp)
call   1030 <ecc200placementbit@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x14(%rbp),%r9d
mov    $0x1,%ecx
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <ecc200placementbit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r15
lea    -0x1(%rbp),%r12d
movl   $0x7,(%rsp)
mov    %r12d,%ecx
xor    %r8d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
lea    -0x1(%rbx),%r13d
movl   $0x6,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
lea    -0x3(%rbx),%r8d
mov    %r8d,0x14(%rsp)
movl   $0x5,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
lea    -0x2(%rbx),%r12d
movl   $0x4,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x3,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x2,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    0x14(%rsp),%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x1,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x0,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    %r13d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ecc200placementcornerD(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, -1
%6 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 %5, i32 0, i32 %3, i32 7)
%7 = add nsw i32 %2, -1
%8 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 %5, i32 %7, i32 %3, i32 6)
%9 = add nsw i32 %2, -3
%10 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 0, i32 %9, i32 %3, i32 5)
%11 = add nsw i32 %2, -2
%12 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 0, i32 %11, i32 %3, i32 4)
%13 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 0, i32 %7, i32 %3, i32 3)
%14 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 1, i32 %9, i32 %3, i32 2)
%15 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 1, i32 %11, i32 %3, i32 1)
%16 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 1, i32 %7, i32 %3, i32 0)
ret void
}