#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*/ noCh(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int strcmp(char *, char *);
int strlen(char *);
int main() {
  char str1[32], str2[32];
  char appC[32 + 20] = "First word entered is \0";
  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");
  }
  strcat(appC, str1);
  printf("\n%s\n", appC);
  printf("\nlength of appC is %d\n", strlen(appC));
  noCh(appC);
  printf("\n[Press ENTER to close]");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe60(%rip),%rsi
mov    $0x34,%edx
call   1080 <memcpy@plt>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e25(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1050 <fgets@plt>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e00(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1050 <fgets@plt>
lea    -0x30(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0x0,-0x94(%rbp)
jne    1227 <main+0xa7>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1235 <main+0xb5>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   10a0 <strcat@plt>
lea    -0x90(%rbp),%rsi
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1090 <noCh@plt>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe73(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe57(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x30(%rsp)
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e1e(%rip),%rbx
mov    (%rbx),%edx
lea    0x60(%rsp),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1060 <fgets@plt>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edx
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1060 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
lea    0xe85(%rip),%rax
lea    0xea4(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <strcat@plt>
lea    0xe2c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe18(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1090 <noCh@plt>
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.appC = [52 x i8] c"First word entered is \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.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 = [5 x i8] c"\0A%s\0A\00"
@.str.5 = [23 x i8] c"\0Alength of appC is %d\0A\00"
@.str.6 = [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 [52 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [52 x i8]* %4 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 32, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 32, i32 %13)
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%17 = call i32 @strcmp(i8* %15, i8* %16)
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %24
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
%25 = getelementptr inbounds [52 x i8], [52 x i8]* %4, i64 0, i64 0
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%27 = call i32 @strcat(i8* %25, i8* %26)
%28 = getelementptr inbounds [52 x i8], [52 x i8]* %4, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [52 x i8], [52 x i8]* %4, i64 0, i64 0
%31 = call i32 @strlen(i8* %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [52 x i8], [52 x i8]* %4, i64 0, i64 0
%34 = call i32 @noCh(i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.appC = [52 x i8] c"First word entered is \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.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 = [5 x i8] c"\0A%s\0A\00"
@.str.5 = [23 x i8] c"\0Alength of appC is %d\0A\00"
@.str.6 = [24 x i8] c"\0A[Press ENTER to close]\00"
@str = [38 x i8] c"\0AThe strings str1 and str2 are equal.\00"
@str.7 = [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 = alloca [52 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [52 x i8], [52 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 32, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %5, i32 32, i32 %11)
%13 = call i32 @strcmp(i8* %4, i8* %5)
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @str.7, i64 0, i64 0)
%16 = call i32 @puts(i8* dereferenceable(1) %15)
%17 = call i32 @strcat(i8* %6, i8* %4)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%19 = call i32 @strlen(i8* %6)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = call i32 @noCh(i8* %6)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (...) @getchar()
ret i32 0
}