#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int symlink(char *, char *);
void untar_create_link_(char *fullpath, char *linkpath, int filesize,
                        FILE *fp) {
  int result = symlink(linkpath, fullpath);
  if (result != 0) {
    fprintf(stderr, "Could not create symlink %s (%d)\n", fullpath, result);
    perror("having trouble creating symlink");
    return;
  }
}


x86 assembly (clang, -O0):
<untar_create_link_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <symlink@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1189 <untar_create_link_+0x59>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xe9e(%rip),%rdi
call   1050 <perror@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<untar_create_link_>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <symlink@plt>
test   %eax,%eax
jne    1145 <untar_create_link_+0x15>
pop    %rbx
ret
mov    0x2e94(%rip),%rcx
mov    (%rcx),%edi
lea    0xeab(%rip),%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <fprintf@plt>
lea    0xebc(%rip),%rdi
pop    %rbx
jmp    1050 <perror@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Could not create symlink %s (%d)\0A\00"
@.str.1 = [32 x i8] c"having trouble creating symlink\00"
define void @untar_create_link_(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = load i8*, i8** %6
%11 = load i8*, i8** %5
%12 = call i32 @symlink(i8* %10, i8* %11)
store i32 %12, i32* %9
%13 = load i32, i32* %9
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %5
%18 = load i32, i32* %9
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18)
%20 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %15, %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Could not create symlink %s (%d)\0A\00"
@.str.1 = [32 x i8] c"having trouble creating symlink\00"
define void @untar_create_link_(i8* %0, i8* %1, i32 %2, i32* nocapture readnone %3) {
%5 = tail call i32 @symlink(i8* %1, i8* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5)
%10 = tail call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %4, %7
ret void
}