#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*/ LC_ALL;
int /*<<< orphan*/ bindtextdomain(char *, int /*<<< orphan*/);
int /*<<< orphan*/ getenv(char *);
char *gettext(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ textdomain(char *);
int main(int argc, char *argv[]) {
  setlocale(LC_ALL, "");
  bindtextdomain("HelloWorld", getenv("PWD"));
  textdomain("HelloWorld");
  printf(gettext("Hello World\n"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe95(%rip),%rsi
call   1080 <setlocale@plt>
lea    0xe79(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%esi
lea    0xe60(%rip),%rdi
call   1050 <bindtextdomain@plt>
lea    0xe54(%rip),%rdi
call   1040 <textdomain@plt>
lea    0xe57(%rip),%rdi
call   1060 <gettext@plt>
mov    %rax,%rdi
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1080 <setlocale@plt>
lea    0xe8e(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe77(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <bindtextdomain@plt>
mov    %rbx,%rdi
call   1040 <textdomain@plt>
lea    0xe6d(%rip),%rdi
call   1060 <gettext@plt>
mov    %rax,%rdi
call   1070 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [11 x i8] c"HelloWorld\00"
@.str.2 = [4 x i8] c"PWD\00"
@.str.3 = [13 x i8] c"Hello World\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @LC_ALL
%7 = call i32 @setlocale(i32 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @bindtextdomain(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @textdomain(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = call i8* @gettext(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* %11)
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [11 x i8] c"HelloWorld\00"
@.str.2 = [4 x i8] c"PWD\00"
@.str.3 = [13 x i8] c"Hello World\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @LC_ALL
%4 = tail call i32 @setlocale(i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @bindtextdomain(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @textdomain(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i8* @gettext(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) %8)
ret i32 0
}