#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*/ cd(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("Invalid number of arguments,type 'HELP' for help");
  } else {
    if (strcmp(argv[1], "cd") == 0) {
      cd(argv[2]);
    } else {
      puts("No such directory found.");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1171 <main+0x31>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
jmp    11b2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11a1 <main+0x61>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <cd@plt>
jmp    11ad <main+0x6d>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
jmp    11b2 <main+0x72>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    116c <main+0x2c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xedd(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     117a <main+0x3a>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
jmp    1183 <main+0x43>
lea    0xe8d(%rip),%rdi
call   1050 <printf@plt>
jmp    1183 <main+0x43>
mov    0x10(%rbx),%rdi
call   1040 <cd@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Invalid number of arguments,type 'HELP' for help\00"
@.str.1 = [3 x i8] c"cd\00"
@.str.2 = [25 x i8] c"No such directory found.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %24
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @cd(i8* %19)
br label %23
21: ; preds = %10
%22 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %16
br label %24
24: ; preds = %23, %8
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [49 x i8] c"Invalid number of arguments,type 'HELP' for help\00"
@.str.1 = [3 x i8] c"cd\00"
@.str.2 = [25 x i8] c"No such directory found.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %17
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @cd(i8* %13)
br label %17
15: ; preds = %6
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %11, %15, %4
ret i32 0
}