#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 EXIT_SUCCESS;
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ bindtextdomain(char *, char *);
char *getenv(char *);
int /*<<< orphan*/ receiver(int, char **);
int /*<<< orphan*/ sender(int, char **);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ textdomain(char *);
int main(int argc, char **argv) {
  setlocale(LC_ALL, "");
  char currentL10nFolder[200];
  sprintf(currentL10nFolder, "%s%s", getenv("PWD"), "/l10n");
  bindtextdomain("lanbeacon", currentL10nFolder);
  textdomain("lanbeacon");
  for (int current_arg = 1; current_arg < argc; current_arg++) {
    if (strcmp("-l", argv[current_arg]) == 0) {
      receiver(argc, argv);
      return EXIT_SUCCESS;
    } else {
      sender(argc, argv);
      return EXIT_SUCCESS;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1080 <setlocale@plt>
lea    -0xe0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
lea    0xe42(%rip),%rdi
call   1030 <getenv@plt>
mov    -0xf0(%rbp),%rdi
mov    %rax,%rdx
lea    0xe27(%rip),%rsi
lea    0xe29(%rip),%rcx
call   10a0 <sprintf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe1c(%rip),%rdi
call   1050 <bindtextdomain@plt>
lea    0xe10(%rip),%rdi
call   1040 <textdomain@plt>
movl   $0x1,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1277 <main+0xf7>
mov    -0x10(%rbp),%rax
movslq -0xe4(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xde6(%rip),%rdi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    125f <main+0xdf>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <receiver@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1277 <main+0xf7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <sender@plt>
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%r14
mov    %edi,%r15d
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
call   1080 <setlocale@plt>
lea    0xe56(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe45(%rip),%rsi
lea    0xe47(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   10a0 <sprintf@plt>
lea    0xe38(%rip),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <bindtextdomain@plt>
mov    %rbp,%rdi
call   1040 <textdomain@plt>
xor    %eax,%eax
cmp    $0x2,%r15d
jl     1222 <main+0xa2>
mov    0x8(%r14),%rsi
lea    0xe1c(%rip),%rdi
call   1060 <strcmp@plt>
mov    %r15d,%edi
mov    %r14,%rsi
test   %rax,%rax
je     1214 <main+0x94>
call   1090 <sender@plt>
jmp    1219 <main+0x99>
call   1070 <receiver@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [4 x i8] c"PWD\00"
@.str.3 = [6 x i8] c"/l10n\00"
@.str.4 = [10 x i8] c"lanbeacon\00"
@.str.5 = [3 x i8] c"-l\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [200 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @LC_ALL
%9 = call i32 @setlocale(i32 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%11 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%14 = call i32 @bindtextdomain(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = call i32 @textdomain(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %7
br label %16
16: ; preds = %38, %2
%17 = load i32, i32* %7
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %41
20: ; preds = %16
%21 = load i8**, i8*** %5
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %20
%29 = load i32, i32* %4
%30 = load i8**, i8*** %5
%31 = call i32 @receiver(i32 %29, i8** %30)
%32 = load i32, i32* @EXIT_SUCCESS
store i32 %32, i32* %3
br label %41
33: ; preds = %20
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = call i32 @sender(i32 %34, i8** %35)
%37 = load i32, i32* @EXIT_SUCCESS
store i32 %37, i32* %3
br label %41
38: ; No predecessors!
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %16
41: ; preds = %28, %33, %16
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [4 x i8] c"PWD\00"
@.str.3 = [6 x i8] c"/l10n\00"
@.str.4 = [10 x i8] c"lanbeacon\00"
@.str.5 = [3 x i8] c"-l\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [200 x i8]
%4 = load i32, i32* @LC_ALL
%5 = tail call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @bindtextdomain(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%10 = call i32 @textdomain(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%11 = icmp sgt i32 %0, 1
br i1 %11, label %12, label %23
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = call i32 @receiver(i32 %0, i8** %1)
%19 = load i32, i32* @EXIT_SUCCESS
br label %23
20: ; preds = %12
%21 = call i32 @sender(i32 %0, i8** %1)
%22 = load i32, i32* @EXIT_SUCCESS
br label %23
23: ; preds = %2, %20, %17
%24 = phi i32 [ %19, %17 ], [ %22, %20 ], [ 0, %2 ]
ret i32 %24
}