#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 const, int const, int const,
                                      int const, int const, int);
void ecc200placementcornerA(int *array, const int NR, const int NC,
                            const int p) {
  ecc200placementbit(array, NR, NC, NR - 1, 0, p, 7);
  ecc200placementbit(array, NR, NC, NR - 1, 1, p, 6);
  ecc200placementbit(array, NR, NC, NR - 1, 2, 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 - 1, p, 2);
  ecc200placementbit(array, NR, NC, 2, NC - 1, p, 1);
  ecc200placementbit(array, NR, NC, 3, 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    -0x14(%rbp),%r9d
mov    $0x1,%r8d
movl   $0x6,(%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    -0x14(%rbp),%r9d
mov    $0x2,%r8d
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    $0x1,%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    $0x1,%r8d
mov    -0x14(%rbp),%r9d
mov    $0x2,%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    $0x3,%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   %r12
push   %rbx
sub    $0x10,%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>
movl   $0x6,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    $0x1,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x5,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    $0x2,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
lea    -0x2(%rbx),%r8d
movl   $0x4,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
lea    -0x1(%rbx),%r12d
movl   $0x3,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x2,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x1,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x2,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
movl   $0x0,(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x3,%ecx
mov    %r12d,%r8d
mov    %r14d,%r9d
call   1030 <ecc200placementbit@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ecc200placementcornerA(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* %8
%22 = call i32 @ecc200placementbit(i32* %16, i32 %17, i32 %18, i32 %20, i32 1, i32 %21, i32 6)
%23 = load i32*, i32** %5
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = sub nsw i32 %26, 1
%28 = load i32, i32* %8
%29 = call i32 @ecc200placementbit(i32* %23, i32 %24, i32 %25, i32 %27, i32 2, i32 %28, i32 5)
%30 = load i32*, i32** %5
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = load i32, i32* %7
%34 = sub nsw i32 %33, 2
%35 = load i32, i32* %8
%36 = call i32 @ecc200placementbit(i32* %30, i32 %31, i32 %32, i32 0, i32 %34, i32 %35, i32 4)
%37 = load i32*, i32** %5
%38 = load i32, i32* %6
%39 = load i32, i32* %7
%40 = load i32, i32* %7
%41 = sub nsw i32 %40, 1
%42 = load i32, i32* %8
%43 = call i32 @ecc200placementbit(i32* %37, i32 %38, i32 %39, i32 0, i32 %41, i32 %42, i32 3)
%44 = load i32*, i32** %5
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = load i32, i32* %7
%48 = sub nsw i32 %47, 1
%49 = load i32, i32* %8
%50 = call i32 @ecc200placementbit(i32* %44, i32 %45, i32 %46, i32 1, i32 %48, i32 %49, i32 2)
%51 = load i32*, i32** %5
%52 = load i32, i32* %6
%53 = load i32, i32* %7
%54 = load i32, i32* %7
%55 = sub nsw i32 %54, 1
%56 = load i32, i32* %8
%57 = call i32 @ecc200placementbit(i32* %51, i32 %52, i32 %53, i32 2, i32 %55, i32 %56, i32 1)
%58 = load i32*, i32** %5
%59 = load i32, i32* %6
%60 = load i32, i32* %7
%61 = load i32, i32* %7
%62 = sub nsw i32 %61, 1
%63 = load i32, i32* %8
%64 = call i32 @ecc200placementbit(i32* %58, i32 %59, i32 %60, i32 3, i32 %62, i32 %63, i32 0)
ret void
}

LLVM IR (-O2):
define void @ecc200placementcornerA(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 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 %5, i32 1, i32 %3, i32 6)
%8 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 %5, i32 2, i32 %3, i32 5)
%9 = add nsw i32 %2, -2
%10 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 0, i32 %9, i32 %3, i32 4)
%11 = add nsw i32 %2, -1
%12 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 0, i32 %11, i32 %3, i32 3)
%13 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 1, i32 %11, i32 %3, i32 2)
%14 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 2, i32 %11, i32 %3, i32 1)
%15 = tail call i32 @ecc200placementbit(i32* %0, i32 %1, i32 %2, i32 3, i32 %11, i32 %3, i32 0)
ret void
}