#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 PHYSFS_isSymbolicLink(char *);
int /*<<< orphan*/ printf(char *, char *);
int strlen(char *);
int cmd_issymlink(char *args) {
  int rc;
  if (*args == '\"') {
    args++;
    args[strlen(args) - 1] = '\0';
  }
  rc = PHYSFS_isSymbolicLink(args);
  printf("File %s a symlink.\n", rc ? "is" : "is NOT");
  return (1);
}


x86 assembly (clang, -O0):
<cmd_issymlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1179 <cmd_issymlink+0x49>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1050 <PHYSFS_isSymbolicLink@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
lea    0xe88(%rip),%rsi
lea    0xe7e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_issymlink>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmpb   $0x22,(%rdi)
jne    1151 <cmd_issymlink+0x21>
lea    0x1(%rbx),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,(%rax,%rbx,1)
mov    %r14,%rbx
mov    %rbx,%rdi
call   1050 <PHYSFS_isSymbolicLink@plt>
test   %eax,%eax
lea    0xeb5(%rip),%rax
lea    0xeab(%rip),%rsi
cmove  %rax,%rsi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"File %s a symlink.\0A\00"
@.str.1 = [3 x i8] c"is\00"
@.str.2 = [7 x i8] c"is NOT\00"
define i32 @cmd_issymlink(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 34
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %11, i64 %15
store i8 0, i8* %16
br label %17
17: ; preds = %8, %1
%18 = load i8*, i8** %2
%19 = call i32 @PHYSFS_isSymbolicLink(i8* %18)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %23)
ret i32 1
}

LLVM IR (-O2):
@.str = [20 x i8] c"File %s a symlink.\0A\00"
@.str.1 = [3 x i8] c"is\00"
@.str.2 = [7 x i8] c"is NOT\00"
define i32 @cmd_issymlink(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 34
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = tail call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
store i8 0, i8* %9
br label %10
10: ; preds = %4, %1
%11 = phi i8* [ %5, %4 ], [ %0, %1 ]
%12 = tail call i32 @PHYSFS_isSymbolicLink(i8* %11)
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14)
ret i32 1
}