#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*/ LC_ALL;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ link(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  (void)setlocale(LC_ALL, "");
  if (argc != 3)
    usage();
  if (link(argv[1], argv[2]) != 0) {
    perror("link");
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


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)
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
call   1030 <setlocale@plt>
cmpl   $0x3,-0x8(%rbp)
je     118c <main+0x3c>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1060 <link@plt>
cmp    $0x0,%rax
je     11c5 <main+0x75>
lea    0xe4e(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <setlocale@plt>
cmp    $0x3,%ebp
je     1179 <main+0x29>
xor    %eax,%eax
call   1040 <usage@plt>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1060 <link@plt>
test   %rax,%rax
jne    1199 <main+0x49>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    0xe60(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"link\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
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* @LC_ALL
%7 = call i32 @setlocale(i32 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @usage()
br label %12
12: ; preds = %10, %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i64 @link(i8* %15, i8* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %12
%22 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %12
%26 = load i32, i32* @EXIT_SUCCESS
%27 = call i32 @exit(i32 %26)
unreachable
}

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