#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*/ func(char *, char *, int, int);
int /*<<< orphan*/ listdir(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main() {
  char c[64];
  scanf("%s", c);
  while (c != "exit") {
    if (strcmp(c, "list") == 0) {
      char s[1024];
      scanf("%s", s);
      char s1[] = "";
      listdir(s, s1);
    } else if (strcmp(c, "copy") == 0) {
      char source[1024], dest[1024];
      int start, end;
      scanf("%s", source);
      scanf("%s", dest);
      scanf("%d", &start);
      scanf("%d", &end);
      func(source, dest, start, end);
    }
    scanf("%s", c);
    if (strcmp(c, "exit") == 0)
      break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x50(%rbp),%rax
lea    0xe84(%rip),%rcx
cmp    %rcx,%rax
je     12aa <main+0x15a>
lea    -0x50(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e2 <main+0x92>
lea    -0x450(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x451(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
lea    -0x450(%rbp),%rdi
lea    -0x451(%rbp),%rsi
call   1030 <listdir@plt>
jmp    1274 <main+0x124>
lea    -0x50(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    126f <main+0x11f>
lea    -0x860(%rbp),%rsi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0xc60(%rbp),%rsi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xde5(%rip),%rdi
lea    -0xc64(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xdd0(%rip),%rdi
lea    -0xc68(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x860(%rbp),%rdi
lea    -0xc60(%rbp),%rsi
mov    -0xc64(%rbp),%edx
mov    -0xc68(%rbp),%ecx
call   1060 <func@plt>
jmp    1274 <main+0x124>
lea    -0x50(%rbp),%rsi
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x50(%rbp),%rdi
lea    0xd72(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a5 <main+0x155>
jmp    12aa <main+0x15a>
jmp    1174 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0xc70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x858,%rsp
lea    0xea8(%rip),%r12
lea    0x10(%rsp),%r14
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe97(%rip),%r13
lea    0x450(%rsp),%rbx
lea    0x50(%rsp),%rbp
lea    0xe7e(%rip),%r15
jmp    11ce <main+0x8e>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movb   $0x0,0x50(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <listdir@plt>
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1263 <main+0x123>
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1190 <main+0x50>
mov    %r14,%rdi
lea    0xe25(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11ad <main+0x6d>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r12,%rbx
mov    %r15,%r12
mov    %r13,%r15
lea    0xdf6(%rip),%r13
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r13,%rdi
mov    %r15,%r13
mov    %r12,%r15
mov    %rbx,%r12
lea    0x450(%rsp),%rbx
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <func@plt>
jmp    11ad <main+0x6d>
xor    %eax,%eax
add    $0x858,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [5 x i8] c"list\00"
@.str.3 = [5 x i8] c"copy\00"
@.str.4 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %49, %0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%13 = icmp ne i8* %12, getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
br i1 %13, label %14, label %50
14: ; preds = %11
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = bitcast [1 x i8]* %4 to i8*
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%23 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
%24 = call i32 @listdir(i8* %22, i8* %23)
br label %42
25: ; preds = %14
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %8)
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 @func(i8* %36, i8* %37, i32 %38, i32 %39)
br label %41
41: ; preds = %29, %25
br label %42
42: ; preds = %41, %18
%43 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %43)
%45 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %42
br label %50
49: ; preds = %42
br label %11
50: ; preds = %48, %11
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [5 x i8] c"list\00"
@.str.3 = [5 x i8] c"copy\00"
@.str.4 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = alloca [1024 x i8]
%3 = alloca [1 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
br label %16
16: ; preds = %0, %33
%17 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
store i8 0, i8* %15
%21 = call i32 @listdir(i8* %14, i8* %15)
br label %33
22: ; preds = %16
%23 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %22
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = call i32 @func(i8* %10, i8* %11, i32 %30, i32 %31)
br label %33
33: ; preds = %22, %25, %19
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%35 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %16
37: ; preds = %33
ret i32 0
}