#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 */
struct minix_fs_dat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ domklnk(struct minix_fs_dat *, char *, char *);
int /*<<< orphan*/ fatalmsg(char *, char *);
void cmd_hardlnk(struct minix_fs_dat *fs, int argc, char **argv) {
  if (argc == 3)
    fatalmsg("Usage: %s [link target] [link name]\n", argv[0]);
  domklnk(fs, argv[1], argv[2]);
}


x86 assembly (clang, -O0):
<cmd_hardlnk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x3,-0xc(%rbp)
jne    1150 <cmd_hardlnk+0x30>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xeb5(%rip),%rdi
call   1040 <fatalmsg@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdx
call   1030 <domklnk@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_hardlnk>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
cmp    $0x3,%esi
jne    113e <cmd_hardlnk+0x1e>
mov    (%rbx),%rsi
lea    0xec7(%rip),%rdi
call   1040 <fatalmsg@plt>
mov    0x8(%rbx),%rsi
mov    0x10(%rbx),%rdx
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <domklnk@plt>

LLVM IR (-O0):
%struct.minix_fs_dat = type { i32 }
@.str = [37 x i8] c"Usage: %s [link target] [link name]\0A\00"
define void @cmd_hardlnk(%struct.minix_fs_dat* %0, i32 %1, i8** %2) {
%4 = alloca %struct.minix_fs_dat*
%5 = alloca i32
%6 = alloca i8**
store %struct.minix_fs_dat* %0, %struct.minix_fs_dat** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i8**, i8*** %6
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fatalmsg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %9, %3
%15 = load %struct.minix_fs_dat*, %struct.minix_fs_dat** %4
%16 = load i8**, i8*** %6
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %6
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @domklnk(%struct.minix_fs_dat* %15, i8* %18, i8* %21)
ret void
}

LLVM IR (-O2):
%struct.minix_fs_dat = type { i32 }
@.str = [37 x i8] c"Usage: %s [link target] [link name]\0A\00"
define void @cmd_hardlnk(%struct.minix_fs_dat* %0, i32 %1, i8** nocapture %2) {
%4 = icmp eq i32 %1, 3
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = load i8*, i8** %2
%7 = tail call i32 @fatalmsg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %3
%9 = getelementptr inbounds i8*, i8** %2, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %2, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @domklnk(%struct.minix_fs_dat* %0, i8* %10, i8* %12)
ret void
}