#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 strlen(char *);
char tolower(char);
void convertirMinusculas(char *cadena) {
  int i;
  int lol = strlen(cadena);
  for (i = 0; i <= lol; i++) {
    cadena[i] = tolower(cadena[i]);
  }
  printf("Minusculas: ");
  printf("%s\n\n", cadena);
}


x86 assembly (clang, -O0):
<convertirMinusculas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1187 <convertirMinusculas+0x57>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <convertirMinusculas+0x1f>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertirMinusculas>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
js     1167 <convertirMinusculas+0x37>
mov    %eax,%r14d
add    $0x1,%r14d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1050 <tolower@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1150 <convertirMinusculas+0x20>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Minusculas: \00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
define void @convertirMinusculas(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
store i32 0, i32* %3
br label %7
7: ; preds = %22, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call signext i8 @tolower(i8 signext %16)
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
br label %22
22: ; preds = %11
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %7
25: ; preds = %7
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%27 = load i8*, i8** %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %27)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Minusculas: \00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
define void @convertirMinusculas(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add nuw i32 %2, 1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call signext i8 @tolower(i8 signext %10)
store i8 %11, i8* %9
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}