#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 */
typedef int /*<<< orphan*/ UDPXY;
typedef int /*<<< orphan*/ UDPXREC;

/* Variables and functions */
char *basename(char *const);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strncmp(char const *, char const *, int);
int udpxrec_main(int, char *const *);
int udpxy_main(int, char *const *);
int main(int argc, char *const argv[]) {
  static const char UDPXY[] = "udpxy";
  static const char UDPXREC[] = "udpxrec";
  const char *app = basename(argv[0]);
  if (0 == strncmp(UDPXY, app, sizeof(UDPXY)))
    return udpxy_main(argc, argv);
  else if (0 == strncmp(UDPXREC, app, sizeof(UDPXREC)))
    return udpxrec_main(argc, argv);
  (void)fprintf(stderr,
                "Unsupported udpxy module [%s]\n"
                "Supported modules are [%s,%s]",
                app, UDPXY, UDPXREC);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <basename@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe7f(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11ad <main+0x5d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <udpxy_main@plt>
mov    %eax,-0x4(%rbp)
jmp    1217 <main+0xc7>
mov    -0x18(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11e4 <main+0x94>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <udpxrec_main@plt>
mov    %eax,-0x4(%rbp)
jmp    1217 <main+0xc7>
jmp    11e9 <main+0x99>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe11(%rip),%rsi
lea    0xdfc(%rip),%rcx
lea    0xdfb(%rip),%r8
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1050 <basename@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%rdi
mov    %rax,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11c6 <main+0x76>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d4 <main+0x84>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
lea    0xe53(%rip),%rcx
lea    0xe52(%rip),%r8
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <udpxy_main@plt>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <udpxrec_main@plt>

LLVM IR (-O0):
@main.UDPXY = internal constant [6 x i8] c"udpxy\00"
@main.UDPXREC = internal constant [8 x i8] c"udpxrec\00"
@stderr = global i32 0
@.str = [60 x i8] c"Unsupported udpxy module [%s]\0ASupported modules are [%s,%s]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i8* @basename(i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @main.UDPXY, i64 0, i64 0), i8* %11, i32 6)
%13 = icmp eq i64 0, %12
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @udpxy_main(i32 %15, i8** %16)
store i32 %17, i32* %3
br label %31
18: ; preds = %2
%19 = load i8*, i8** %6
%20 = call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @main.UDPXREC, i64 0, i64 0), i8* %19, i32 8)
%21 = icmp eq i64 0, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @udpxrec_main(i32 %23, i8** %24)
store i32 %25, i32* %3
br label %31
26: ; preds = %18
br label %27
27: ; preds = %26
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %6
%30 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @main.UDPXY, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @main.UDPXREC, i64 0, i64 0))
store i32 1, i32* %3
br label %31
31: ; preds = %27, %22, %14
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@main.UDPXY = internal constant [6 x i8] c"udpxy\00"
@main.UDPXREC = internal constant [8 x i8] c"udpxrec\00"
@stderr = global i32 0
@.str = [60 x i8] c"Unsupported udpxy module [%s]\0ASupported modules are [%s,%s]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* @basename(i8* %3)
%5 = tail call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @main.UDPXY, i64 0, i64 0), i8* %4, i32 6)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @udpxy_main(i32 %0, i8** %1)
br label %17
9: ; preds = %2
%10 = tail call i64 @strncmp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @main.UDPXREC, i64 0, i64 0), i8* %4, i32 8)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @udpxrec_main(i32 %0, i8** %1)
br label %17
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @main.UDPXY, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @main.UDPXREC, i64 0, i64 0))
br label %17
17: ; preds = %14, %12, %7
%18 = phi i32 [ %8, %7 ], [ %13, %12 ], [ 1, %14 ]
ret i32 %18
}