#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 lengthOfLongestSubstring(char *);
int lengthOfLongestSubstringOn(char *);
int lengthOfLongestSubstringOn2(char *);
int /*<<< orphan*/ printf(char *, int);
void lengthOfLongestSubstringMain(void) {
  char s[] = "Given a string, find the length of the longest substring without "
             "repeating characters.For example, the longest substring without "
             "repeating letters for bcabcbb is abc, which the length is 3.For "
             "bbbbb the longest substring is b, with the length of 1.";
  printf("%d\n", lengthOfLongestSubstring(s));
  printf("%d\n", lengthOfLongestSubstringOn(s));
  printf("%d\n", lengthOfLongestSubstringOn2(s));
}


x86 assembly (clang, -O0):
<lengthOfLongestSubstringMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0xf9,%edx
call   1050 <memcpy@plt>
lea    -0x100(%rbp),%rdi
call   1060 <lengthOfLongestSubstring@plt>
mov    %eax,%esi
lea    0xf71(%rip),%rdi
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
call   1070 <lengthOfLongestSubstringOn@plt>
mov    %eax,%esi
lea    0xf57(%rip),%rdi
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <lengthOfLongestSubstringOn2@plt>
mov    %eax,%esi
lea    0xf3d(%rip),%rdi
call   1040 <printf@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lengthOfLongestSubstringMain>:
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xe9f(%rip),%rsi
mov    %rsp,%rbx
mov    $0xf9,%edx
mov    %rbx,%rdi
call   1050 <memcpy@plt>
mov    %rbx,%rdi
call   1060 <lengthOfLongestSubstring@plt>
lea    0xf79(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1070 <lengthOfLongestSubstringOn@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <lengthOfLongestSubstringOn2@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.lengthOfLongestSubstringMain.s = [249 x i8] c"Given a string, find the length of the longest substring without repeating characters.For example, the longest substring without repeating letters for bcabcbb is abc, which the length is 3.For bbbbb the longest substring is b, with the length of 1.\00"
@.str = [4 x i8] c"%d\0A\00"
define void @lengthOfLongestSubstringMain() {
%1 = alloca [249 x i8]
%2 = bitcast [249 x i8]* %1 to i8*
%3 = getelementptr inbounds [249 x i8], [249 x i8]* %1, i64 0, i64 0
%4 = call i32 @lengthOfLongestSubstring(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [249 x i8], [249 x i8]* %1, i64 0, i64 0
%7 = call i32 @lengthOfLongestSubstringOn(i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [249 x i8], [249 x i8]* %1, i64 0, i64 0
%10 = call i32 @lengthOfLongestSubstringOn2(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@__const.lengthOfLongestSubstringMain.s = [249 x i8] c"Given a string, find the length of the longest substring without repeating characters.For example, the longest substring without repeating letters for bcabcbb is abc, which the length is 3.For bbbbb the longest substring is b, with the length of 1.\00"
@.str = [4 x i8] c"%d\0A\00"
define void @lengthOfLongestSubstringMain() {
%1 = alloca [249 x i8]
%2 = getelementptr inbounds [249 x i8], [249 x i8]* %1, i64 0, i64 0
%3 = call i32 @lengthOfLongestSubstring(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @lengthOfLongestSubstringOn(i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @lengthOfLongestSubstringOn2(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}