#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 SASJoinRegion();
int SASJoinRegionByName(char *);
int /*<<< orphan*/ sasutil_fatal_error(char *, char const *, int);
void sasutil_join_region(const char *storepath) {
  const char *funcName;
  int rc;
  if (storepath) {
    rc = SASJoinRegionByName((char *)storepath);
    funcName = "SASJoinRegionByName";
  } else {
    rc = SASJoinRegion();
    funcName = "SASJoinRegion";
  }
  if (rc) {
    sasutil_fatal_error("%s failed: %i\n", funcName, rc);
  }
}


x86 assembly (clang, -O0):
<sasutil_join_region>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1163 <sasutil_join_region+0x33>
mov    -0x8(%rbp),%rdi
call   1040 <SASJoinRegionByName@plt>
mov    %eax,-0x14(%rbp)
lea    0xea6(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <sasutil_join_region+0x48>
mov    $0x0,%al
call   1050 <SASJoinRegion@plt>
mov    %eax,-0x14(%rbp)
lea    0xea0(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1195 <sasutil_join_region+0x65>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xe92(%rip),%rdi
call   1030 <sasutil_fatal_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sasutil_join_region>:
push   %rax
test   %rdi,%rdi
je     1155 <sasutil_join_region+0x25>
call   1040 <SASJoinRegionByName@plt>
lea    0xebe(%rip),%rsi
test   %eax,%eax
je     1167 <sasutil_join_region+0x37>
lea    0xed5(%rip),%rdi
mov    %eax,%edx
pop    %rax
jmp    1030 <sasutil_fatal_error@plt>
xor    %eax,%eax
call   1050 <SASJoinRegion@plt>
lea    0xeb1(%rip),%rsi
test   %eax,%eax
jne    1146 <sasutil_join_region+0x16>
pop    %rax
ret

LLVM IR (-O0):
@.str = [20 x i8] c"SASJoinRegionByName\00"
@.str.1 = [14 x i8] c"SASJoinRegion\00"
@.str.2 = [15 x i8] c"%s failed: %i\0A\00"
define void @sasutil_join_region(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @SASJoinRegionByName(i8* %8)
store i32 %9, i32* %4
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %3
br label %12
10: ; preds = %1
%11 = call i32 (...) @SASJoinRegion()
store i32 %11, i32* %4
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = load i32, i32* %4
%18 = call i32 @sasutil_fatal_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %16, i32 %17)
br label %19
19: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"SASJoinRegionByName\00"
@.str.1 = [14 x i8] c"SASJoinRegion\00"
@.str.2 = [15 x i8] c"%s failed: %i\0A\00"
define void @sasutil_join_region(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @SASJoinRegionByName(i8* %0)
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @SASJoinRegion()
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %5 ]
%9 = phi i32 [ %4, %3 ], [ %6, %5 ]
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @sasutil_fatal_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %8, i32 %9)
br label %13
13: ; preds = %11, %7
ret void
}