#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*/ appaserver_output_starting_argv_append_file(int, char **,
                                                               char *);
int atoi(char *);
char *environ_get_application_name(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ shef_upload_datatype_convert_one_time(char *, char *,
                                                         char *);
int /*<<< orphan*/ shef_upload_datatype_convert_stdin(char *, int, int, char);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *application_name;
  application_name = environ_get_application_name(argv[0]);
  appaserver_output_starting_argv_append_file(argc, argv, application_name);
  if (argc == 3) {
    char *station_name;
    char *shef_upload_code;
    station_name = argv[1];
    shef_upload_code = argv[2];
    shef_upload_datatype_convert_one_time(application_name, station_name,
                                          shef_upload_code);
  } else if (argc == 4) {
    int station_piece;
    int shef_code_piece;
    char delimiter;
    station_piece = atoi(argv[1]);
    shef_code_piece = atoi(argv[2]);
    delimiter = *argv[3];
    shef_upload_datatype_convert_stdin(application_name, station_piece,
                                       shef_code_piece, delimiter);
  } else {
    fprintf(stderr,
            "Usage: %s [station shef_upload_code] | [station_piece "
            "shef_code_piece delimiter]\n",
            argv[0]);
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <environ_get_application_name@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <appaserver_output_starting_argv_append_file@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11de <main+0x6e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <shef_upload_datatype_convert_one_time@plt>
jmp    1258 <main+0xe8>
cmpl   $0x4,-0x8(%rbp)
jne    122d <main+0xbd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    (%rax),%al
mov    %al,-0x31(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
movsbl -0x31(%rbp),%ecx
call   1030 <shef_upload_datatype_convert_stdin@plt>
jmp    1253 <main+0xe3>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdbc(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1258 <main+0xe8>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1070 <environ_get_application_name@plt>
mov    %rax,%r14
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1060 <appaserver_output_starting_argv_append_file@plt>
cmp    $0x4,%ebp
je     11ad <main+0x3d>
cmp    $0x3,%ebp
jne    11db <main+0x6b>
mov    0x8(%rbx),%rsi
mov    0x10(%rbx),%rdx
mov    %r14,%rdi
call   1040 <shef_upload_datatype_convert_one_time@plt>
jmp    11d4 <main+0x64>
mov    0x8(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    0x18(%rbx),%rcx
movsbl (%rcx),%ecx
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <shef_upload_datatype_convert_stdin@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe12(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [82 x i8] c"Usage: %s [station shef_upload_code] | [station_piece shef_code_piece delimiter]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i8* @environ_get_application_name(i8* %14)
store i8* %15, i8** %6
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = load i8*, i8** %6
%19 = call i32 @appaserver_output_starting_argv_append_file(i32 %16, i8** %17, i8* %18)
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %33
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
store i8* %25, i8** %7
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
store i8* %28, i8** %8
%29 = load i8*, i8** %6
%30 = load i8*, i8** %7
%31 = load i8*, i8** %8
%32 = call i32 @shef_upload_datatype_convert_one_time(i8* %29, i8* %30, i8* %31)
br label %62
33: ; preds = %2
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %54
36: ; preds = %33
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %9
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %10
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 3
%47 = load i8*, i8** %46
%48 = load i8, i8* %47
store i8 %48, i8* %11
%49 = load i8*, i8** %6
%50 = load i32, i32* %9
%51 = load i32, i32* %10
%52 = load i8, i8* %11
%53 = call i32 @shef_upload_datatype_convert_stdin(i8* %49, i32 %50, i32 %51, i8 signext %52)
br label %61
54: ; preds = %33
%55 = load i32, i32* @stderr
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i8* %58)
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %36
br label %62
62: ; preds = %61, %22
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [82 x i8] c"Usage: %s [station shef_upload_code] | [station_piece shef_code_piece delimiter]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i8* @environ_get_application_name(i8* %3)
%5 = tail call i32 @appaserver_output_starting_argv_append_file(i32 %0, i8** %1, i8* %4)
switch i32 %0, label %23 [
i32 3, label %6
i32 4, label %12
]
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32 @shef_upload_datatype_convert_one_time(i8* %4, i8* %8, i8* %10)
br label %28
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = getelementptr inbounds i8*, i8** %1, i64 3
%20 = load i8*, i8** %19
%21 = load i8, i8* %20
%22 = tail call i32 @shef_upload_datatype_convert_stdin(i8* %4, i32 %15, i32 %18, i8 signext %21)
br label %28
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %1
%26 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %12, %6
ret i32 0
}