#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*/ memset(char *, int /*<<< orphan*/, int);
int hashmap(char *string) {
  char hashmap[512];
  memset(hashmap, 0, 512);
  for (int c = 0; 0 != string[c]; c++) {
    int index = (int)string[c];
    if (hashmap[index] != 0)
      return 0;
    hashmap[index] = 1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<hashmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
movl   $0x0,-0x214(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x214(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     11b1 <hashmap+0xa1>
mov    -0x10(%rbp),%rax
movslq -0x214(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x218(%rbp)
movslq -0x218(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     118e <hashmap+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11b8 <hashmap+0xa8>
movslq -0x218(%rbp),%rax
movb   $0x1,-0x210(%rbp,%rax,1)
01
mov    -0x214(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x214(%rbp)
jmp    113c <hashmap+0x2c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashmap>:
push   %rbx
sub    $0x200,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
mov    (%rbx),%al
test   %al,%al
je     1164 <hashmap+0x54>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbq %al,%rax
movzbl (%rsp,%rax,1),%ecx
test   %cl,%cl
jne    115b <hashmap+0x4b>
movb   $0x1,(%rsp,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <hashmap+0x30>
xor    %eax,%eax
test   %cl,%cl
sete   %al
jmp    1169 <hashmap+0x59>
mov    $0x1,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @hashmap(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [512 x i8]
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 512)
store i32 0, i32* %5
br label %9
9: ; preds = %35, %1
%10 = load i8*, i8** %3
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 0, %15
br i1 %16, label %17, label %38
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %17
store i32 0, i32* %2
br label %39
31: ; preds = %17
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %33
store i8 1, i8* %34
br label %35
35: ; preds = %31
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %9
38: ; preds = %9
store i32 1, i32* %2
br label %39
39: ; preds = %38, %30
%40 = load i32, i32* %2
ret i32 %40
}

LLVM IR (-O2):
define i32 @hashmap(i8* nocapture %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 512)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %21, label %7
7: ; preds = %1, %14
%8 = phi i64 [ %15, %14 ], [ 0, %1 ]
%9 = phi i8 [ %17, %14 ], [ %5, %1 ]
%10 = sext i8 %9 to i64
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %7
store i8 1, i8* %11
%15 = add nuw i64 %8, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %7
19: ; preds = %7, %14
%20 = zext i1 %13 to i32
br label %21
21: ; preds = %19, %1
%22 = phi i32 [ 1, %1 ], [ %20, %19 ]
ret i32 %22
}