#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);
int /*<<< orphan*/ free(int *);
bool non_repeating_characters(char *s, int start, int end) {
  bool *set = (bool *)calloc(256, sizeof(bool));
  for (int c = start; c <= end; c++) {
    if (set[(int)s[c]]) {
      free(set);
      return false;
    }
    set[(int)s[c]] = true;
  }
  free(set);
  return true;
}


x86 assembly (clang, -O0):
<non_repeating_characters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    $0x100,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11b1 <non_repeating_characters+0x91>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
movslq %ecx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1189 <non_repeating_characters+0x69>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c1 <non_repeating_characters+0xa1>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114b <non_repeating_characters+0x2b>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<non_repeating_characters>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
mov    $0x100,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
cmp    %ebx,%ebp
jg     116a <non_repeating_characters+0x4a>
movslq %ebp,%rcx
add    %rcx,%r14
sub    %ebp,%ebx
add    $0x1,%ebx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movsbq (%r14,%rcx,1),%rdx
cmpl   $0x0,(%rax,%rdx,4)
jne    1179 <non_repeating_characters+0x59>
movl   $0x1,(%rax,%rdx,4)
add    $0x1,%rcx
cmp    %ecx,%ebx
jne    1150 <non_repeating_characters+0x30>
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
jmp    1183 <non_repeating_characters+0x63>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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