#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 *);
void compara() {
  char texto1[40], texto2[40], texto3[40];
  printf("Introduce una palabra: ");
  gets(texto1);
  printf("Introduce otra palabra: ");
  gets(texto2);
  int comparacion = strcmp(texto1, texto2);
  if (comparacion == 0)
    printf("Son iguales.\n");
  else if (comparacion > 0)
    printf("La primera palabra es mayor.\n");
  else
    printf("La segunda palabra es mayor.\n");
}


x86 assembly (clang, -O0):
<compara>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <gets@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x94(%rbp)
cmpl   $0x0,-0x94(%rbp)
jne    1196 <compara+0x66>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <compara+0x95>
cmpl   $0x0,-0x94(%rbp)
jle    11b4 <compara+0x84>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    11c0 <compara+0x90>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <compara+0x95>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compara>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
lea    0xec3(%rip),%rax
lea    0xe9f(%rip),%rcx
cmovg  %rax,%rcx
lea    0xece(%rip),%rdi
cmovne %rcx,%rdi
call   1030 <puts@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Introduce una palabra: \00"
@.str.1 = [25 x i8] c"Introduce otra palabra: \00"
@.str.2 = [14 x i8] c"Son iguales.\0A\00"
@.str.3 = [30 x i8] c"La primera palabra es mayor.\0A\00"
@.str.4 = [30 x i8] c"La segunda palabra es mayor.\0A\00"
define void @compara() {
%1 = alloca [40 x i8]
%2 = alloca [40 x i8]
%3 = alloca [40 x i8]
%4 = alloca i32
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
%11 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%12 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%13 = call i32 @strcmp(i8* %11, i8* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %26
18: ; preds = %0
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %25
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %26
26: ; preds = %25, %16
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Introduce una palabra: \00"
@.str.1 = [25 x i8] c"Introduce otra palabra: \00"
@str = [29 x i8] c"La segunda palabra es mayor.\00"
@str.5 = [29 x i8] c"La primera palabra es mayor.\00"
@str.6 = [13 x i8] c"Son iguales.\00"
define void @compara() {
%1 = alloca [40 x i8]
%2 = alloca [40 x i8]
%3 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 @strcmp(i8* %3, i8* %4)
%10 = icmp eq i32 %9, 0
%11 = icmp sgt i32 %9, 0
%12 = select i1 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0)
%13 = select i1 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str.6, i64 0, i64 0), i8* %12
%14 = call i32 @puts(i8* dereferenceable(1) %13)
ret void
}