#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 *);
int /*<<< orphan*/ stderr;
int check_filename(char *filename, char *type) {
  if (!filename || (filename[0] == '\0')) {
    fprintf(stderr, "Error: No %s file specified.\n", type);
    return 1;
  }
  if (filename[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    1190 <check_filename+0x80>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1189 <check_filename+0x79>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe9a(%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     113a <check_filename+0x2a>
mov    (%rdi),%al
test   %al,%al
je     113a <check_filename+0x2a>
xor    %ebx,%ebx
cmp    $0x2d,%al
jne    1148 <check_filename+0x38>
xor    %ebx,%ebx
lea    0xee4(%rip),%rsi
mov    0x2e9f(%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 %29
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 %28
24: ; preds = %18
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %5
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %24, %18
store i32 0, i32* %3
br label %29
29: ; preds = %28, %14
%30 = load i32, i32* %3
ret i32 %30
}

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 %7, label %4
4: ; preds = %2
%5 = load i8, i8* %0
switch i8 %5, label %12 [
i8 0, label %7
i8 45, label %6
]
6: ; preds = %4
br label %7
7: ; preds = %2, %4, %6
%8 = phi i8* [ getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), %6 ], [ 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 ]
%9 = phi i32 [ 0, %6 ], [ 1, %4 ], [ 1, %2 ]
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* %8, i8* %1)
br label %12
12: ; preds = %7, %4
%13 = phi i32 [ 0, %4 ], [ %9, %7 ]
ret i32 %13
}