#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 EXIT_SUCCESS;
int /*<<< orphan*/ free(char *);
char *join_arr(char *, char *);
char *left_exclude(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_line(char **, size_t *);
char *right_exclude(char *, char *);
scalar_t__ strcmp(char *, char *);
char *strtok(char *, char *);
int main() {
  char *input = NULL;
  size_t size = 0;
  read_line(&input, &size);
  char *firstArray = strtok(input, "\\");
  char *secondArray = strtok(NULL, "\\");
  char *command = strtok(NULL, "\\");
  char *result = NULL;
  if (strcmp(command, "join") == 0) {
    result = join_arr(firstArray, secondArray);
  } else if (strcmp(command, "right exclude") == 0) {
    result = right_exclude(firstArray, secondArray);
  } else if (strcmp(command, "left exclude") == 0) {
    result = left_exclude(firstArray, secondArray);
  }
  printf("%s", result);
  free(input);
  free(result);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1080 <read_line@plt>
mov    -0x10(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe35(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe21(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1220 <main+0xa0>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <join_arr@plt>
mov    %rax,-0x38(%rbp)
jmp    1285 <main+0x105>
mov    -0x30(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1250 <main+0xd0>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10a0 <right_exclude@plt>
mov    %rax,-0x38(%rbp)
jmp    1280 <main+0x100>
mov    -0x30(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    127b <main+0xfb>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <left_exclude@plt>
mov    %rax,-0x38(%rbp)
jmp    1280 <main+0x100>
jmp    1285 <main+0x105>
mov    -0x38(%rbp),%rsi
lea    0xd92(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1080 <read_line@plt>
mov    (%rsp),%rdi
lea    0xe4e(%rip),%rbx
mov    %rbx,%rsi
call   1090 <strtok@plt>
mov    %rax,%r14
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <strtok@plt>
mov    %rax,%r15
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <strtok@plt>
mov    %rax,%rbx
lea    0xe24(%rip),%rsi
mov    %rax,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1217 <main+0x97>
lea    0xe15(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1224 <main+0xa4>
lea    0xe0f(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1231 <main+0xb1>
xor    %ebx,%ebx
jmp    123f <main+0xbf>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <join_arr@plt>
jmp    123c <main+0xbc>
mov    %r14,%rdi
mov    %r15,%rsi
call   10a0 <right_exclude@plt>
jmp    123c <main+0xbc>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <left_exclude@plt>
mov    %rax,%rbx
lea    0xddc(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\\\00"
@.str.1 = [5 x i8] c"join\00"
@.str.2 = [14 x i8] c"right exclude\00"
@.str.3 = [13 x i8] c"left exclude\00"
@.str.4 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
store i64 0, i64* %3
%8 = call i32 @read_line(i8** %2, i64* %3)
%9 = load i8*, i8** %2
%10 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %4
%11 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %5
%12 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %6
store i8* null, i8** %7
%13 = load i8*, i8** %6
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %0
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i8* @join_arr(i8* %17, i8* %18)
store i8* %19, i8** %7
br label %38
20: ; preds = %0
%21 = load i8*, i8** %6
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = load i8*, i8** %5
%27 = call i8* @right_exclude(i8* %25, i8* %26)
store i8* %27, i8** %7
br label %37
28: ; preds = %20
%29 = load i8*, i8** %6
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i8*, i8** %4
%34 = load i8*, i8** %5
%35 = call i8* @left_exclude(i8* %33, i8* %34)
store i8* %35, i8** %7
br label %36
36: ; preds = %32, %28
br label %37
37: ; preds = %36, %24
br label %38
38: ; preds = %37, %16
%39 = load i8*, i8** %7
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %39)
%41 = load i8*, i8** %2
%42 = call i32 @free(i8* %41)
%43 = load i8*, i8** %7
%44 = call i32 @free(i8* %43)
%45 = load i32, i32* @EXIT_SUCCESS
ret i32 %45
}

LLVM IR (-O2):
@.str = [2 x i8] c"\\\00"
@.str.1 = [5 x i8] c"join\00"
@.str.2 = [14 x i8] c"right exclude\00"
@.str.3 = [13 x i8] c"left exclude\00"
@.str.4 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = call i32 @read_line(i8** %1, i64* %2)
%6 = load i8*, i8** %1
%7 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i8* @join_arr(i8* %7, i8* %8)
br label %24
14: ; preds = %0
%15 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i8* @right_exclude(i8* %7, i8* %8)
br label %24
19: ; preds = %14
%20 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i8* @left_exclude(i8* %7, i8* %8)
br label %24
24: ; preds = %17, %22, %19, %12
%25 = phi i8* [ %13, %12 ], [ %18, %17 ], [ %23, %22 ], [ null, %19 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %1
%28 = call i32 @free(i8* %27)
%29 = call i32 @free(i8* %25)
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}