#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_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ SYS_symlink;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int syscall(int /*<<< orphan*/, char *, char *);
int main(int argc, char *argv[]) {
  int status;
  if (argc != 3) {
    fprintf(stderr, "usage: symlink REFEREE REFERER\n");
    exit(EXIT_FAILURE);
  }
  status = syscall(SYS_symlink, argv[1], argv[2]);
  if (status < 0) {
    perror("symlink()");
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1183 <main+0x43>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
call   1040 <syscall@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11c8 <main+0x88>
lea    0xe6b(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jne    1171 <main+0x31>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsi),%rax
mov    0x10(%rsi),%rdx
mov    %rax,%rsi
call   1040 <syscall@plt>
test   %eax,%eax
jns    1194 <main+0x54>
lea    0xeb6(%rip),%rdi
call   1050 <perror@plt>
jmp    1186 <main+0x46>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"usage: symlink REFEREE REFERER\0A\00"
@EXIT_FAILURE = global i32 0
@SYS_symlink = global i32 0
@.str.1 = [10 x i8] c"symlink()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i32, i32* @SYS_symlink
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @syscall(i32 %15, i8* %18, i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %14
%26 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %14
%30 = load i32, i32* @EXIT_SUCCESS
%31 = call i32 @exit(i32 %30)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"usage: symlink REFEREE REFERER\0A\00"
@EXIT_FAILURE = global i32 0
@SYS_symlink = global i32 0
@.str.1 = [10 x i8] c"symlink()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = load i32, i32* @SYS_symlink
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @syscall(i32 %10, i8* %12, i8* %14)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %9
%18 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %9
%22 = load i32, i32* @EXIT_SUCCESS
%23 = tail call i32 @exit(i32 %22)
unreachable
}