#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*/ Periodic_XZ(double *, int, int, int, int, int);
int /*<<< orphan*/ Periodic_YZ(double *, int, int, int, int, int);
void Phi_2D_BC_1(double *phi, int nX, int nY, double delta_x) {
  Periodic_XZ(phi, nX, nY, 1, 1, (nY - 3));
  Periodic_XZ(phi, nX, nY, 1, (nY - 2), 2);
  Periodic_YZ(phi, nX, nY, 1, 1, (nX - 3));
  Periodic_YZ(phi, nX, nY, 1, (nX - 2), 2);
  Periodic_XZ(phi, nX, nY, 1, 0, (nY - 4));
  Periodic_XZ(phi, nX, nY, 1, (nY - 1), 3);
  Periodic_YZ(phi, nX, nY, 1, 0, (nX - 4));
  Periodic_YZ(phi, nX, nY, 1, (nX - 1), 3);
}


x86 assembly (clang, -O0):
<Phi_2D_BC_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r9d
sub    $0x3,%r9d
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1040 <Periodic_XZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x2,%r8d
mov    $0x1,%ecx
mov    $0x2,%r9d
call   1040 <Periodic_XZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r9d
sub    $0x3,%r9d
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <Periodic_YZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r8d
sub    $0x2,%r8d
mov    $0x1,%ecx
mov    $0x2,%r9d
call   1030 <Periodic_YZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r9d
sub    $0x4,%r9d
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1040 <Periodic_XZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%r8d
sub    $0x1,%r8d
mov    $0x1,%ecx
mov    $0x3,%r9d
call   1040 <Periodic_XZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r9d
sub    $0x4,%r9d
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <Periodic_YZ@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r8d
sub    $0x1,%r8d
mov    $0x1,%ecx
mov    $0x3,%r9d
call   1030 <Periodic_YZ@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Phi_2D_BC_1>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
lea    -0x3(%r14),%r9d
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1040 <Periodic_XZ@plt>
lea    -0x2(%r14),%r8d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
mov    $0x2,%r9d
call   1040 <Periodic_XZ@plt>
lea    -0x3(%rbx),%r9d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <Periodic_YZ@plt>
lea    -0x2(%rbx),%r8d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
mov    $0x2,%r9d
call   1030 <Periodic_YZ@plt>
lea    -0x4(%r14),%r9d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1040 <Periodic_XZ@plt>
lea    -0x1(%r14),%r8d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
mov    $0x3,%r9d
call   1040 <Periodic_XZ@plt>
lea    -0x4(%rbx),%r9d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <Periodic_YZ@plt>
lea    -0x1(%rbx),%r8d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%ecx
mov    $0x3,%r9d
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <Periodic_YZ@plt>

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

LLVM IR (-O2):
define void @Phi_2D_BC_1(double* %0, i32 %1, i32 %2, double %3) {
%5 = add nsw i32 %2, -3
%6 = tail call i32 @Periodic_XZ(double* %0, i32 %1, i32 %2, i32 1, i32 1, i32 %5)
%7 = add nsw i32 %2, -2
%8 = tail call i32 @Periodic_XZ(double* %0, i32 %1, i32 %2, i32 1, i32 %7, i32 2)
%9 = add nsw i32 %1, -3
%10 = tail call i32 @Periodic_YZ(double* %0, i32 %1, i32 %2, i32 1, i32 1, i32 %9)
%11 = add nsw i32 %1, -2
%12 = tail call i32 @Periodic_YZ(double* %0, i32 %1, i32 %2, i32 1, i32 %11, i32 2)
%13 = add nsw i32 %2, -4
%14 = tail call i32 @Periodic_XZ(double* %0, i32 %1, i32 %2, i32 1, i32 0, i32 %13)
%15 = add nsw i32 %2, -1
%16 = tail call i32 @Periodic_XZ(double* %0, i32 %1, i32 %2, i32 1, i32 %15, i32 3)
%17 = add nsw i32 %1, -4
%18 = tail call i32 @Periodic_YZ(double* %0, i32 %1, i32 %2, i32 1, i32 0, i32 %17)
%19 = add nsw i32 %1, -1
%20 = tail call i32 @Periodic_YZ(double* %0, i32 %1, i32 %2, i32 1, i32 %19, i32 3)
ret void
}