#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*/ BuildCommandMessage(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(int argc, char *argv[]) {
  char msg[256];
  int address;
  if (argc == 3) {
    sscanf(argv[2], "%i", &address);
    BuildCommandMessage(msg, argv[1], address);
  } else if (argc == 2) {
    BuildCommandMessage(msg, argv[1], 1);
  } else {
    BuildCommandMessage(msg, "KDY;KMT;KYR;KT0;TKK;PAC;UD01;UD02;ID01;ID02;SYS",
                        1);
  }
  printf("%s\n", msg);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    118d <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe9e(%rip),%rsi
lea    -0x114(%rbp),%rdx
call   1050 <sscanf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x114(%rbp),%edx
call   1030 <BuildCommandMessage@plt>
jmp    11d2 <main+0xa2>
cmpl   $0x2,-0x8(%rbp)
jne    11b5 <main+0x85>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x1,%edx
call   1030 <BuildCommandMessage@plt>
jmp    11cd <main+0x9d>
lea    -0x110(%rbp),%rdi
lea    0xe40(%rip),%rsi
mov    $0x1,%edx
call   1030 <BuildCommandMessage@plt>
jmp    11d2 <main+0xa2>
lea    -0x110(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x110,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1169 <main+0x39>
cmp    $0x3,%edi
jne    116f <main+0x3f>
mov    0x10(%rbx),%rdi
lea    0xeb0(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1050 <sscanf@plt>
mov    0x8(%rbx),%rsi
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rdi
jmp    1180 <main+0x50>
mov    0x8(%rbx),%rsi
jmp    1176 <main+0x46>
lea    0xe8d(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x1,%edx
call   1030 <BuildCommandMessage@plt>
lea    0xea7(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [48 x i8] c"KDY;KMT;KYR;KT0;TKK;PAC;UD01;UD02;ID01;ID02;SYS\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %21
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i32, i32* %7
%20 = call i32 @BuildCommandMessage(i8* %15, i8* %18, i32 %19)
br label %34
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @BuildCommandMessage(i8* %25, i8* %28, i32 1)
br label %33
30: ; preds = %21
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%32 = call i32 @BuildCommandMessage(i8* %31, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %33
33: ; preds = %30, %24
br label %34
34: ; preds = %33, %10
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [48 x i8] c"KDY;KMT;KYR;KT0;TKK;PAC;UD01;UD02;ID01;ID02;SYS\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
switch i32 %0, label %19 [
i32 3, label %7
i32 2, label %15
]
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* %4
%14 = call i32 @BuildCommandMessage(i8* %5, i8* %12, i32 %13)
br label %21
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @BuildCommandMessage(i8* %5, i8* %17, i32 1)
br label %21
19: ; preds = %2
%20 = call i32 @BuildCommandMessage(i8* %5, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %21
21: ; preds = %15, %19, %7
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}