#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 */
struct domain {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ boundary_reflect_rinn(struct domain *);
int /*<<< orphan*/ boundary_reflect_rout(struct domain *);
int /*<<< orphan*/ boundary_reflect_zbot(struct domain *);
int /*<<< orphan*/ boundary_zerograd_ztop(struct domain *, int);
void boundary_trans(struct domain *theDomain, int dim) {
  if (dim == 1) {
    boundary_reflect_rinn(theDomain);
    boundary_reflect_rout(theDomain);
  } else if (dim == 2) {
    boundary_reflect_zbot(theDomain);
    boundary_zerograd_ztop(theDomain, 1);
  }
}


x86 assembly (clang, -O0):
<boundary_trans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1170 <boundary_trans+0x30>
mov    -0x8(%rbp),%rdi
call   1040 <boundary_reflect_rinn@plt>
mov    -0x8(%rbp),%rdi
call   1030 <boundary_reflect_rout@plt>
jmp    1196 <boundary_trans+0x56>
cmpl   $0x2,-0xc(%rbp)
jne    1191 <boundary_trans+0x51>
mov    -0x8(%rbp),%rdi
call   1060 <boundary_reflect_zbot@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1050 <boundary_zerograd_ztop@plt>
jmp    1196 <boundary_trans+0x56>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boundary_trans>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x2,%esi
je     115f <boundary_trans+0x1f>
cmp    $0x1,%esi
jne    1175 <boundary_trans+0x35>
mov    %rbx,%rdi
call   1040 <boundary_reflect_rinn@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <boundary_reflect_rout@plt>
mov    %rbx,%rdi
call   1060 <boundary_reflect_zbot@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1050 <boundary_zerograd_ztop@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.domain = type { i32 }
define void @boundary_trans(%struct.domain* %0, i32 %1) {
%3 = alloca %struct.domain*
%4 = alloca i32
store %struct.domain* %0, %struct.domain** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load %struct.domain*, %struct.domain** %3
%9 = call i32 @boundary_reflect_rinn(%struct.domain* %8)
%10 = load %struct.domain*, %struct.domain** %3
%11 = call i32 @boundary_reflect_rout(%struct.domain* %10)
br label %21
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load %struct.domain*, %struct.domain** %3
%17 = call i32 @boundary_reflect_zbot(%struct.domain* %16)
%18 = load %struct.domain*, %struct.domain** %3
%19 = call i32 @boundary_zerograd_ztop(%struct.domain* %18, i32 1)
br label %20
20: ; preds = %15, %12
br label %21
21: ; preds = %20, %7
ret void
}

LLVM IR (-O2):
%struct.domain = type { i32 }
define void @boundary_trans(%struct.domain* %0, i32 %1) {
switch i32 %1, label %9 [
i32 1, label %3
i32 2, label %6
]
3: ; preds = %2
%4 = tail call i32 @boundary_reflect_rinn(%struct.domain* %0)
%5 = tail call i32 @boundary_reflect_rout(%struct.domain* %0)
br label %9
6: ; preds = %2
%7 = tail call i32 @boundary_reflect_zbot(%struct.domain* %0)
%8 = tail call i32 @boundary_zerograd_ztop(%struct.domain* %0, i32 1)
br label %9
9: ; preds = %2, %6, %3
ret void
}