#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*/ printf(char *, ...);
scalar_t__ strlen(char *);
void print_usage(int error, int temp, char *arg, char *state) {
  switch (error) {
  case 100:
    printf("State %s is invalid length (%d), required length = %d\n", state,
           (int)strlen(state), 10);
    printf(
        "STATE:\n		01: Attack actualization\t(ATT)\n	"
        "	02: Privacy damage\t(PRD)\n		03: Data "
        "capabilities\t(DAC)\n		04: Asset access\t\t(ASA)\n	"
        "	05: Asset role\t\t(ASR)\n		06: Data "
        "access\t\t(DAA)\n		07: Data quantity\t(DAQ)\n	"
        "	08: Data significance\t(DAS)\n		09: Data storage "
        "time\t(DST)\n		10: Data identifiability\t(DIF)\n");
    break;
  case 101:
    printf("Parameter -%c is missing a operand\n", temp);
    break;
  case 102:
    break;
  case 103:
    printf("Unknown parameter (%c)\n", temp);
    break;
  default:
    printf("unknown error\n");
  }
  printf("Usage: %s -[chC] || -f PATH || -v STATE\n", arg);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11cd <print_usage+0xad>
mov    -0x20(%rbp),%rax
lea    0xeaa(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe93(%rip),%rdi
mov    $0xa,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11db <print_usage+0xbb>
mov    -0x8(%rbp),%esi
lea    0xfc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11db <print_usage+0xbb>
jmp    11db <print_usage+0xbb>
mov    -0x8(%rbp),%esi
lea    0xfce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11db <print_usage+0xbb>
lea    0xfd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xfd0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
add    $0xffffff9c,%edi
cmp    $0x3,%edi
ja     117b <print_usage+0x4b>
mov    %rcx,%rbx
lea    0xeb7(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf34(%rip),%rdi
jmp    1182 <print_usage+0x52>
lea    0x104e(%rip),%rdi
call   1030 <puts@plt>
jmp    11a0 <print_usage+0x70>
lea    0xeb7(%rip),%rdi
jmp    1199 <print_usage+0x69>
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xedc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"State %s is invalid length (%d), required length = %d\0A\00"
@.str.1 = [292 x i8] c"STATE:\0A\09\0901: Attack actualization\09(ATT)\0A\09\0902: Privacy damage\09(PRD)\0A\09\0903: Data capabilities\09(DAC)\0A\09\0904: Asset access\09\09(ASA)\0A\09\0905: Asset role\09\09(ASR)\0A\09\0906: Data access\09\09(DAA)\0A\09\0907: Data quantity\09(DAQ)\0A\09\0908: Data significance\09(DAS)\0A\09\0909: Data storage time\09(DST)\0A\09\0910: Data identifiability\09(DIF)\0A\00"
@.str.2 = [36 x i8] c"Parameter -%c is missing a operand\0A\00"
@.str.3 = [24 x i8] c"Unknown parameter (%c)\0A\00"
@.str.4 = [15 x i8] c"unknown error\0A\00"
@.str.5 = [42 x i8] c"Usage: %s -[chC] || -f PATH ||\C2\A0-v STATE\0A\00"
define void @print_usage(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
switch i32 %9, label %24 [
i32 100, label %10
i32 101, label %17
i32 102, label %20
i32 103, label %21
]
10: ; preds = %4
%11 = load i8*, i8** %8
%12 = load i8*, i8** %8
%13 = call i64 @strlen(i8* %12)
%14 = trunc i64 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %14, i32 10)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([292 x i8], [292 x i8]* @.str.1, i64 0, i64 0))
br label %26
17: ; preds = %4
%18 = load i32, i32* %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %26
20: ; preds = %4
br label %26
21: ; preds = %4
%22 = load i32, i32* %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %22)
br label %26
24: ; preds = %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %21, %20, %17, %10
%27 = load i8*, i8** %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %27)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"State %s is invalid length (%d), required length = %d\0A\00"
@.str.2 = [36 x i8] c"Parameter -%c is missing a operand\0A\00"
@.str.3 = [24 x i8] c"Unknown parameter (%c)\0A\00"
@.str.5 = [42 x i8] c"Usage: %s -[chC] || -f PATH ||\C2\A0-v STATE\0A\00"
@str = [291 x i8] c"STATE:\0A\09\0901: Attack actualization\09(ATT)\0A\09\0902: Privacy damage\09(PRD)\0A\09\0903: Data capabilities\09(DAC)\0A\09\0904: Asset access\09\09(ASA)\0A\09\0905: Asset role\09\09(ASR)\0A\09\0906: Data access\09\09(DAA)\0A\09\0907: Data quantity\09(DAQ)\0A\09\0908: Data significance\09(DAS)\0A\09\0909: Data storage time\09(DST)\0A\09\0910: Data identifiability\09(DIF)\00"
@str.6 = [14 x i8] c"unknown error\00"
define void @print_usage(i32 %0, i32 %1, i8* %2, i8* %3) {
switch i32 %0, label %14 [
i32 100, label %5
i32 101, label %10
i32 102, label %16
i32 103, label %12
]
5: ; preds = %4
%6 = tail call i64 @strlen(i8* dereferenceable(1) %3)
%7 = trunc i64 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %7, i32 10)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([291 x i8], [291 x i8]* @str, i64 0, i64 0))
br label %16
10: ; preds = %4
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %16
12: ; preds = %4
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %16
14: ; preds = %4
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %4, %10, %5
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %2)
ret void
}