#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 first_non_repeat(char *);
int first_non_repeat_long(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main() {
  char *str = "this is either the worst or the best";
  printf("the first non-repeating character of: %s\nis: %c\n", str,
         first_non_repeat(str));
  str = "this is a much longer string that might be longer than two hundred "
        "fifty six characters";
  printf("the first non-repeating character of: %s\nis: %c\n", str,
         first_non_repeat_long(str));
  str = "should be last character .boud. x";
  printf("the first non-repeating character of: %s\nis: %c\n", str,
         first_non_repeat(str));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <first_non_repeat@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <first_non_repeat_long@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0c(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <first_non_repeat@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1050 <first_non_repeat@plt>
lea    0xedb(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xef8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <first_non_repeat_long@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xf34(%rip),%rbx
mov    %rbx,%rdi
call   1050 <first_non_repeat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"this is either the worst or the best\00"
@.str.1 = [49 x i8] c"the first non-repeating character of: %s\0Ais: %c\0A\00"
@.str.2 = [88 x i8] c"this is a much longer string that might be longer than two hundred fifty six characters\00"
@.str.3 = [34 x i8] c"should be last character .boud. x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @first_non_repeat(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 %5)
store i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0), i8** %2
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @first_non_repeat_long(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32 %9)
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8** %2
%11 = load i8*, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @first_non_repeat(i8* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"this is either the worst or the best\00"
@.str.1 = [49 x i8] c"the first non-repeating character of: %s\0Ais: %c\0A\00"
@.str.2 = [88 x i8] c"this is a much longer string that might be longer than two hundred fifty six characters\00"
@.str.3 = [34 x i8] c"should be last character .boud. x\00"
define i32 @main() {
%1 = tail call i32 @first_non_repeat(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @first_non_repeat_long(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = tail call i32 @first_non_repeat(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %5)
ret i32 0
}