#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*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int check_filename(char *filename, const char *type) {
  if (!filename || (filename[0] == '\0')) {
    fprintf(stderr, "Error: No %s file specified.\n", type);
    return 1;
  }
  if (filename[0] == '-' && filename[1] != '\0')
    fprintf(stderr, "Warning: Supplied %s file name starts with -\n", type);
  return 0;
}


x86 assembly (clang, -O0):
<check_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113b <check_filename+0x2b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1160 <check_filename+0x50>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xeb1(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <check_filename+0x91>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    119a <check_filename+0x8a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     119a <check_filename+0x8a>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_filename>:
push   %rbx
mov    %rsi,%rdx
mov    $0x1,%ebx
lea    0xee0(%rip),%rsi
test   %rdi,%rdi
je     1140 <check_filename+0x30>
mov    (%rdi),%al
test   %al,%al
je     1140 <check_filename+0x30>
xor    %ebx,%ebx
cmp    $0x2d,%al
jne    114e <check_filename+0x3e>
xor    %ebx,%ebx
cmpb   $0x0,0x1(%rdi)
je     114e <check_filename+0x3e>
lea    0xede(%rip),%rsi
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Error: No %s file specified.\0A\00"
@.str.1 = [46 x i8] c"Warning: Supplied %s file name starts with -\0A\00"
define i32 @check_filename(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %8, %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %5
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %35
18: ; preds = %8
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 45
br i1 %23, label %24, label %34
24: ; preds = %18
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %5
%33 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %30, %24, %18
store i32 0, i32* %3
br label %35
35: ; preds = %34, %14
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Error: No %s file specified.\0A\00"
@.str.1 = [46 x i8] c"Warning: Supplied %s file name starts with -\0A\00"
define i32 @check_filename(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i8, i8* %0
switch i8 %5, label %15 [
i8 0, label %10
i8 45, label %6
]
6: ; preds = %4
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %6, %2, %4
%11 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), %6 ]
%12 = phi i32 [ 1, %4 ], [ 1, %2 ], [ 0, %6 ]
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* %11, i8* %1)
br label %15
15: ; preds = %10, %6, %4
%16 = phi i32 [ 0, %4 ], [ 0, %6 ], [ %12, %10 ]
ret i32 %16
}