#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*/ uint64_t;

/* Variables and functions */
scalar_t__ utf8_char_int(char const *);
char *utf8_next_char(char const *);
void gui_nick_hash_sum_64(const char *nickname, uint64_t *color_64) {
  while (nickname && nickname[0]) {
    *color_64 += utf8_char_int(nickname);
    nickname = utf8_next_char(nickname);
  }
}


x86 assembly (clang, -O0):
<gui_nick_hash_sum_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1150 <gui_nick_hash_sum_64+0x30>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1160 <gui_nick_hash_sum_64+0x40>
jmp    118a <gui_nick_hash_sum_64+0x6a>
mov    -0x8(%rbp),%rdi
call   1030 <utf8_char_int@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq (%rax),%rcx
add    %rdx,%rcx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <utf8_next_char@plt>
mov    %rax,-0x8(%rbp)
jmp    1130 <gui_nick_hash_sum_64+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_nick_hash_sum_64>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1150 <gui_nick_hash_sum_64+0x30>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
cmpb   $0x0,(%rbx)
je     1150 <gui_nick_hash_sum_64+0x30>
mov    %rbx,%rdi
call   1030 <utf8_char_int@plt>
add    %eax,(%r14)
mov    %rbx,%rdi
call   1040 <utf8_next_char@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1130 <gui_nick_hash_sum_64+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @gui_nick_hash_sum_64(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
br label %5
5: ; preds = %16, %2
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %8, %5
%15 = phi i1 [ false, %5 ], [ %13, %8 ]
br i1 %15, label %16, label %26
16: ; preds = %14
%17 = load i8*, i8** %3
%18 = call i64 @utf8_char_int(i8* %17)
%19 = load i32*, i32** %4
%20 = load i32, i32* %19
%21 = sext i32 %20 to i64
%22 = add nsw i64 %21, %18
%23 = trunc i64 %22 to i32
store i32 %23, i32* %19
%24 = load i8*, i8** %3
%25 = call i8* @utf8_next_char(i8* %24)
store i8* %25, i8** %3
br label %5
26: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @gui_nick_hash_sum_64(i8* %0, i32* nocapture %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %15, label %4
4: ; preds = %2, %8
%5 = phi i8* [ %13, %8 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %4
%9 = tail call i64 @utf8_char_int(i8* %5)
%10 = load i32, i32* %1
%11 = trunc i64 %9 to i32
%12 = add i32 %10, %11
store i32 %12, i32* %1
%13 = tail call i8* @utf8_next_char(i8* %5)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %4
15: ; preds = %4, %8, %2
ret void
}