#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*/ hash(unsigned char *, unsigned char *, unsigned char *, int,
                        unsigned int, unsigned char *, int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
void do_hash(unsigned char *password, unsigned char *sessid,
             unsigned char *pdata, int sdata, unsigned int seq_num,
             unsigned char auth_type, unsigned char *auth_out) {
  if (auth_type != 0x00) {
    if (auth_type == 0x02)
      hash(password, sessid, pdata, sdata, seq_num, auth_out, 0x02);
    else
      memcpy(auth_out, password, 16);
  }
}


x86 assembly (clang, -O0):
<do_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %r9b,%al
mov    0x10(%rbp),%r9
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %al,-0x21(%rbp)
movzbl -0x21(%rbp),%eax
cmp    $0x0,%eax
je     119e <do_hash+0x7e>
movzbl -0x21(%rbp),%eax
cmp    $0x2,%eax
jne    1187 <do_hash+0x67>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    0x10(%rbp),%r9
movl   $0x2,(%rsp)
call   1030 <hash@plt>
jmp    1199 <do_hash+0x79>
mov    0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x10,%edx
call   1040 <memcpy@plt>
jmp    119e <do_hash+0x7e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_hash>:
push   %rax
test   %r9d,%r9d
je     1146 <do_hash+0x26>
mov    %rdi,%rax
mov    0x10(%rsp),%r10
cmp    $0x2,%r9b
jne    1148 <do_hash+0x28>
movl   $0x2,(%rsp)
mov    %rax,%rdi
mov    %r10,%r9
call   1030 <hash@plt>
pop    %rax
ret
mov    %r10,%rdi
mov    %rax,%rsi
mov    $0x10,%edx
pop    %rax
jmp    1040 <memcpy@plt>

LLVM IR (-O0):
define void @do_hash(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i8 zeroext %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca i8*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i8 %5, i8* %13
store i8* %6, i8** %14
%15 = load i8, i8* %13
%16 = zext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %35
18: ; preds = %7
%19 = load i8, i8* %13
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %30
22: ; preds = %18
%23 = load i8*, i8** %8
%24 = load i8*, i8** %9
%25 = load i8*, i8** %10
%26 = load i32, i32* %11
%27 = load i32, i32* %12
%28 = load i8*, i8** %14
%29 = call i32 @hash(i8* %23, i8* %24, i8* %25, i32 %26, i32 %27, i8* %28, i32 2)
br label %34
30: ; preds = %18
%31 = load i8*, i8** %14
%32 = load i8*, i8** %8
%33 = call i32 @memcpy(i8* %31, i8* %32, i32 16)
br label %34
34: ; preds = %30, %22
br label %35
35: ; preds = %34, %7
ret void
}

LLVM IR (-O2):
define void @do_hash(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i8 zeroext %5, i8* %6) {
switch i8 %5, label %10 [
i8 0, label %12
i8 2, label %8
]
8: ; preds = %7
%9 = tail call i32 @hash(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i8* %6, i32 2)
br label %12
10: ; preds = %7
%11 = tail call i32 @memcpy(i8* %6, i8* %0, i32 16)
br label %12
12: ; preds = %7, %8, %10
ret void
}