#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 comparar(char *, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char a[1000];
  char b[1000];
  int y;
  printf("Introduce la primera frase");
  scanf("\n%[^\n]", a);
  printf("Introduce la segunda frase");
  scanf("\n%[^\n]", b);
  y = comparar(a, b, 1000);
  if (y != 0) {
    printf("No son iguales.");
  } else if (y == 0) {
    printf("Son iguales");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
mov    $0x3e8,%edx
call   1030 <comparar@plt>
mov    %eax,-0x7e4(%rbp)
cmpl   $0x0,-0x7e4(%rbp)
je     11bc <main+0x8c>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
jmp    11da <main+0xaa>
cmpl   $0x0,-0x7e4(%rbp)
jne    11d5 <main+0xa5>
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
jmp    11da <main+0xaa>
mov    -0x4(%rbp),%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xecc(%rip),%r15
lea    0x3f0(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3e8,%edx
call   1030 <comparar@plt>
test   %eax,%eax
lea    0xeb8(%rip),%rax
lea    0xea1(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Introduce la primera frase\00"
@.str.1 = [7 x i8] c"\0A%[^\0A]\00"
@.str.2 = [27 x i8] c"Introduce la segunda frase\00"
@.str.3 = [16 x i8] c"No son iguales.\00"
@.str.4 = [12 x i8] c"Son iguales\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%13 = call i32 @comparar(i8* %11, i8* %12, i32 1000)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %24
18: ; preds = %0
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
br label %24
24: ; preds = %23, %16
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [27 x i8] c"Introduce la primera frase\00"
@.str.1 = [7 x i8] c"\0A%[^\0A]\00"
@.str.2 = [27 x i8] c"Introduce la segunda frase\00"
@.str.3 = [16 x i8] c"No son iguales.\00"
@.str.4 = [12 x i8] c"Son iguales\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%9 = call i32 @comparar(i8* %3, i8* %4, i32 1000)
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0)
%12 = call i32 @printf(i8* dereferenceable(1) %11)
ret i32 0
}