#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*/ cdFunction(int, char *);
int /*<<< orphan*/ cdResetFunction(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ getFunction(int, char *);
int /*<<< orphan*/ lsFunction(int, char *);
int /*<<< orphan*/ mgetFunction(int, char *);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ putFunction(int, char *);
long read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ write(int, char *, int);
int ftp(int fd, int hit) {
  int j, file_fd, filedesc;
  long i, ret, len;
  char *fstr;
  char buffer[8096 + 1] = {0};
  ret = read(fd, buffer, 8096);
  if (ret == 0 || ret == -1) {
    close(fd);
    return 1;
  }
  if (ret > 0 && ret < 8096)
    buffer[ret] = 0;
  else
    buffer[0] = 0;
  for (i = 0; i < ret; i++)
    if (buffer[i] == '\r' || buffer[i] == '\n')
      buffer[i] = '*';
  printf("LOG request %s - hit %d\n", buffer, hit);
  if (!strncmp(buffer, "get ", 4)) {
    if ((buffer[5] == '.' && buffer[6] == '.') || buffer[5] == '|') {
      sprintf(buffer, "%s", "negado");
      write(fd, buffer, 8096);
      close(fd);
    } else {
      getFunction(fd, &buffer[4]);
    }
  } else if (!strncmp(buffer, "put ", 4)) {
    putFunction(fd, &buffer[5]);
  } else if (!strncmp(buffer, "ls ", 3)) {
    lsFunction(fd, &buffer[3]);
  } else if (!strncmp(buffer, "mget ", 4)) {
    mgetFunction(fd, &buffer[5]);
  } else if (!strncmp(buffer, "cd ", 3)) {
    cdFunction(fd, &buffer[3]);
  } else if (!strncmp(buffer, "reset ", 5)) {
    cdResetFunction(fd);
  }
  sleep(1);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<ftp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1fe0,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x1fe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x1fa1,%edx
call   1060 <memset@plt>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
mov    $0x1fa0,%edx
call   10a0 <read@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1232 <ftp+0x52>
cmpq   $0xffffffffffffffff,-0x28(%rbp)
jne    1246 <ftp+0x66>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    14d2 <ftp+0x2f2>
cmpq   $0x0,-0x28(%rbp)
jle    1270 <ftp+0x90>
cmpq   $0x1fa0,-0x28(%rbp)
jge    1270 <ftp+0x90>
mov    -0x28(%rbp),%rax
movb   $0x0,-0x1fe0(%rbp,%rax,1)
jmp    1277 <ftp+0x97>
movb   $0x0,-0x1fe0(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    12d9 <ftp+0xf9>
mov    -0x20(%rbp),%rax
movsbl -0x1fe0(%rbp,%rax,1),%eax
ff
cmp    $0xd,%eax
je     12b7 <ftp+0xd7>
mov    -0x20(%rbp),%rax
movsbl -0x1fe0(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    12c3 <ftp+0xe3>
mov    -0x20(%rbp),%rax
movb   $0x2a,-0x1fe0(%rbp,%rax,1)
2a
jmp    12c8 <ftp+0xe8>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    127f <ftp+0x9f>
lea    -0x1fe0(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xd16(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1fe0(%rbp),%rdi
lea    0xd30(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1393 <ftp+0x1b3>
movsbl -0x1fdb(%rbp),%eax
cmp    $0x2e,%eax
jne    1330 <ftp+0x150>
movsbl -0x1fda(%rbp),%eax
cmp    $0x2e,%eax
je     1340 <ftp+0x160>
movsbl -0x1fdb(%rbp),%eax
cmp    $0x7c,%eax
jne    137b <ftp+0x19b>
lea    -0x1fe0(%rbp),%rdi
lea    0xccb(%rip),%rsi
lea    0xcc7(%rip),%rdx
call   10c0 <sprintf@plt>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
mov    $0x1fa0,%edx
call   1040 <write@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
jmp    138e <ftp+0x1ae>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
add    $0x4,%rsi
call   10d0 <getFunction@plt>
jmp    14b9 <ftp+0x2d9>
lea    -0x1fe0(%rbp),%rdi
lea    0xc82(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13cc <ftp+0x1ec>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
add    $0x5,%rsi
call   1090 <putFunction@plt>
jmp    14b4 <ftp+0x2d4>
lea    -0x1fe0(%rbp),%rdi
lea    0xc4e(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1405 <ftp+0x225>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
add    $0x3,%rsi
call   10f0 <lsFunction@plt>
jmp    14af <ftp+0x2cf>
lea    -0x1fe0(%rbp),%rdi
lea    0xc19(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    143e <ftp+0x25e>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
add    $0x5,%rsi
call   1100 <mgetFunction@plt>
jmp    14aa <ftp+0x2ca>
lea    -0x1fe0(%rbp),%rdi
lea    0xbe6(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1477 <ftp+0x297>
mov    -0x8(%rbp),%edi
lea    -0x1fe0(%rbp),%rsi
add    $0x3,%rsi
call   10b0 <cdFunction@plt>
jmp    14a5 <ftp+0x2c5>
lea    -0x1fe0(%rbp),%rdi
lea    0xbb1(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    14a0 <ftp+0x2c0>
mov    -0x8(%rbp),%edi
call   1080 <cdResetFunction@plt>
jmp    14a5 <ftp+0x2c5>
jmp    14aa <ftp+0x2ca>
jmp    14af <ftp+0x2cf>
jmp    14b4 <ftp+0x2d4>
jmp    14b9 <ftp+0x2d9>
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1fe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1fa8,%rsp
mov    %esi,%r14d
mov    %edi,%r15d
mov    %rsp,%rbp
mov    $0x1fa1,%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x1fa0,%edx
call   10a0 <read@plt>
lea    0x1(%rax),%rcx
cmp    $0x1,%rcx
ja     1221 <ftp+0x51>
mov    %r15d,%edi
call   1070 <close@plt>
mov    $0x1,%eax
jmp    1450 <ftp+0x280>
lea    -0x1(%rax),%rdx
cmp    $0x1f9e,%rdx
ja     1234 <ftp+0x64>
movb   $0x0,(%rsp,%rax,1)
jmp    123d <ftp+0x6d>
movb   $0x0,(%rsp)
test   %rax,%rax
jle    127d <ftp+0xad>
mov    %eax,%ecx
and    $0x3,%ecx
cmp    $0x3,%rdx
jae    1347 <ftp+0x177>
xor    %edx,%edx
test   %rcx,%rcx
je     127d <ftp+0xad>
lea    (%rsp,%rdx,1),%rax
xor    %edx,%edx
jmp    126d <ftp+0x9d>
nopl   0x0(%rax,%rax,1)
movb   $0x2a,(%rax,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rcx
je     127d <ftp+0xad>
movzbl (%rax,%rdx,1),%ebx
cmp    $0xd,%bl
je     1260 <ftp+0x90>
cmp    $0xa,%bl
je     1260 <ftp+0x90>
jmp    1264 <ftp+0x94>
lea    0xd7c(%rip),%rdi
mov    %rsp,%rbp
mov    %rbp,%rsi
mov    %r14d,%edx
call   1050 <printf@plt>
lea    0xd91(%rip),%rsi
mov    %rbp,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     13ad <ftp+0x1dd>
lea    0xd6b(%rip),%rsi
mov    %rsp,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     13d9 <ftp+0x209>
lea    0xd54(%rip),%rsi
mov    %rsp,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1411 <ftp+0x241>
lea    0xd3c(%rip),%rsi
mov    %rsp,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1420 <ftp+0x250>
lea    0xd26(%rip),%rsi
mov    %rsp,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     142f <ftp+0x25f>
lea    0xd0e(%rip),%rsi
mov    %rsp,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    143c <ftp+0x26c>
mov    %r15d,%edi
call   1080 <cdResetFunction@plt>
jmp    143c <ftp+0x26c>
and    $0xfffffffffffffffc,%rax
xor    %edx,%edx
jmp    1362 <ftp+0x192>
nop
movb   $0x2a,0x3(%rsp,%rdx,1)
add    $0x4,%rdx
cmp    %rdx,%rax
je     124e <ftp+0x7e>
movzbl (%rsp,%rdx,1),%ebx
cmp    $0xd,%bl
je     1370 <ftp+0x1a0>
cmp    $0xa,%bl
jne    1374 <ftp+0x1a4>
movb   $0x2a,(%rsp,%rdx,1)
movzbl 0x1(%rsp,%rdx,1),%ebx
cmp    $0xd,%bl
je     1383 <ftp+0x1b3>
cmp    $0xa,%bl
jne    1388 <ftp+0x1b8>
movb   $0x2a,0x1(%rsp,%rdx,1)
movzbl 0x2(%rsp,%rdx,1),%ebx
cmp    $0xd,%bl
je     1397 <ftp+0x1c7>
cmp    $0xa,%bl
jne    139c <ftp+0x1cc>
movb   $0x2a,0x2(%rsp,%rdx,1)
movzbl 0x3(%rsp,%rdx,1),%ebx
cmp    $0xd,%bl
je     1350 <ftp+0x180>
cmp    $0xa,%bl
je     1350 <ftp+0x180>
jmp    1355 <ftp+0x185>
mov    0x5(%rsp),%cl
mov    0x6(%rsp),%al
mov    %ecx,%edx
xor    $0x2e,%dl
xor    $0x2e,%al
or     %dl,%al
sete   %al
cmp    $0x7c,%cl
je     13e8 <ftp+0x218>
test   %al,%al
jne    13e8 <ftp+0x218>
lea    0x4(%rsp),%rsi
mov    %r15d,%edi
call   10c0 <getFunction@plt>
jmp    143c <ftp+0x26c>
lea    0x5(%rsp),%rsi
mov    %r15d,%edi
call   1090 <putFunction@plt>
jmp    143c <ftp+0x26c>
movl   $0x6f6461,0x3(%rsp)
movl   $0x6167656e,(%rsp)
mov    %rsp,%rsi
mov    %r15d,%edi
mov    $0x1fa0,%edx
call   1040 <write@plt>
mov    %r15d,%edi
call   1070 <close@plt>
jmp    143c <ftp+0x26c>
lea    0x3(%rsp),%rsi
mov    %r15d,%edi
call   10e0 <lsFunction@plt>
jmp    143c <ftp+0x26c>
lea    0x5(%rsp),%rsi
mov    %r15d,%edi
call   10f0 <mgetFunction@plt>
jmp    143c <ftp+0x26c>
lea    0x3(%rsp),%rsi
mov    %r15d,%edi
call   10b0 <cdFunction@plt>
mov    $0x1,%edi
call   10d0 <sleep@plt>
mov    %r15d,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x1fa8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"LOG request %s - hit %d\0A\00"
@.str.1 = [5 x i8] c"get \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [7 x i8] c"negado\00"
@.str.4 = [5 x i8] c"put \00"
@.str.5 = [4 x i8] c"ls \00"
@.str.6 = [6 x i8] c"mget \00"
@.str.7 = [4 x i8] c"cd \00"
@.str.8 = [7 x i8] c"reset \00"
define i32 @ftp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8*
%13 = alloca [8097 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
%14 = bitcast [8097 x i8]* %13 to i8*
%15 = load i32, i32* %4
%16 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%17 = call i64 @read(i32 %15, i8* %16, i32 8096)
store i64 %17, i64* %10
%18 = load i64, i64* %10
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %2
%21 = load i64, i64* %10
%22 = icmp eq i64 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %20, %2
%24 = load i32, i32* %4
%25 = call i32 @close(i32 %24)
store i32 1, i32* %3
br label %144
26: ; preds = %20
%27 = load i64, i64* %10
%28 = icmp sgt i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = load i64, i64* %10
%31 = icmp slt i64 %30, 8096
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i64, i64* %10
%34 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 %33
store i8 0, i8* %34
br label %37
35: ; preds = %29, %26
%36 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
store i8 0, i8* %36
br label %37
37: ; preds = %35, %32
store i64 0, i64* %9
br label %38
38: ; preds = %58, %37
%39 = load i64, i64* %9
%40 = load i64, i64* %10
%41 = icmp slt i64 %39, %40
br i1 %41, label %42, label %61
42: ; preds = %38
%43 = load i64, i64* %9
%44 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 13
br i1 %47, label %54, label %48
48: ; preds = %42
%49 = load i64, i64* %9
%50 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 10
br i1 %53, label %54, label %57
54: ; preds = %48, %42
%55 = load i64, i64* %9
%56 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 %55
store i8 42, i8* %56
br label %57
57: ; preds = %54, %48
br label %58
58: ; preds = %57
%59 = load i64, i64* %9
%60 = add nsw i64 %59, 1
store i64 %60, i64* %9
br label %38
61: ; preds = %38
%62 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%63 = load i32, i32* %5
%64 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %62, i32 %63)
%65 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%66 = call i32 @strncmp(i8* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%67 = icmp ne i32 %66, 0
br i1 %67, label %96, label %68
68: ; preds = %61
%69 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 5
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 46
br i1 %72, label %73, label %78
73: ; preds = %68
%74 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 6
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 46
br i1 %77, label %83, label %78
78: ; preds = %73, %68
%79 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 5
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 124
br i1 %82, label %83, label %91
83: ; preds = %78, %73
%84 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%85 = call i32 @sprintf(i8* %84, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%86 = load i32, i32* %4
%87 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%88 = call i32 @write(i32 %86, i8* %87, i32 8096)
%89 = load i32, i32* %4
%90 = call i32 @close(i32 %89)
br label %95
91: ; preds = %78
%92 = load i32, i32* %4
%93 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 4
%94 = call i32 @getFunction(i32 %92, i8* %93)
br label %95
95: ; preds = %91, %83
br label %140
96: ; preds = %61
%97 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%98 = call i32 @strncmp(i8* %97, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%99 = icmp ne i32 %98, 0
br i1 %99, label %104, label %100
100: ; preds = %96
%101 = load i32, i32* %4
%102 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 5
%103 = call i32 @putFunction(i32 %101, i8* %102)
br label %139
104: ; preds = %96
%105 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%106 = call i32 @strncmp(i8* %105, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%107 = icmp ne i32 %106, 0
br i1 %107, label %112, label %108
108: ; preds = %104
%109 = load i32, i32* %4
%110 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 3
%111 = call i32 @lsFunction(i32 %109, i8* %110)
br label %138
112: ; preds = %104
%113 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%114 = call i32 @strncmp(i8* %113, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 4)
%115 = icmp ne i32 %114, 0
br i1 %115, label %120, label %116
116: ; preds = %112
%117 = load i32, i32* %4
%118 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 5
%119 = call i32 @mgetFunction(i32 %117, i8* %118)
br label %137
120: ; preds = %112
%121 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%122 = call i32 @strncmp(i8* %121, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%123 = icmp ne i32 %122, 0
br i1 %123, label %128, label %124
124: ; preds = %120
%125 = load i32, i32* %4
%126 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 3
%127 = call i32 @cdFunction(i32 %125, i8* %126)
br label %136
128: ; preds = %120
%129 = getelementptr inbounds [8097 x i8], [8097 x i8]* %13, i64 0, i64 0
%130 = call i32 @strncmp(i8* %129, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 5)
%131 = icmp ne i32 %130, 0
br i1 %131, label %135, label %132
132: ; preds = %128
%133 = load i32, i32* %4
%134 = call i32 @cdResetFunction(i32 %133)
br label %135
135: ; preds = %132, %128
br label %136
136: ; preds = %135, %124
br label %137
137: ; preds = %136, %116
br label %138
138: ; preds = %137, %108
br label %139
139: ; preds = %138, %100
br label %140
140: ; preds = %139, %95
%141 = call i32 @sleep(i32 1)
%142 = load i32, i32* %4
%143 = call i32 @close(i32 %142)
store i32 0, i32* %3
br label %144
144: ; preds = %140, %23
%145 = load i32, i32* %3
ret i32 %145
}

LLVM IR (-O2):
@.str = [25 x i8] c"LOG request %s - hit %d\0A\00"
@.str.1 = [5 x i8] c"get \00"
@.str.3 = [7 x i8] c"negado\00"
@.str.4 = [5 x i8] c"put \00"
@.str.5 = [4 x i8] c"ls \00"
@.str.6 = [6 x i8] c"mget \00"
@.str.7 = [4 x i8] c"cd \00"
@.str.8 = [7 x i8] c"reset \00"
define i32 @ftp(i32 %0, i32 %1) {
%3 = alloca [8097 x i8]
%4 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 0
%5 = call i64 @read(i32 %0, i8* %4, i32 8096)
%6 = add i64 %5, 1
%7 = icmp ult i64 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @close(i32 %0)
br label %113
10: ; preds = %2
%11 = add i64 %5, -1
%12 = icmp ult i64 %11, 8095
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 %5
store i8 0, i8* %14
br label %17
15: ; preds = %10
store i8 0, i8* %4
%16 = icmp sgt i64 %5, 0
br i1 %16, label %17, label %61
17: ; preds = %13, %15
%18 = add i64 %5, -1
%19 = and i64 %5, 3
%20 = icmp ult i64 %18, 3
br i1 %20, label %48, label %21
21: ; preds = %17
%22 = and i64 %5, -4
br label %23
23: ; preds = %44, %21
%24 = phi i64 [ 0, %21 ], [ %45, %44 ]
%25 = phi i64 [ 0, %21 ], [ %46, %44 ]
%26 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 %24
%27 = load i8, i8* %26
switch i8 %27, label %29 [
i8 13, label %28
i8 10, label %28
]
28: ; preds = %23, %23
store i8 42, i8* %26
br label %29
29: ; preds = %23, %28
%30 = or i64 %24, 1
%31 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 %30
%32 = load i8, i8* %31
switch i8 %32, label %34 [
i8 13, label %33
i8 10, label %33
]
33: ; preds = %29, %29
store i8 42, i8* %31
br label %34
34: ; preds = %33, %29
%35 = or i64 %24, 2
%36 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 %35
%37 = load i8, i8* %36
switch i8 %37, label %39 [
i8 13, label %38
i8 10, label %38
]
38: ; preds = %34, %34
store i8 42, i8* %36
br label %39
39: ; preds = %38, %34
%40 = or i64 %24, 3
%41 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 %40
%42 = load i8, i8* %41
switch i8 %42, label %44 [
i8 13, label %43
i8 10, label %43
]
43: ; preds = %39, %39
store i8 42, i8* %41
br label %44
44: ; preds = %43, %39
%45 = add nuw nsw i64 %24, 4
%46 = add i64 %25, 4
%47 = icmp eq i64 %46, %22
br i1 %47, label %48, label %23
48: ; preds = %44, %17
%49 = phi i64 [ 0, %17 ], [ %45, %44 ]
%50 = icmp eq i64 %19, 0
br i1 %50, label %61, label %51
51: ; preds = %48, %57
%52 = phi i64 [ %58, %57 ], [ %49, %48 ]
%53 = phi i64 [ %59, %57 ], [ 0, %48 ]
%54 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 %52
%55 = load i8, i8* %54
switch i8 %55, label %57 [
i8 13, label %56
i8 10, label %56
]
56: ; preds = %51, %51
store i8 42, i8* %54
br label %57
57: ; preds = %56, %51
%58 = add nuw nsw i64 %52, 1
%59 = add i64 %53, 1
%60 = icmp eq i64 %59, %19
br i1 %60, label %61, label %51
61: ; preds = %48, %57, %15
%62 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %1)
%63 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %81
65: ; preds = %61
%66 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 5
%67 = load i8, i8* %66
%68 = icmp eq i8 %67, 46
%69 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 6
%70 = load i8, i8* %69
%71 = icmp eq i8 %70, 46
%72 = select i1 %68, i1 %71, i1 false
%73 = icmp eq i8 %67, 124
%74 = or i1 %73, %72
br i1 %74, label %75, label %78
75: ; preds = %65
%76 = call i32 @write(i32 %0, i8* %4, i32 8096)
%77 = call i32 @close(i32 %0)
br label %110
78: ; preds = %65
%79 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 4
%80 = call i32 @getFunction(i32 %0, i8* %79)
br label %110
81: ; preds = %61
%82 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 5
%86 = call i32 @putFunction(i32 %0, i8* %85)
br label %110
87: ; preds = %81
%88 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 3
%92 = call i32 @lsFunction(i32 %0, i8* %91)
br label %110
93: ; preds = %87
%94 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 4)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 5
%98 = call i32 @mgetFunction(i32 %0, i8* %97)
br label %110
99: ; preds = %93
%100 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = getelementptr inbounds [8097 x i8], [8097 x i8]* %3, i64 0, i64 3
%104 = call i32 @cdFunction(i32 %0, i8* %103)
br label %110
105: ; preds = %99
%106 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 5)
%107 = icmp eq i32 %106, 0
br i1 %107, label %108, label %110
108: ; preds = %105
%109 = call i32 @cdResetFunction(i32 %0)
br label %110
110: ; preds = %84, %96, %105, %108, %102, %90, %75, %78
%111 = call i32 @sleep(i32 1)
%112 = call i32 @close(i32 %0)
br label %113
113: ; preds = %110, %8
%114 = phi i32 [ 1, %8 ], [ 0, %110 ]
ret i32 %114
}