#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*/ exit(int /*<<< orphan*/);
scalar_t__ link(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ symlink(char *, char *);
int main(int argc, char **argv) {
  if (argc == 3) {
    if (link(argv[1], argv[2]) < 0)
      printf("link failed!\n");
    exit(0);
  }
  if (argc == 4) {
    if (argv[1][1] != 'L') {
      printf("unknow parameter : %s !\n", argv[1]);
      exit(0);
    }
    if (symlink(argv[2], argv[3]) < 0)
      printf("link failed!\n");
    exit(0);
  }
  return 0;
}


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)
jne    1194 <main+0x54>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1050 <link@plt>
cmp    $0x0,%rax
jge    118d <main+0x4d>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jne    1204 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x4c,%eax
je     11d0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1040 <symlink@plt>
cmp    $0x0,%rax
jge    11fd <main+0xbd>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x4,%edi
je     115f <main+0xf>
cmp    $0x3,%edi
je     1178 <main+0x28>
xor    %eax,%eax
pop    %rcx
ret
mov    0x8(%rsi),%rax
cmpb   $0x4c,0x1(%rax)
jne    119d <main+0x4d>
mov    0x10(%rsi),%rdi
mov    0x18(%rsi),%rsi
call   1050 <symlink@plt>
jmp    1185 <main+0x35>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1060 <link@plt>
test   %rax,%rax
jns    1196 <main+0x46>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe5c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"link failed!\0A\00"
@.str.1 = [25 x i8] c"unknow parameter : %s !\0A\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 eq i32 %6, 3
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = call i64 @link(i8* %11, i8* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %8
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 4
br i1 %23, label %24, label %51
24: ; preds = %21
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 76
br i1 %31, label %32, label %38
32: ; preds = %24
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 0)
unreachable
38: ; preds = %24
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 3
%44 = load i8*, i8** %43
%45 = call i64 @symlink(i8* %41, i8* %44)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %38
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %49
49: ; preds = %47, %38
%50 = call i32 @exit(i32 0)
unreachable
51: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"unknow parameter : %s !\0A\00"
@str.2 = [13 x i8] c"link failed!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %34 [
i32 3, label %3
i32 4, label %14
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i64 @link(i8* %5, i8* %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %3
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 76
br i1 %19, label %23, label %20
20: ; preds = %14
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%22 = tail call i32 @exit(i32 0)
unreachable
23: ; preds = %14
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = tail call i64 @symlink(i8* %25, i8* %27)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %23
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %23
%33 = tail call i32 @exit(i32 0)
unreachable
34: ; preds = %2
ret i32 0
}