#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ find_track(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char search_for[80];
  int last;
  printf("Search for: ");
  fgets(search_for, 80, stdin);
  last = strlen(search_for) - 1;
  printf("%s,  %d, %c, %d, %c end\n", search_for, search_for[last],
         search_for[last], search_for[last + 1], search_for[last + 1]);
  search_for[strlen(search_for) - 1] = '\0';
  printf("%s,  %d, %c, %d, %c end\n", search_for, search_for[last],
         search_for[last], search_for[last + 1], search_for[last + 1]);
  find_track(search_for);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1060 <fgets@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x64(%rbp)
lea    -0x60(%rbp),%rsi
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%edx
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%r8d
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%r9d
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rsi
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%edx
movslq -0x64(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%ecx
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%r8d
mov    -0x64(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%r9d
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <find_track@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x50,%esi
call   1060 <fgets@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
movslq %eax,%rbx
movsbl -0x1(%rsp,%rbx,1),%ecx
movsbl (%rsp,%rbx,1),%r8d
lea    0xe81(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ecx,%edx
mov    %r8d,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r15,1)
movsbl -0x1(%rsp,%rbx,1),%ecx
movsbl (%rsp,%rbx,1),%r8d
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ecx,%edx
mov    %r8d,%r9d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1030 <find_track@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Search for: \00"
@stdin = global i32 0
@.str.1 = [25 x i8] c"%s, %d, %c, %d, %c end\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 80, i32 %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %3
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %16, i32 %21, i32 %27, i32 %33)
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %38
store i8 0, i8* %39
%40 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %40, i32 %45, i32 %50, i32 %56, i32 %62)
%64 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%65 = call i32 @find_track(i8* %64)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Search for: \00"
@stdin = global i32 0
@.str.1 = [25 x i8] c"%s, %d, %c, %d, %c end\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 80, i32 %4)
%6 = call i32 @strlen(i8* %2)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = sext i32 %6 to i64
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %11, i32 %11, i32 %15, i32 %15)
%17 = call i32 @strlen(i8* %2)
%18 = add nsw i32 %17, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %19
store i8 0, i8* %20
%21 = load i8, i8* %9
%22 = sext i8 %21 to i32
%23 = load i8, i8* %13
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %22, i32 %22, i32 %24, i32 %24)
%26 = call i32 @find_track(i8* %2)
ret i32 0
}