#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*/ getchar();
int longestUniqueSubsttr(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char str[] = "ABDEFGABEF";
  printf("The input string is %s \n", str);
  int len = longestUniqueSubsttr(str);
  printf("The length of the longest non-repeating character substring is %d",
         len);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xf(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xf(%rbp),%rdi
call   1050 <longestUniqueSubsttr@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x4241474645444241,%rax
47 41 42
mov    %rax,(%rsp)
movl   $0x464542,0x7(%rsp)
lea    0xeb9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <longestUniqueSubsttr@plt>
lea    0xeb6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [11 x i8] c"ABDEFGABEF\00"
@.str = [25 x i8] c"The input string is %s \0A\00"
@.str.1 = [66 x i8] c"The length of the longest non-repeating character substring is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [11 x i8]* %2 to i8*
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%8 = call i32 @longestUniqueSubsttr(i8* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [11 x i8] c"ABDEFGABEF\00"
@.str = [25 x i8] c"The input string is %s \0A\00"
@.str.1 = [66 x i8] c"The length of the longest non-repeating character substring is %d\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @longestUniqueSubsttr(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @getchar()
ret i32 0
}