#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 *, ...);
int strcmp(char *, char *);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  char str1[80], str2[80];
  int x;
  while (1) {
    printf("\n\nInput the first string, a blank to exit: ");
    gets(str1);
    if (strlen(str1) == 0)
      break;
    printf("\nInput the second string: ");
    gets(str2);
    x = strcmp(str1, str2);
    printf("\nstrcmp(%s,%s) returns %d", str1, str2, x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1188 <main+0x48>
jmp    11dc <main+0x9c>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0xb4(%rbp)
lea    -0x60(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    -0xb4(%rbp),%ecx
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1159 <main+0x19>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa0,%rsp
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
call   1050 <gets@plt>
cmpb   $0x0,(%rsp)
je     11c7 <main+0x97>
lea    0xec9(%rip),%r14
lea    0x50(%rsp),%r15
mov    %rsp,%rbx
lea    0xed5(%rip),%r12
lea    0xe87(%rip),%r13
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
cmpb   $0x0,(%rsp)
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [44 x i8] c"\0A\0AInput the first string, a blank to exit: \00"
@.str.1 = [27 x i8] c"\0AInput the second string: \00"
@.str.2 = [26 x i8] c"\0Astrcmp(%s,%s) returns %d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %2, %17
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%12 = call i32 @gets(i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%14 = call i64 @strlen(i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %9
br label %28
17: ; preds = %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%20 = call i32 @gets(i8* %19)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%23 = call i32 @strcmp(i8* %21, i8* %22)
store i32 %23, i32* %8
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %24, i8* %25, i32 %26)
br label %9
28: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0A\0AInput the first string, a blank to exit: \00"
@.str.1 = [27 x i8] c"\0AInput the second string: \00"
@.str.2 = [26 x i8] c"\0Astrcmp(%s,%s) returns %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %5)
%9 = load i8, i8* %5
%10 = icmp eq i8 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %2, %11
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @gets(i8* %6)
%14 = call i32 @strcmp(i8* %5, i8* %6)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8* %6, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @gets(i8* %5)
%18 = load i8, i8* %5
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %11
20: ; preds = %11, %2
ret i32 0
}