#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 */
scalar_t__ isspace(unsigned char);
int /*<<< orphan*/ strncasecmp(char const *, char *, int);
int known_authentication_scheme_p(const char *au) {
  return (!strncasecmp(au, "Basic", sizeof("Basic") - 1) &&
          (isspace((unsigned char)(au[sizeof("Basic") - 1])) ||
           !au[sizeof("Basic") - 1])) ||
         (!strncasecmp(au, "Digest", sizeof("Digest") - 1) &&
          (isspace((unsigned char)(au[sizeof("Digest") - 1])) ||
           !au[sizeof("Digest") - 1]));
}


x86 assembly (clang, -O0):
<known_authentication_scheme_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%eax
jne    117c <known_authentication_scheme_p+0x5c>
mov    -0x8(%rbp),%rax
movzbl 0x5(%rax),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    11dc <known_authentication_scheme_p+0xbc>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,0x5(%rcx)
mov    %al,-0x9(%rbp)
je     11dc <known_authentication_scheme_p+0xbc>
mov    -0x8(%rbp),%rdi
lea    0xe7f(%rip),%rsi
mov    $0x6,%edx
call   1040 <strncasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
jne    11d6 <known_authentication_scheme_p+0xb6>
mov    -0x8(%rbp),%rax
movzbl 0x6(%rax),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xb(%rbp)
jne    11d0 <known_authentication_scheme_p+0xb0>
mov    -0x8(%rbp),%rax
cmpb   $0x0,0x6(%rax)
setne  %al
xor    $0xff,%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<known_authentication_scheme_p>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
test   %eax,%eax
je     1157 <known_authentication_scheme_p+0x37>
lea    0xec6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1040 <strncasecmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1175 <known_authentication_scheme_p+0x55>
pop    %rbx
ret
movzbl 0x5(%rbx),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1155 <known_authentication_scheme_p+0x35>
cmpb   $0x0,0x5(%rbx)
jne    1139 <known_authentication_scheme_p+0x19>
jmp    1155 <known_authentication_scheme_p+0x35>
movzbl 0x6(%rbx),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1155 <known_authentication_scheme_p+0x35>
xor    %eax,%eax
cmpb   $0x0,0x6(%rbx)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Basic\00"
@.str.1 = [7 x i8] c"Digest\00"
define i32 @known_authentication_scheme_p(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strncasecmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%5 = icmp ne i32 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 5
%9 = load i8, i8* %8
%10 = call i64 @isspace(i8 zeroext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %37, label %12
12: ; preds = %6
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 5
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %17, label %37
17: ; preds = %12, %1
%18 = load i8*, i8** %2
%19 = call i32 @strncasecmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%20 = icmp ne i32 %19, 0
br i1 %20, label %35, label %21
21: ; preds = %17
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 6
%24 = load i8, i8* %23
%25 = call i64 @isspace(i8 zeroext %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %21
%28 = load i8*, i8** %2
%29 = getelementptr inbounds i8, i8* %28, i64 6
%30 = load i8, i8* %29
%31 = icmp ne i8 %30, 0
%32 = xor i1 %31, true
br label %33
33: ; preds = %27, %21
%34 = phi i1 [ true, %21 ], [ %32, %27 ]
br label %35
35: ; preds = %33, %17
%36 = phi i1 [ false, %17 ], [ %34, %33 ]
br label %37
37: ; preds = %35, %12, %6
%38 = phi i1 [ true, %12 ], [ true, %6 ], [ %36, %35 ]
%39 = zext i1 %38 to i32
ret i32 %39
}

LLVM IR (-O2):
@.str = [6 x i8] c"Basic\00"
@.str.1 = [7 x i8] c"Digest\00"
define i32 @known_authentication_scheme_p(i8* nocapture %0) {
%2 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 5
%6 = load i8, i8* %5
%7 = tail call i64 @isspace(i8 zeroext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %4
%10 = load i8, i8* %5
%11 = icmp eq i8 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %9, %1
%13 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %0, i64 6
%17 = load i8, i8* %16
%18 = tail call i64 @isspace(i8 zeroext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i8, i8* %16
%22 = icmp eq i8 %21, 0
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %12, %20, %15, %9, %4
%25 = phi i32 [ 1, %9 ], [ 1, %4 ], [ 0, %12 ], [ 1, %15 ], [ %23, %20 ]
ret i32 %25
}