#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*/ RTLD_LAZY;
void *dlopen(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char **);
int main() {
  char *name = 0;
  scanf("%ms", &name);
  if (!name) {
    return 1;
  }
  void *handle = dlopen(name, RTLD_LAZY);
  printf("%s\n", handle ? "YES" : "NO");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xeb2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
jne    116e <main+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    11b1 <main+0x81>
mov    -0x10(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
call   1040 <dlopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
lea    0xe7d(%rip),%rsi
lea    0xe72(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
lea    0xec0(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     1184 <main+0x54>
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
call   1040 <dlopen@plt>
test   %rax,%rax
lea    0xea3(%rip),%rax
lea    0xe98(%rip),%rsi
cmove  %rax,%rsi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ms\00"
@RTLD_LAZY = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [4 x i8] c"YES\00"
@.str.3 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %2
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2)
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %0
store i32 1, i32* %1
br label %17
8: ; preds = %0
%9 = load i8*, i8** %2
%10 = load i32, i32* @RTLD_LAZY
%11 = call i8* @dlopen(i8* %9, i32 %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 0, i32* %1
br label %17
17: ; preds = %8, %7
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ms\00"
@RTLD_LAZY = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [4 x i8] c"YES\00"
@.str.3 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1)
%4 = load i8*, i8** %1
%5 = icmp eq i8* %4, null
br i1 %5, label %12, label %6
6: ; preds = %0
%7 = load i32, i32* @RTLD_LAZY
%8 = call i8* @dlopen(i8* %4, i32 %7)
%9 = icmp eq i8* %8, null
%10 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %0, %6
%13 = phi i32 [ 0, %6 ], [ 1, %0 ]
ret i32 %13
}