#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*/ free(char *);
char *rBve99009253050923_br_build_path(char *, char *);
char *rBve99009253050923_br_find_data_dir(char const *);
char *strdup(char const *);
char *rBve99009253050923_br_find_locale_dir(const char *default_locale_dir) {
  char *data_dir, *dir;
  data_dir = rBve99009253050923_br_find_data_dir((const char *)((char *)0));
  if (data_dir == (char *)((char *)0)) {
    if (default_locale_dir != (const char *)((char *)0))
      return strdup(default_locale_dir);
    else
      return (char *)((char *)0);
  }
  dir = rBve99009253050923_br_build_path(data_dir, "locale");
  free(data_dir);
  return dir;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <rBve99009253050923_br_find_data_dir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118e <rBve99009253050923_br_find_locale_dir+0x4e>
cmpq   $0x0,-0x10(%rbp)
je     1181 <rBve99009253050923_br_find_locale_dir+0x41>
mov    -0x10(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11b3 <rBve99009253050923_br_find_locale_dir+0x73>
movq   $0x0,-0x8(%rbp)
jmp    11b3 <rBve99009253050923_br_find_locale_dir+0x73>
mov    -0x18(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1050 <rBve99009253050923_br_build_path@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <rBve99009253050923_br_find_data_dir@plt>
test   %rax,%rax
je     117b <rBve99009253050923_br_find_locale_dir+0x3b>
mov    %rax,%rbx
lea    0xea3(%rip),%rsi
mov    %rax,%rdi
call   1050 <rBve99009253050923_br_build_path@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
test   %r14,%r14
je     118f <rBve99009253050923_br_find_locale_dir+0x4f>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <strdup@plt>
xor    %eax,%eax
jmp    1173 <rBve99009253050923_br_find_locale_dir+0x33>

LLVM IR (-O0):
@.str = [7 x i8] c"locale\00"
define i8* @rBve99009253050923_br_find_locale_dir(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = call i8* @rBve99009253050923_br_find_data_dir(i8* null)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i8*, i8** %3
%14 = call i8* @strdup(i8* %13)
store i8* %14, i8** %2
br label %22
15: ; preds = %9
store i8* null, i8** %2
br label %22
16: ; preds = %1
%17 = load i8*, i8** %4
%18 = call i8* @rBve99009253050923_br_build_path(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %18, i8** %5
%19 = load i8*, i8** %4
%20 = call i32 @free(i8* %19)
%21 = load i8*, i8** %5
store i8* %21, i8** %2
br label %22
22: ; preds = %16, %15, %12
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@.str = [7 x i8] c"locale\00"
define i8* @rBve99009253050923_br_find_locale_dir(i8* %0) {
%2 = tail call i8* @rBve99009253050923_br_find_data_dir(i8* null)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = icmp eq i8* %0, null
br i1 %5, label %11, label %6
6: ; preds = %4
%7 = tail call i8* @strdup(i8* %0)
br label %11
8: ; preds = %1
%9 = tail call i8* @rBve99009253050923_br_build_path(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @free(i8* %2)
br label %11
11: ; preds = %4, %8, %6
%12 = phi i8* [ %7, %6 ], [ %9, %8 ], [ null, %4 ]
ret i8* %12
}