#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 */
scalar_t__ calloc(int, int);
bool all_unique_characters_using_memory(char *str) {
  int c;
  int *seen = (int *)calloc(256, sizeof(int));
  for (c = 0; str[c] != '\0'; c++) {
    if (seen[(int)str[c]])
      return false;
    seen[(int)str[c]] = 1;
  }
  return true;
}


x86 assembly (clang, -O0):
<all_unique_characters_using_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x100,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     119c <all_unique_characters_using_memory+0x8c>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1174 <all_unique_characters_using_memory+0x64>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <all_unique_characters_using_memory+0x93>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <all_unique_characters_using_memory+0x26>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<all_unique_characters_using_memory>:
push   %rbx
mov    %rdi,%rbx
mov    $0x100,%edi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%rcx
mov    (%rbx),%dl
mov    $0x1,%eax
test   %dl,%dl
je     115c <all_unique_characters_using_memory+0x4c>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbq %dl,%rdx
cmpl   $0x0,(%rcx,%rdx,4)
jne    115e <all_unique_characters_using_memory+0x4e>
movl   $0x1,(%rcx,%rdx,4)
movzbl (%rbx),%edx
add    $0x1,%rbx
test   %dl,%dl
jne    1140 <all_unique_characters_using_memory+0x30>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @all_unique_characters_using_memory(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
%6 = call i64 @calloc(i32 256, i32 4)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %5
store i32 0, i32* %4
br label %8
8: ; preds = %39, %1
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %42
16: ; preds = %8
%17 = load i32*, i32** %5
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%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
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %17, i64 %24
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %16
store i32 0, i32* %2
br label %43
29: ; preds = %16
%30 = load i32*, i32** %5
%31 = load i8*, i8** %3
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %30, i64 %37
store i32 1, i32* %38
br label %39
39: ; preds = %29
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %8
42: ; preds = %8
store i32 1, i32* %2
br label %43
43: ; preds = %42, %28
%44 = load i32, i32* %2
ret i32 %44
}

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