#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 *, ...);
void main() {
  char str1[80], str2[80];
  int i, max = 80;
  printf("Enter string 1:");
  gets(str1);
  printf("Enter string 2:");
  gets(str2);
  for (i = 0; i < max; i++) {
    if (str1[i] == '\0' && str2[i] == '\0') {
      printf("str1 - str2 = %d", 0);
      break;
    } else if (str1[i] == str2[i])
      continue;
    else {
      printf("str1 - str2 = %d", str1[i] - str2[i]);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x50,-0xa8(%rbp)
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
call   1040 <gets@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
call   1040 <gets@plt>
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0xa8(%rbp),%eax
jge    1230 <main+0x110>
movslq -0xa4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jne    11c4 <main+0xa4>
movslq -0xa4(%rbp),%rax
movsbl -0xa0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    11c4 <main+0xa4>
lea    0xe6a(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1230 <main+0x110>
movslq -0xa4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
movslq -0xa4(%rbp),%rcx
movsbl -0xa0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
jne    11ec <main+0xcc>
jmp    121c <main+0xfc>
movslq -0xa4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%esi
movslq -0xa4(%rbp),%rax
movsbl -0xa0(%rbp,%rax,1),%eax
ff
sub    %eax,%esi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1230 <main+0x110>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1170 <main+0x50>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0xa8,%rsp
lea    0xed0(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x50(%rsp),%rdi
call   1040 <gets@plt>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
mov    $0x1,%eax
xchg   %ax,%ax
movzbl 0x4f(%rsp,%rax,1),%ebx
movzbl -0x1(%rsp,%rax,1),%edx
mov    %ebx,%ecx
or     %dl,%cl
je     119b <main+0x7b>
cmp    %dl,%bl
jne    1193 <main+0x73>
movzbl 0x50(%rsp,%rax,1),%ebx
movzbl (%rsp,%rax,1),%edx
mov    %ebx,%ecx
or     %dl,%cl
je     119b <main+0x7b>
cmp    %dl,%bl
jne    1193 <main+0x73>
add    $0x2,%rax
cmp    $0x51,%rax
jne    1160 <main+0x40>
jmp    11ab <main+0x8b>
movsbl %dl,%eax
movsbl %bl,%ebp
sub    %eax,%ebp
lea    0xe7e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter string 1:\00"
@.str.1 = [16 x i8] c"Enter string 2:\00"
@.str.2 = [17 x i8] c"str1 - str2 = %d\00"
define void @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 80, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
store i32 0, i32* %3
br label %11
11: ; preds = %57, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %60
15: ; preds = %11
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %15
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 0)
br label %60
31: ; preds = %22, %15
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %36, %41
br i1 %42, label %43, label %44
43: ; preds = %31
br label %57
44: ; preds = %31
%45 = load i32, i32* %3
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = load i32, i32* %3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = sub nsw i32 %49, %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %55)
br label %60
57: ; preds = %43
%58 = load i32, i32* %3
%59 = add nsw i32 %58, 1
store i32 %59, i32* %3
br label %11
60: ; preds = %44, %29, %11
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Enter string 1:\00"
@.str.1 = [16 x i8] c"Enter string 2:\00"
@.str.2 = [17 x i8] c"str1 - str2 = %d\00"
define void @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
br label %23
9: ; preds = %32
%10 = or i64 %24, 1
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %10
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
%17 = select i1 %13, i1 %16, i1 false
br i1 %17, label %40, label %18
18: ; preds = %9
%19 = icmp eq i8 %12, %15
br i1 %19, label %20, label %34
20: ; preds = %18
%21 = add nuw nsw i64 %24, 2
%22 = icmp eq i64 %21, 80
br i1 %22, label %43, label %23
23: ; preds = %20, %0
%24 = phi i64 [ 0, %0 ], [ %21, %20 ]
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %24
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 0
%31 = select i1 %27, i1 %30, i1 false
br i1 %31, label %40, label %32
32: ; preds = %23
%33 = icmp eq i8 %26, %29
br i1 %33, label %9, label %34
34: ; preds = %18, %32
%35 = phi i8 [ %26, %32 ], [ %12, %18 ]
%36 = phi i8 [ %29, %32 ], [ %15, %18 ]
%37 = sext i8 %36 to i32
%38 = sext i8 %35 to i32
%39 = sub nsw i32 %38, %37
br label %40
40: ; preds = %23, %9, %34
%41 = phi i32 [ %39, %34 ], [ 0, %9 ], [ 0, %23 ]
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %20, %40
ret void
}