#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 diffByOne(char *, char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int strcmp1(char *, char *);
int strlen1(char *);
int main(void) {
  char str1[100], str2[100];
  fgets(str1, 100, stdin);
  fgets(str2, 100, stdin);
  printf("\nstrlen1(string1) =  %d\n", strlen1(str1));
  printf("\nstrlen1(string2) =  %d\n", strlen1(str2));
  printf("\nStrcmp1(string1,string2) = %d\n", strcmp1(str1, str2));
  printf("\ndiffByOne(string1,string2) = %d\n", diffByOne(str1, str2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1070 <fgets@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2e61(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1070 <fgets@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen1@plt>
mov    %eax,%esi
lea    0xe5b(%rip),%rdi
call   1060 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   1030 <strlen1@plt>
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1040 <strcmp1@plt>
mov    %eax,%esi
lea    0xe55(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <diffByOne@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
mov    0x2e87(%rip),%rbx
mov    (%rbx),%edx
lea    0x70(%rsp),%r14
mov    %r14,%rdi
mov    $0x64,%esi
call   1070 <fgets@plt>
mov    (%rbx),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1070 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen1@plt>
lea    0xe6a(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen1@plt>
lea    0xe6d(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp1@plt>
lea    0xe6d(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <diffByOne@plt>
lea    0xe74(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [25 x i8] c"\0Astrlen1(string1) = %d\0A\00"
@.str.1 = [25 x i8] c"\0Astrlen1(string2) = %d\0A\00"
@.str.2 = [32 x i8] c"\0AStrcmp1(string1,string2) = %d\0A\00"
@.str.3 = [34 x i8] c"\0AdiffByOne(string1,string2) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 100, i32 %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 100, i32 %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen1(i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = call i32 @strlen1(i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%18 = call i32 @strcmp1(i8* %16, i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%22 = call i32 @diffByOne(i8* %20, i8* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [25 x i8] c"\0Astrlen1(string1) = %d\0A\00"
@.str.1 = [25 x i8] c"\0Astrlen1(string2) = %d\0A\00"
@.str.2 = [32 x i8] c"\0AStrcmp1(string1,string2) = %d\0A\00"
@.str.3 = [34 x i8] c"\0AdiffByOne(string1,string2) = %d\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %3, i32 100, i32 %5)
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 100, i32 %7)
%9 = call i32 @strlen1(i8* %3)
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @strlen1(i8* %4)
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 @strcmp1(i8* %3, i8* %4)
%14 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 @diffByOne(i8* %3, i8* %4)
%16 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %15)
ret i32 0
}