#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int strcmp(char *, char *);
int main() {
  char str1[32], str2[32];
  int comp;
  printf("Input a word for str1: ");
  fgets(str1, 32, stdin);
  printf("\nInput a word for str2: ");
  fgets(str2, 32, stdin);
  comp = strcmp(str1, str2);
  if (!comp) {
    printf("\nThe strings str1 and str2 are equal.\n");
  } else {
    printf("\nThe strings str1 and str2 are not equal.\n");
  }
  printf("\n[Press ENTER to close]");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e82(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1040 <fgets@plt>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e5f(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1040 <fgets@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    11c0 <main+0x80>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    11cc <main+0x8c>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e7e(%rip),%rbx
mov    (%rbx),%edx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1050 <fgets@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1050 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
lea    0xe99(%rip),%rax
lea    0xeb8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Input a word for str1: \00"
@stdin = global i32 0
@.str.1 = [25 x i8] c"\0AInput a word for str2: \00"
@.str.2 = [39 x i8] c"\0AThe strings str1 and str2 are equal.\0A\00"
@.str.3 = [43 x i8] c"\0AThe strings str1 and str2 are not equal.\0A\00"
@.str.4 = [24 x i8] c"\0A[Press ENTER to close]\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca [32 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 32, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 32, i32 %11)
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%15 = call i32 @strcmp(i8* %13, i8* %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %22
20: ; preds = %0
%21 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
%23 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Input a word for str1: \00"
@stdin = global i32 0
@.str.1 = [25 x i8] c"\0AInput a word for str2: \00"
@.str.4 = [24 x i8] c"\0A[Press ENTER to close]\00"
@str = [38 x i8] c"\0AThe strings str1 and str2 are equal.\00"
@str.5 = [42 x i8] c"\0AThe strings str1 and str2 are not equal.\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 32, i32 %6)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %4, i32 32, i32 %9)
%11 = call i32 @strcmp(i8* %3, i8* %4)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @str.5, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (...) @getchar()
ret i32 0
}