#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 */
size_t getline(char **, size_t *, int /*<<< orphan*/);
int has_unique_chars(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int main() {
  char *line = NULL;
  size_t len = 0;
  size_t read;
  while ((read = getline(&line, &len, stdin)) != -1) {
    if (read > 0) {
      line[read - 1] = '\0';
      printf("%d\n", has_unique_chars(line));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <getline@plt>
mov    %rax,-0x20(%rbp)
cmp    $0xffffffffffffffff,%rax
je     11aa <main+0x7a>
cmpq   $0x0,-0x20(%rbp)
jbe    11a5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
call   1040 <has_unique_chars@plt>
mov    %eax,%esi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2e94(%rip),%r12
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xe9b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <getline@plt>
test   %rax,%rax
je     1170 <main+0x40>
cmp    $0xffffffffffffffff,%rax
je     11aa <main+0x7a>
mov    0x8(%rsp),%rcx
movb   $0x0,-0x1(%rax,%rcx,1)
mov    0x8(%rsp),%rdi
call   1040 <has_unique_chars@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i8* null, i8** %2
store i64 0, i64* %3
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* @stdin
%7 = call i64 @getline(i8** %2, i64* %3, i32 %6)
store i64 %7, i64* %4
%8 = icmp ne i64 %7, -1
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i64, i64* %4
%11 = icmp ugt i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = load i64, i64* %4
%15 = sub i64 %14, 1
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %2
%18 = call i32 @has_unique_chars(i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %12, %9
br label %5
21: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* @stdin
%7 = call i64 @getline(i8** %1, i64* %2, i32 %6)
switch i64 %7, label %9 [
i64 -1, label %16
i64 0, label %8
]
8: ; preds = %5, %9
br label %5
9: ; preds = %5
%10 = load i8*, i8** %1
%11 = add i64 %7, -1
%12 = getelementptr inbounds i8, i8* %10, i64 %11
store i8 0, i8* %12
%13 = load i8*, i8** %1
%14 = call i32 @has_unique_chars(i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %8
16: ; preds = %5
ret i32 0
}