#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
void string_compare(char a[], char b[], char c[]) {
  int count = 1;
  char yes_no[4];
  char yes1[] = "Yes";
  char yes2[] = "yes";
  printf("input : %s \n", b);
  printf("what should be : |%s| \n", a);
  if ((strcmp(a, b)) == 0) {
    printf("Correct! Your file(s) are %s\n", c);
  } else {
    while (strcmp(a, b) != 0) {
      gets(b);
      count++;
      if ((count % 5) == 0) {
        printf("Do you want to get the answer? (yes or no) If no, you will "
               "continue: ");
        gets(yes_no);
        if ((strcmp(yes1, yes_no) == 0) || (strcmp(yes_no, yes2) == 0)) {
          printf("%s\n", a);
          printf("Lets try it now: ");
          gets(b);
          count++;
        }
      }
      printf("\ninput : |%s| \n", b);
      printf("Wrong! try again: ");
    }
    printf("Correct! Your file(s) are %s\n", c);
  }
}


x86 assembly (clang, -O0):
<string_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x24(%rbp)
mov    0xeaa(%rip),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11af <string_compare+0x7f>
mov    -0x18(%rbp),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a4 <string_compare+0x174>
jmp    11b4 <string_compare+0x84>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1292 <string_compare+0x162>
mov    -0x10(%rbp),%rdi
call   1050 <gets@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    126d <string_compare+0x13d>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x24(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1236 <string_compare+0x106>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1268 <string_compare+0x138>
mov    -0x8(%rbp),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <gets@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    126d <string_compare+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <string_compare+0x84>
mov    -0x18(%rbp),%rsi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_compare>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r15
movl   $0x736559,0x10(%rsp)
movl   $0x736579,0xc(%rsp)
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12c8 <string_compare+0x188>
mov    %rbp,0x18(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12a6 <string_compare+0x166>
mov    $0x1,%ebp
lea    0xedc(%rip),%r14
lea    0xee5(%rip),%r12
mov    %rbx,0x20(%rsp)
jmp    1222 <string_compare+0xe2>
nopl   (%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <gets@plt>
add    $0x2,%ebp
mov    %ebp,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
mov    %r13d,%ebp
test   %rax,%rax
je     12a6 <string_compare+0x166>
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0x1(%rbp),%r13d
imul   $0xcccccccd,%r13d,%eax
add    $0x19999999,%eax
cmp    $0x33333332,%eax
ja     11f4 <string_compare+0xb4>
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rbx
mov    %r12,%r15
mov    %r14,%r12
lea    0x14(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %r12,%r14
mov    %r15,%r12
mov    %rbx,%r15
mov    0x20(%rsp),%rbx
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <string_compare+0x90>
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11f4 <string_compare+0xb4>
jmp    11d0 <string_compare+0x90>
lea    0xd78(%rip),%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd56(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@__const.string_compare.yes1 = [4 x i8] c"Yes\00"
@__const.string_compare.yes2 = [4 x i8] c"yes\00"
@.str = [13 x i8] c"input : %s \0A\00"
@.str.1 = [24 x i8] c"what should be : |%s| \0A\00"
@.str.2 = [30 x i8] c"Correct! Your file(s) are %s\0A\00"
@.str.3 = [70 x i8] c"Do you want to get the answer? (yes or no) If no, you will continue: \00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [18 x i8] c"Lets try it now: \00"
@.str.6 = [16 x i8] c"\0Ainput : |%s| \0A\00"
@.str.7 = [19 x i8] c"Wrong! try again: \00"
define void @string_compare(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [4 x i8]
%9 = alloca [4 x i8]
%10 = alloca [4 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 1, i32* %7
%11 = bitcast [4 x i8]* %9 to i8*
%12 = bitcast [4 x i8]* %10 to i8*
%13 = load i8*, i8** %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i64 @strcmp(i8* %17, i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = load i8*, i8** %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %67
24: ; preds = %3
br label %25
25: ; preds = %60, %24
%26 = load i8*, i8** %4
%27 = load i8*, i8** %5
%28 = call i64 @strcmp(i8* %26, i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %64
30: ; preds = %25
%31 = load i8*, i8** %5
%32 = call i32 @gets(i8* %31)
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = srem i32 %35, 5
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %60
38: ; preds = %30
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%41 = call i32 @gets(i8* %40)
%42 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%44 = call i64 @strcmp(i8* %42, i8* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %38
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%48 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%49 = call i64 @strcmp(i8* %47, i8* %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %46, %38
%52 = load i8*, i8** %4
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%55 = load i8*, i8** %5
%56 = call i32 @gets(i8* %55)
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %59
59: ; preds = %51, %46
br label %60
60: ; preds = %59, %30
%61 = load i8*, i8** %5
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
br label %25
64: ; preds = %25
%65 = load i8*, i8** %6
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %64, %21
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"input : %s \0A\00"
@.str.1 = [24 x i8] c"what should be : |%s| \0A\00"
@.str.2 = [30 x i8] c"Correct! Your file(s) are %s\0A\00"
@.str.3 = [70 x i8] c"Do you want to get the answer? (yes or no) If no, you will continue: \00"
@.str.5 = [18 x i8] c"Lets try it now: \00"
@.str.6 = [16 x i8] c"\0Ainput : |%s| \0A\00"
@.str.7 = [19 x i8] c"Wrong! try again: \00"
define void @string_compare(i8* %0, i8* %1, i8* %2) {
%4 = alloca [4 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i32 7562585, i32* %5
%9 = bitcast i32* %6 to i8*
store i32 7562617, i32* %6
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %1)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%12 = tail call i64 @strcmp(i8* %0, i8* %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = call i64 @strcmp(i8* %0, i8* %1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %44, label %19
17: ; preds = %3
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %46
19: ; preds = %14, %38
%20 = phi i32 [ %39, %38 ], [ 1, %14 ]
%21 = call i32 @gets(i8* %1)
%22 = add nsw i32 %20, 1
%23 = srem i32 %22, 5
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @gets(i8* %7)
%28 = call i64 @strcmp(i8* %8, i8* %7)
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %25
%31 = call i64 @strcmp(i8* %7, i8* %9)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30, %25
%34 = call i32 @puts(i8* dereferenceable(1) %0)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%36 = call i32 @gets(i8* %1)
%37 = add nsw i32 %20, 2
br label %38
38: ; preds = %30, %33, %19
%39 = phi i32 [ %37, %33 ], [ %22, %30 ], [ %22, %19 ]
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%42 = call i64 @strcmp(i8* %0, i8* %1)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %19
44: ; preds = %38, %14
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %46
46: ; preds = %44, %17
ret void
}