#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 */
size_t strlen(char const *);
int shader_include_param_valid(const char *param) {
  size_t param_sz = strlen(param);
  if (param_sz < 3)
    return 0;
  if (param[0] == '"' && param[param_sz - 1] == '"')
    return 1;
  else if (param[0] == '<' && param[param_sz - 1] == '>')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<shader_include_param_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x3,-0x18(%rbp)
jae    1140 <shader_include_param_valid+0x30>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <shader_include_param_valid+0xa6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1175 <shader_include_param_valid+0x65>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    1175 <shader_include_param_valid+0x65>
movl   $0x1,-0x4(%rbp)
jmp    11b6 <shader_include_param_valid+0xa6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    11aa <shader_include_param_valid+0x9a>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3e,%eax
jne    11aa <shader_include_param_valid+0x9a>
movl   $0x1,-0x4(%rbp)
jmp    11b6 <shader_include_param_valid+0xa6>
jmp    11af <shader_include_param_valid+0x9f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shader_include_param_valid>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x3,%rcx
jb     114a <shader_include_param_valid+0x3a>
mov    (%rbx),%al
cmp    $0x3c,%al
je     113c <shader_include_param_valid+0x2c>
cmp    $0x22,%al
jne    1148 <shader_include_param_valid+0x38>
mov    $0x1,%eax
cmpb   $0x22,-0x1(%rcx,%rbx,1)
jne    1148 <shader_include_param_valid+0x38>
jmp    114a <shader_include_param_valid+0x3a>
mov    $0x1,%eax
cmpb   $0x3e,-0x1(%rcx,%rbx,1)
je     114a <shader_include_param_valid+0x3a>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @shader_include_param_valid(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp ult i64 %7, 3
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %42
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 34
br i1 %15, label %16, label %25
16: ; preds = %10
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = sub i64 %18, 1
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 34
br i1 %23, label %24, label %25
24: ; preds = %16
store i32 1, i32* %2
br label %42
25: ; preds = %16, %10
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 60
br i1 %30, label %31, label %40
31: ; preds = %25
%32 = load i8*, i8** %3
%33 = load i64, i64* %4
%34 = sub i64 %33, 1
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 62
br i1 %38, label %39, label %40
39: ; preds = %31
store i32 1, i32* %2
br label %42
40: ; preds = %31, %25
br label %41
41: ; preds = %40
store i32 0, i32* %2
br label %42
42: ; preds = %41, %39, %24, %9
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
define i32 @shader_include_param_valid(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp ult i64 %2, 3
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = load i8, i8* %0
switch i8 %5, label %16 [
i8 34, label %6
i8 60, label %11
]
6: ; preds = %4
%7 = add i64 %2, -1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 34
br i1 %10, label %17, label %16
11: ; preds = %4
%12 = add i64 %2, -1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 62
br i1 %15, label %17, label %16
16: ; preds = %4, %6, %11
br label %17
17: ; preds = %11, %6, %1, %16
%18 = phi i32 [ 0, %16 ], [ 0, %1 ], [ 1, %6 ], [ 1, %11 ]
ret i32 %18
}