#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char palavra1[50], palavra2[50];
  int i, anagrama = -1, tamanho1, tamanho2, j = 0, flag = 1;
  printf("Digite uma palavra: ");
  scanf("%s", palavra1);
  (tamanho1 = strlen(palavra1) - 1);
  printf("Digite outra palavra: ");
  scanf("%s", palavra2);
  (tamanho2 = strlen(palavra2) - 1);
  if (tamanho1 != tamanho2) {
    flag = 0;
    printf("%s e %s não são um anagrama.\n", palavra1, palavra2);
  } else {
    for (i = tamanho1; i >= 0; i--) {
      if (palavra1[i] == palavra2[j]) {
        anagrama++;
      }
      j++;
    }
  }
  if (anagrama == tamanho1) {
    printf("%s e %s são um anagrama.\n", palavra1, palavra2);
  } else if (flag) {
    printf("%s e %s não são um anagrama.\n", palavra1, palavra2);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x88(%rbp)
ff ff ff
movl   $0x0,-0x94(%rbp)
movl   $0x1,-0x98(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x8c(%rbp)
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x90(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x90(%rbp),%eax
je     11f7 <main+0xc7>
movl   $0x0,-0x98(%rbp)
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1267 <main+0x137>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x84(%rbp)
cmpl   $0x0,-0x84(%rbp)
jl     1262 <main+0x132>
movslq -0x84(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
movslq -0x94(%rbp),%rcx
movsbl -0x80(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    123f <main+0x10f>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
jmp    1203 <main+0xd3>
jmp    1267 <main+0x137>
mov    -0x88(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jne    1294 <main+0x164>
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12bc <main+0x18c>
cmpl   $0x0,-0x98(%rbp)
je     12b7 <main+0x187>
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12bc <main+0x18c>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee5(%rip),%r15
lea    0x40(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    %eax,%ebx
jne    11b0 <main+0x80>
lea    -0x1(%rbx),%r9d
test   %ebx,%ebx
jle    11da <main+0xaa>
mov    %r9d,%r8d
mov    %ebx,%ecx
cmp    $0x8,%ebx
jae    11e4 <main+0xb4>
mov    $0xffffffff,%eax
xor    %edx,%edx
jmp    12ae <main+0x17e>
lea    0xe98(%rip),%rdi
lea    0x40(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jne    12ff <main+0x1cf>
lea    0xe9a(%rip),%rdi
jmp    12f0 <main+0x1c0>
mov    $0xffffffff,%eax
jmp    12db <main+0x1ab>
mov    %ecx,%edx
and    $0xfffffff8,%edx
lea    0x4(%rsp),%rdi
mov    %rdx,%rbx
neg    %rbx
lea    (%r8,%r14,1),%rsi
add    $0xfffffffffffffffd,%rsi
sub    %rdx,%r8
pxor   %xmm0,%xmm0
movdqa 0xdf5(%rip),%xmm1
xor    %eax,%eax
movdqa 0xdfb(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nop
movd   (%rsi,%rax,1),%xmm3
punpcklbw %xmm3,%xmm3
movd   -0x4(%rsi,%rax,1),%xmm4
punpcklbw %xmm4,%xmm4
movq   -0x4(%rdi),%xmm5
punpcklbw %xmm5,%xmm5
punpcklwd %xmm5,%xmm5
movd   (%rdi),%xmm6
punpcklbw %xmm6,%xmm6
punpcklwd %xmm6,%xmm6
pshufd $0xc4,%xmm3,%xmm3
pshuflw $0xe7,%xmm3,%xmm3
pshufhw $0xc5,%xmm3,%xmm3
pcmpeqb %xmm5,%xmm3
pand   %xmm2,%xmm3
paddd  %xmm3,%xmm1
pshufd $0xc4,%xmm4,%xmm3
pshuflw $0xe7,%xmm3,%xmm3
pshufhw $0xc5,%xmm3,%xmm3
pcmpeqb %xmm6,%xmm3
pand   %xmm2,%xmm3
paddd  %xmm3,%xmm0
add    $0x8,%rdi
add    $0xfffffffffffffff8,%rax
cmp    %rax,%rbx
jne    1220 <main+0xf0>
paddd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
cmp    %rcx,%rdx
je     12db <main+0x1ab>
lea    (%rsp,%r8,1),%rsi
add    $0x40,%rsi
cs nopw 0x0(%rax,%rax,1)
movzbl (%rsi),%ebx
xor    %edi,%edi
cmp    (%rsp,%rdx,1),%bl
sete   %dil
add    %edi,%eax
add    $0x1,%rdx
add    $0xffffffffffffffff,%rsi
cmp    %rdx,%rcx
jne    12c0 <main+0x190>
cmp    %r9d,%eax
lea    0xd8a(%rip),%rax
lea    0xd63(%rip),%rdi
cmove  %rax,%rdi
lea    0x40(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Digite uma palavra: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c"Digite outra palavra: \00"
@.str.3 = [32 x i8] c"%s e %s n\C3\A3o s\C3\A3o um anagrama.\0A\00"
@.str.4 = [27 x i8] c"%s e %s s\C3\A3o um anagrama.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %5
store i32 0, i32* %8
store i32 1, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %7
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %0
store i32 0, i32* %9
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %26, i8* %27)
br label %56
29: ; preds = %0
%30 = load i32, i32* %6
store i32 %30, i32* %4
br label %31
31: ; preds = %52, %29
%32 = load i32, i32* %4
%33 = icmp sge i32 %32, 0
br i1 %33, label %34, label %55
34: ; preds = %31
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %39, %44
br i1 %45, label %46, label %49
46: ; preds = %34
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %49
49: ; preds = %46, %34
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %52
52: ; preds = %49
%53 = load i32, i32* %4
%54 = add nsw i32 %53, -1
store i32 %54, i32* %4
br label %31
55: ; preds = %31
br label %56
56: ; preds = %55, %25
%57 = load i32, i32* %5
%58 = load i32, i32* %6
%59 = icmp eq i32 %57, %58
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%62 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %61, i8* %62)
br label %72
64: ; preds = %56
%65 = load i32, i32* %9
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %71
67: ; preds = %64
%68 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%69 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %68, i8* %69)
br label %71
71: ; preds = %67, %64
br label %72
72: ; preds = %71, %60
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [21 x i8] c"Digite uma palavra: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c"Digite outra palavra: \00"
@.str.3 = [32 x i8] c"%s e %s n\C3\A3o s\C3\A3o um anagrama.\0A\00"
@.str.4 = [27 x i8] c"%s e %s s\C3\A3o um anagrama.\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @strlen(i8* %3)
%8 = add i32 %7, -1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @strlen(i8* %4)
%12 = icmp eq i32 %7, %11
br i1 %12, label %13, label %76
13: ; preds = %0
%14 = icmp sgt i32 %7, 0
br i1 %14, label %15, label %72
15: ; preds = %13
%16 = zext i32 %8 to i64
%17 = zext i32 %7 to i64
%18 = icmp ult i32 %7, 8
br i1 %18, label %54, label %19
19: ; preds = %15
%20 = and i64 %17, 4294967288
%21 = sub nsw i64 %16, %20
br label %22
22: ; preds = %22, %19
%23 = phi i64 [ 0, %19 ], [ %48, %22 ]
%24 = phi <4 x i32> [ <i32 -1, i32 0, i32 0, i32 0>, %19 ], [ %46, %22 ]
%25 = phi <4 x i32> [ zeroinitializer, %19 ], [ %47, %22 ]
%26 = sub i64 %16, %23
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %26
%28 = getelementptr inbounds i8, i8* %27, i64 -3
%29 = bitcast i8* %28 to <4 x i8>*
%30 = load <4 x i8>, <4 x i8>* %29
%31 = shufflevector <4 x i8> %30, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%32 = getelementptr inbounds i8, i8* %27, i64 -7
%33 = bitcast i8* %32 to <4 x i8>*
%34 = load <4 x i8>, <4 x i8>* %33
%35 = shufflevector <4 x i8> %34, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %23
%37 = bitcast i8* %36 to <4 x i8>*
%38 = load <4 x i8>, <4 x i8>* %37
%39 = getelementptr inbounds i8, i8* %36, i64 4
%40 = bitcast i8* %39 to <4 x i8>*
%41 = load <4 x i8>, <4 x i8>* %40
%42 = icmp eq <4 x i8> %31, %38
%43 = icmp eq <4 x i8> %35, %41
%44 = zext <4 x i1> %42 to <4 x i32>
%45 = zext <4 x i1> %43 to <4 x i32>
%46 = add <4 x i32> %24, %44
%47 = add <4 x i32> %25, %45
%48 = add nuw i64 %23, 8
%49 = icmp eq i64 %48, %20
br i1 %49, label %50, label %22
50: ; preds = %22
%51 = add <4 x i32> %47, %46
%52 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %51)
%53 = icmp eq i64 %20, %17
br i1 %53, label %72, label %54
54: ; preds = %15, %50
%55 = phi i64 [ %16, %15 ], [ %21, %50 ]
%56 = phi i64 [ 0, %15 ], [ %20, %50 ]
%57 = phi i32 [ -1, %15 ], [ %52, %50 ]
br label %58
58: ; preds = %54, %58
%59 = phi i64 [ %70, %58 ], [ %55, %54 ]
%60 = phi i64 [ %69, %58 ], [ %56, %54 ]
%61 = phi i32 [ %68, %58 ], [ %57, %54 ]
%62 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %59
%63 = load i8, i8* %62
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %60
%65 = load i8, i8* %64
%66 = icmp eq i8 %63, %65
%67 = zext i1 %66 to i32
%68 = add nsw i32 %61, %67
%69 = add nuw nsw i64 %60, 1
%70 = add nsw i64 %59, -1
%71 = icmp eq i64 %69, %17
br i1 %71, label %72, label %58
72: ; preds = %58, %50, %13
%73 = phi i32 [ -1, %13 ], [ %52, %50 ], [ %68, %58 ]
%74 = icmp eq i32 %73, %8
%75 = select i1 %74, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0)
br label %79
76: ; preds = %0
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %3, i8* %4)
%78 = icmp eq i32 %7, 0
br i1 %78, label %79, label %82
79: ; preds = %72, %76
%80 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), %76 ], [ %75, %72 ]
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %80, i8* %3, i8* %4)
br label %82
82: ; preds = %79, %76
ret i32 0
}