#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*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
char *hlogCommand(int req, char *para1, char *para2) {
  static char command[10240];
  char cmd[1024];
  sprintf(cmd, "%d", req);
  if (req == 21) {
    strcpy(cmd, "mkdir");
  }
  if (req == 22) {
    strcpy(cmd, "rmdir");
  }
  if (req == 26) {
    strcpy(cmd, "rm");
  }
  if (req == 27) {
    strcpy(cmd, "chmod");
  }
  if (req == 28) {
    strcpy(cmd, "chown");
  }
  if (req == 29) {
    strcpy(cmd, "chgrp");
  }
  if (req == 51) {
    strcpy(cmd, "get");
  }
  if (req == 52) {
    strcpy(cmd, "put");
  }
  sprintf(command, "%s %s %s", cmd, para1, para2);
  return command;
}


x86 assembly (clang, -O0):
<hlogCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
cmpl   $0x15,-0x4(%rbp)
jne    116b <hlogCommand+0x4b>
lea    -0x420(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x16,-0x4(%rbp)
jne    1188 <hlogCommand+0x68>
lea    -0x420(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1a,-0x4(%rbp)
jne    11a5 <hlogCommand+0x85>
lea    -0x420(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1b,-0x4(%rbp)
jne    11c2 <hlogCommand+0xa2>
lea    -0x420(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1c,-0x4(%rbp)
jne    11df <hlogCommand+0xbf>
lea    -0x420(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x1d,-0x4(%rbp)
jne    11fc <hlogCommand+0xdc>
lea    -0x420(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x33,-0x4(%rbp)
jne    1219 <hlogCommand+0xf9>
lea    -0x420(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x34,-0x4(%rbp)
jne    1236 <hlogCommand+0x116>
lea    -0x420(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x420(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0x2df4(%rip),%rdi
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    0x2ddf(%rip),%rax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlogCommand>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xf45(%rip),%rsi
mov    %rsp,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
add    $0xffffffeb,%ebx
cmp    $0x1f,%ebx
ja     11ab <hlogCommand+0x8b>
lea    0xf2d(%rip),%rsi
lea    0xea3(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf1c(%rip),%rsi
jmp    11a3 <hlogCommand+0x83>
lea    0xf19(%rip),%rsi
jmp    11a3 <hlogCommand+0x83>
lea    0xf13(%rip),%rsi
jmp    11a3 <hlogCommand+0x83>
lea    0xf10(%rip),%rsi
jmp    11a3 <hlogCommand+0x83>
lea    0xf0d(%rip),%rsi
jmp    11a3 <hlogCommand+0x83>
lea    0xf0a(%rip),%rsi
jmp    11a3 <hlogCommand+0x83>
lea    0xf05(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
lea    0x2e8e(%rip),%rbx
lea    0xef3(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@hlogCommand.command = internal global [10240 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"mkdir\00"
@.str.2 = [6 x i8] c"rmdir\00"
@.str.3 = [3 x i8] c"rm\00"
@.str.4 = [6 x i8] c"chmod\00"
@.str.5 = [6 x i8] c"chown\00"
@.str.6 = [6 x i8] c"chgrp\00"
@.str.7 = [4 x i8] c"get\00"
@.str.8 = [4 x i8] c"put\00"
@.str.9 = [9 x i8] c"%s %s %s\00"
define i8* @hlogCommand(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 21
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %13, %3
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 22
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 26
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %25, %22
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 27
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%33 = call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %31, %28
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 28
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %37, %34
%41 = load i32, i32* %4
%42 = icmp eq i32 %41, 29
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%45 = call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %46
46: ; preds = %43, %40
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 51
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%51 = call i32 @strcpy(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %49, %46
%53 = load i32, i32* %4
%54 = icmp eq i32 %53, 52
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%57 = call i32 @strcpy(i8* %56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %58
58: ; preds = %55, %52
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%60 = load i8*, i8** %5
%61 = load i8*, i8** %6
%62 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([10240 x i8], [10240 x i8]* @hlogCommand.command, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %59, i8* %60, i8* %61)
ret i8* getelementptr inbounds ([10240 x i8], [10240 x i8]* @hlogCommand.command, i64 0, i64 0)
}

LLVM IR (-O2):
@hlogCommand.command = internal global [10240 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"mkdir\00"
@.str.2 = [6 x i8] c"rmdir\00"
@.str.3 = [3 x i8] c"rm\00"
@.str.4 = [6 x i8] c"chmod\00"
@.str.5 = [6 x i8] c"chown\00"
@.str.6 = [6 x i8] c"chgrp\00"
@.str.7 = [4 x i8] c"get\00"
@.str.8 = [4 x i8] c"put\00"
@.str.9 = [9 x i8] c"%s %s %s\00"
define i8* @hlogCommand(i32 %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
switch i32 %0, label %17 [
i32 21, label %14
i32 22, label %7
i32 26, label %8
i32 27, label %9
i32 28, label %10
i32 29, label %11
i32 51, label %12
i32 52, label %13
]
7: ; preds = %3
br label %14
8: ; preds = %3
br label %14
9: ; preds = %3
br label %14
10: ; preds = %3
br label %14
11: ; preds = %3
br label %14
12: ; preds = %3
br label %14
13: ; preds = %3
br label %14
14: ; preds = %3, %13, %7, %8, %9, %10, %11, %12
%15 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %12 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %11 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %13 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %3 ]
%16 = call i32 @strcpy(i8* %5, i8* %15)
br label %17
17: ; preds = %14, %3
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([10240 x i8], [10240 x i8]* @hlogCommand.command, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %5, i8* %1, i8* %2)
ret i8* getelementptr inbounds ([10240 x i8], [10240 x i8]* @hlogCommand.command, i64 0, i64 0)
}