#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*/ *strchr(char const *, char);
int check_folder(const char *folder) {
  if (!folder)
    return 0;
  if (!folder[0])
    return 0;
  if (strchr(folder, '*') != NULL)
    return 0;
  if (strchr(folder, '?') != NULL)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_folder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <check_folder+0x23>
movl   $0x0,-0x4(%rbp)
jmp    119b <check_folder+0x8b>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    114c <check_folder+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    119b <check_folder+0x8b>
mov    -0x10(%rbp),%rdi
mov    $0x2a,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1170 <check_folder+0x60>
movl   $0x0,-0x4(%rbp)
jmp    119b <check_folder+0x8b>
mov    -0x10(%rbp),%rdi
mov    $0x3f,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1194 <check_folder+0x84>
movl   $0x0,-0x4(%rbp)
jmp    119b <check_folder+0x8b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_folder>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     114a <check_folder+0x3a>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     114a <check_folder+0x3a>
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    114a <check_folder+0x3a>
mov    %rbx,%rdi
mov    $0x3f,%esi
call   1030 <strchr@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_folder(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 0, i32* %2
br label %24
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %7
store i32 0, i32* %2
br label %24
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = call i32* @strchr(i8* %14, i8 signext 42)
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 0, i32* %2
br label %24
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = call i32* @strchr(i8* %19, i8 signext 63)
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %2
br label %24
23: ; preds = %18
store i32 1, i32* %2
br label %24
24: ; preds = %23, %22, %17, %12, %6
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @check_folder(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i32* @strchr(i8* %0, i8 signext 42)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i32* @strchr(i8* %0, i8 signext 63)
%11 = icmp eq i32* %10, null
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 0, %6 ], [ %12, %9 ]
ret i32 %14
}