#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 */
char *basic_authentication_encode(char const *, char const *, char *);
char *digest_authentication_encode(char const *, char const *, char const *,
                                   char const *, char const *);
int /*<<< orphan*/ strncasecmp(char const *, char *, int);
char *create_authorization_line(const char *au, const char *user,
                                const char *passwd, const char *method,
                                const char *path) {
  char *wwwauth = NULL;
  if (!strncasecmp(au, "Basic", 5))
    wwwauth = basic_authentication_encode(user, passwd, "Authorization");
  else if (!strncasecmp(au, "Digest", 6))
    wwwauth = digest_authentication_encode(au, user, passwd, method, path);
  return wwwauth;
}


x86 assembly (clang, -O0):
<create_authorization_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%eax
jne    118f <create_authorization_line+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xe85(%rip),%rdx
call   1030 <basic_authentication_encode@plt>
mov    %rax,-0x30(%rbp)
jmp    11cf <create_authorization_line+0x9f>
mov    -0x8(%rbp),%rdi
lea    0xe7a(%rip),%rsi
mov    $0x6,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%eax
jne    11ca <create_authorization_line+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1050 <digest_authentication_encode@plt>
mov    %rax,-0x30(%rbp)
jmp    11cf <create_authorization_line+0x9f>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_authorization_line>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
lea    0xeb1(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncasecmp@plt>
test   %eax,%eax
je     1181 <create_authorization_line+0x51>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1040 <strncasecmp@plt>
test   %eax,%eax
je     119c <create_authorization_line+0x6c>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe7e(%rip),%rdx
mov    %r13,%rdi
mov    %r12,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <basic_authentication_encode@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <digest_authentication_encode@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Basic\00"
@.str.1 = [14 x i8] c"Authorization\00"
@.str.2 = [7 x i8] c"Digest\00"
define i8* @create_authorization_line(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
store i8* null, i8** %11
%12 = load i8*, i8** %6
%13 = call i32 @strncasecmp(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%14 = icmp ne i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %5
%16 = load i8*, i8** %7
%17 = load i8*, i8** %8
%18 = call i8* @basic_authentication_encode(i8* %16, i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i8* %18, i8** %11
br label %31
19: ; preds = %5
%20 = load i8*, i8** %6
%21 = call i32 @strncasecmp(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%22 = icmp ne i32 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %19
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = load i8*, i8** %8
%27 = load i8*, i8** %9
%28 = load i8*, i8** %10
%29 = call i8* @digest_authentication_encode(i8* %24, i8* %25, i8* %26, i8* %27, i8* %28)
store i8* %29, i8** %11
br label %30
30: ; preds = %23, %19
br label %31
31: ; preds = %30, %15
%32 = load i8*, i8** %11
ret i8* %32
}

LLVM IR (-O2):
@.str = [6 x i8] c"Basic\00"
@.str.1 = [14 x i8] c"Authorization\00"
@.str.2 = [7 x i8] c"Digest\00"
define i8* @create_authorization_line(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i8* @basic_authentication_encode(i8* %1, i8* %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %15
10: ; preds = %5
%11 = tail call i32 @strncasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i8* @digest_authentication_encode(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4)
br label %15
15: ; preds = %10, %13, %8
%16 = phi i8* [ null, %10 ], [ %14, %13 ], [ %9, %8 ]
ret i8* %16
}