#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
scalar_t__ single_string_to_hash(char const *, int /*<<< orphan*/ *);
int strlen(char const *);
int string_to_hash(const char *string, uint8_t first[16], uint8_t second[16]) {
  memset(first, 0, 16);
  memset(second, 0, 16);
  if (strlen(string) == 32) {
    if (single_string_to_hash(string, first))
      return 1;
    return 0;
  }
  if (strlen(string) == 64) {
    if (single_string_to_hash(string, first) &&
        single_string_to_hash(string + 32, second))
      return 2;
    return 0;
  }
  if (strlen(string) == 65) {
    if (single_string_to_hash(string, first) &&
        single_string_to_hash(string + 33, second))
      return 2;
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<string_to_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x20,%eax
jne    11a5 <string_to_hash+0x75>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <single_string_to_hash@plt>
cmp    $0x0,%rax
je     1199 <string_to_hash+0x69>
movl   $0x1,-0x4(%rbp)
jmp    1264 <string_to_hash+0x134>
movl   $0x0,-0x4(%rbp)
jmp    1264 <string_to_hash+0x134>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
jne    1201 <string_to_hash+0xd1>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <single_string_to_hash@plt>
cmp    $0x0,%rax
je     11f5 <string_to_hash+0xc5>
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
mov    -0x20(%rbp),%rsi
call   1050 <single_string_to_hash@plt>
cmp    $0x0,%rax
je     11f5 <string_to_hash+0xc5>
movl   $0x2,-0x4(%rbp)
jmp    1264 <string_to_hash+0x134>
movl   $0x0,-0x4(%rbp)
jmp    1264 <string_to_hash+0x134>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x41,%eax
jne    125d <string_to_hash+0x12d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <single_string_to_hash@plt>
cmp    $0x0,%rax
je     1251 <string_to_hash+0x121>
mov    -0x10(%rbp),%rdi
add    $0x21,%rdi
mov    -0x20(%rbp),%rsi
call   1050 <single_string_to_hash@plt>
cmp    $0x0,%rax
je     1251 <string_to_hash+0x121>
movl   $0x2,-0x4(%rbp)
jmp    1264 <string_to_hash+0x134>
movl   $0x0,-0x4(%rbp)
jmp    1264 <string_to_hash+0x134>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_to_hash>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x20,%eax
jne    1181 <string_to_hash+0x51>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <single_string_to_hash@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
jmp    11e0 <string_to_hash+0xb0>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
cmp    $0x40,%eax
jne    11a4 <string_to_hash+0x74>
mov    %r15,%rsi
call   1050 <single_string_to_hash@plt>
test   %rax,%rax
je     11de <string_to_hash+0xae>
add    $0x20,%rbx
jmp    11c6 <string_to_hash+0x96>
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
jne    11e0 <string_to_hash+0xb0>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <single_string_to_hash@plt>
test   %rax,%rax
je     11de <string_to_hash+0xae>
add    $0x21,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <single_string_to_hash@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    11e0 <string_to_hash+0xb0>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @string_to_hash(i8* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i32*, i32** %6
%9 = call i32 @memset(i32* %8, i32 0, i32 16)
%10 = load i32*, i32** %7
%11 = call i32 @memset(i32* %10, i32 0, i32 16)
%12 = load i8*, i8** %5
%13 = call i32 @strlen(i8* %12)
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %22
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = load i32*, i32** %6
%18 = call i64 @single_string_to_hash(i8* %16, i32* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 1, i32* %4
br label %57
21: ; preds = %15
store i32 0, i32* %4
br label %57
22: ; preds = %3
%23 = load i8*, i8** %5
%24 = call i32 @strlen(i8* %23)
%25 = icmp eq i32 %24, 64
br i1 %25, label %26, label %39
26: ; preds = %22
%27 = load i8*, i8** %5
%28 = load i32*, i32** %6
%29 = call i64 @single_string_to_hash(i8* %27, i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %26
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 32
%34 = load i32*, i32** %7
%35 = call i64 @single_string_to_hash(i8* %33, i32* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31
store i32 2, i32* %4
br label %57
38: ; preds = %31, %26
store i32 0, i32* %4
br label %57
39: ; preds = %22
%40 = load i8*, i8** %5
%41 = call i32 @strlen(i8* %40)
%42 = icmp eq i32 %41, 65
br i1 %42, label %43, label %56
43: ; preds = %39
%44 = load i8*, i8** %5
%45 = load i32*, i32** %6
%46 = call i64 @single_string_to_hash(i8* %44, i32* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %55
48: ; preds = %43
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i64 33
%51 = load i32*, i32** %7
%52 = call i64 @single_string_to_hash(i8* %50, i32* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %48
store i32 2, i32* %4
br label %57
55: ; preds = %48, %43
store i32 0, i32* %4
br label %57
56: ; preds = %39
store i32 0, i32* %4
br label %57
57: ; preds = %56, %55, %54, %38, %37, %21, %20
%58 = load i32, i32* %4
ret i32 %58
}

LLVM IR (-O2):
define i32 @string_to_hash(i8* %0, i32* %1, i32* %2) {
%4 = tail call i32 @memset(i32* %1, i32 0, i32 16)
%5 = tail call i32 @memset(i32* %2, i32 0, i32 16)
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp eq i32 %6, 32
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i64 @single_string_to_hash(i8* %0, i32* %1)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %34
12: ; preds = %3
%13 = tail call i32 @strlen(i8* %0)
%14 = icmp eq i32 %13, 64
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = tail call i64 @single_string_to_hash(i8* %0, i32* %1)
%17 = icmp eq i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = getelementptr inbounds i8, i8* %0, i64 32
%20 = tail call i64 @single_string_to_hash(i8* %19, i32* %2)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %18, %15
br label %34
23: ; preds = %12
%24 = tail call i32 @strlen(i8* %0)
%25 = icmp eq i32 %24, 65
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = tail call i64 @single_string_to_hash(i8* %0, i32* %1)
%28 = icmp eq i64 %27, 0
br i1 %28, label %33, label %29
29: ; preds = %26
%30 = getelementptr inbounds i8, i8* %0, i64 33
%31 = tail call i64 @single_string_to_hash(i8* %30, i32* %2)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29, %26
br label %34
34: ; preds = %23, %29, %18, %8, %33, %22
%35 = phi i32 [ 0, %22 ], [ 0, %33 ], [ %11, %8 ], [ 2, %18 ], [ 2, %29 ], [ 0, %23 ]
ret i32 %35
}