#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*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *, int, char *, int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int);
int toupper(char);
char *moral_regla1(char *result, char *palabras[], const int verbose) {
  memset(result, 0, 4);
  if (verbose)
    printf("Aplicando regla 1:\n\t%-20s %c\n\t%-20s %c\n\t%-20s %c\n",
           palabras[0], toupper(*palabras[0]), palabras[1],
           toupper(*palabras[1]), palabras[2], toupper(*palabras[2]));
  snprintf(result, 4, "%c%c%c", toupper(*palabras[0]), toupper(*palabras[1]),
           toupper(*palabras[2]));
  return result;
}


x86 assembly (clang, -O0):
<moral_regla1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
cmpl   $0x0,-0x14(%rbp)
je     11e7 <moral_regla1+0xa7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x40(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x20(%rbp),%r9
lea    0xe21(%rip),%rdi
mov    %eax,(%rsp)
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    %eax,%r9d
mov    $0x4,%esi
lea    0xdf4(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moral_regla1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
test   %ebp,%ebp
je     11b3 <moral_regla1+0x73>
mov    (%rbx),%r12
movsbl (%r12),%edi
call   1030 <toupper@plt>
mov    %eax,0x14(%rsp)
mov    0x8(%rbx),%rbp
movsbl 0x0(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%r13d
mov    0x10(%rbx),%r15
movsbl (%r15),%edi
call   1030 <toupper@plt>
mov    %eax,(%rsp)
lea    0xe62(%rip),%rdi
mov    %r12,%rsi
mov    0x14(%rsp),%edx
mov    %rbp,%rcx
mov    %r13d,%r8d
mov    %r15,%r9
call   1040 <printf@plt>
mov    (%rbx),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%r15d
mov    0x8(%rbx),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
lea    0xe50(%rip),%rdx
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r15d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
call   1050 <snprintf@plt>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Aplicando regla 1:\0A\09%-20s %c\0A\09%-20s %c\0A\09%-20s %c\0A\00"
@.str.1 = [7 x i8] c"%c%c%c\00"
define i8* @moral_regla1(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = call i32 @memset(i8* %7, i32 0, i32 4)
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %37
11: ; preds = %3
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = call i32 @toupper(i8 signext %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
%27 = call i32 @toupper(i8 signext %26)
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = load i8, i8* %33
%35 = call i32 @toupper(i8 signext %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %19, i8* %22, i32 %27, i8* %30, i32 %35)
br label %37
37: ; preds = %11, %3
%38 = load i8*, i8** %4
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = load i8, i8* %41
%43 = call i32 @toupper(i8 signext %42)
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = load i8, i8* %46
%48 = call i32 @toupper(i8 signext %47)
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = load i8, i8* %51
%53 = call i32 @toupper(i8 signext %52)
%54 = call i32 @snprintf(i8* %38, i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %43, i32 %48, i32 %53)
%55 = load i8*, i8** %4
ret i8* %55
}

LLVM IR (-O2):
@.str = [50 x i8] c"Aplicando regla 1:\0A\09%-20s %c\0A\09%-20s %c\0A\09%-20s %c\0A\00"
@.str.1 = [7 x i8] c"%c%c%c\00"
define i8* @moral_regla1(i8* returned %0, i8** nocapture %1, i32 %2) {
%4 = tail call i32 @memset(i8* %0, i32 0, i32 4)
%5 = icmp eq i32 %2, 0
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = load i8*, i8** %1
%8 = load i8, i8* %7
%9 = tail call i32 @toupper(i8 signext %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = tail call i32 @toupper(i8 signext %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = tail call i32 @toupper(i8 signext %16)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9, i8* %11, i32 %13, i8* %15, i32 %17)
br label %19
19: ; preds = %6, %3
%20 = load i8*, i8** %1
%21 = load i8, i8* %20
%22 = tail call i32 @toupper(i8 signext %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = load i8, i8* %24
%26 = tail call i32 @toupper(i8 signext %25)
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = load i8, i8* %28
%30 = tail call i32 @toupper(i8 signext %29)
%31 = tail call i32 @snprintf(i8* %0, i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %26, i32 %30)
ret i8* %0
}