#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*/ command;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
void send_command(char *cmd, char *arg, int sd) {
  char command[517];
  if (strcmp(cmd, "PASV") == 0) {
    strcpy(command, cmd);
    strcat(command, "\n");
    send(sd, command, strlen(command), 0);
    printf("%s", command);
  } else {
    strcpy(command, cmd);
    strcat(command, arg);
    strcat(command, "\n");
    send(sd, command, strlen(command), 0);
    if (strcmp(cmd, "PASS ") == 0) {
      printf("PASS *****\n");
    } else {
      printf("%s", command);
    }
  }
  memset(command, 0, sizeof(command));
  return;
}


x86 assembly (clang, -O0):
<send_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1216 <send_command+0xa6>
lea    -0x220(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x220(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x22c(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x22c(%rbp),%edi
mov    -0x228(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
lea    -0x220(%rbp),%rsi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12c9 <send_command+0x159>
lea    -0x220(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <strcat@plt>
lea    -0x220(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x23c(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    -0x220(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x23c(%rbp),%edi
mov    -0x238(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x8(%rbp),%rdi
lea    0xd7b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12af <send_command+0x13f>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12c4 <send_command+0x154>
lea    -0x220(%rbp),%rsi
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12c9 <send_command+0x159>
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x205,%edx
call   1070 <memset@plt>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_command>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe63(%rip),%rsi
call   1090 <strcmp@plt>
mov    %rax,%rbp
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
test   %rbp,%rbp
je     1209 <send_command+0x89>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %r15,%rsi
call   10a0 <strcat@plt>
lea    0xe3b(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <strcat@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
lea    0xe1a(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1245 <send_command+0xc5>
lea    0xe03(%rip),%rdi
mov    %rsp,%rsi
jmp    123c <send_command+0xbc>
lea    0xdf5(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
lea    0xdce(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1251 <send_command+0xd1>
lea    0xdc4(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x205,%edx
call   1080 <memset@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"PASV\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [6 x i8] c"PASS \00"
@.str.4 = [12 x i8] c"PASS *****\0A\00"
define void @send_command(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [517 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%16 = call i32 @strcat(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %6
%18 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%19 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = call i32 @send(i32 %17, i8* %18, i32 %20, i32 0)
%22 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %47
24: ; preds = %3
%25 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%26 = load i8*, i8** %4
%27 = call i32 @strcpy(i8* %25, i8* %26)
%28 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%29 = load i8*, i8** %5
%30 = call i32 @strcat(i8* %28, i8* %29)
%31 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%32 = call i32 @strcat(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* %6
%34 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%35 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = call i32 @send(i32 %33, i8* %34, i32 %36, i32 0)
%38 = load i8*, i8** %4
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %24
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %46
43: ; preds = %24
%44 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %43, %41
br label %47
47: ; preds = %46, %11
%48 = getelementptr inbounds [517 x i8], [517 x i8]* %7, i64 0, i64 0
%49 = call i32 @memset(i8* %48, i32 0, i32 517)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"PASV\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [6 x i8] c"PASS \00"
@str = [11 x i8] c"PASS *****\00"
define void @send_command(i8* %0, i8* %1, i32 %2) {
%4 = alloca [517 x i8]
%5 = getelementptr inbounds [517 x i8], [517 x i8]* %4, i64 0, i64 0
%6 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = call i32 @strcpy(i8* %5, i8* %0)
br i1 %7, label %9, label %14
9: ; preds = %3
%10 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @strlen(i8* %5)
%12 = call i32 @send(i32 %2, i8* %5, i32 %11, i32 0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %25
14: ; preds = %3
%15 = call i32 @strcat(i8* %5, i8* %1)
%16 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @strlen(i8* %5)
%18 = call i32 @send(i32 %2, i8* %5, i32 %17, i32 0)
%19 = call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %25
23: ; preds = %14
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %25
25: ; preds = %21, %23, %9
%26 = call i32 @memset(i8* %5, i32 0, i32 517)
ret void
}