#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 *, char *, ...);
int strlen(char *);
int main(void) {
  char cadena[] = "the quick brown fox jumps over the lazy dog";
  printf("Original: %s (%lu)\n", cadena, strlen(cadena));
  for (int i = 0; i < strlen(cadena); i++)
    if (cadena[i] >= 'a' && cadena[i] <= 'z')
      cadena[i] = (char)(cadena[i] - 0x20);
  printf("Todo mayusculas: %s\n", cadena);
  bool espacio_anterior = true;
  for (int i = 0; i < strlen(cadena); i++) {
    if (espacio_anterior) {
      if (cadena[i] >= 'a' && cadena[i] <= 'z')
        cadena[i] = (char)(cadena[i] - 0x20);
    } else {
      if (cadena[i] >= 'A' && cadena[i] <= 'Z')
        cadena[i] = (char)(cadena[i] + 0x20);
    }
    espacio_anterior = (bool)(cadena[i] == ' ');
  }
  printf("Estilo Titulo: %s\n", cadena);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x2c,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x4c(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
jge    11e9 <main+0xb9>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11d6 <main+0xa6>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11d6 <main+0xa6>
movslq -0x34(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
sub    $0x20,%eax
mov    %al,%cl
movslq -0x34(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
jmp    11db <main+0xab>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1180 <main+0x50>
lea    -0x30(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x50(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
cmp    %ecx,%eax
jge    12d2 <main+0x1a2>
cmpl   $0x0,-0x38(%rbp)
je     126e <main+0x13e>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     1269 <main+0x139>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     1269 <main+0x139>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
sub    $0x20,%eax
mov    %al,%cl
movslq -0x3c(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
jmp    12ad <main+0x17d>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x41,%eax
jl     12a8 <main+0x178>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x5a,%eax
jg     12a8 <main+0x178>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
add    $0x20,%eax
mov    %al,%cl
movslq -0x3c(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
jmp    12ad <main+0x17d>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x20,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1209 <main+0xd9>
lea    -0x30(%rbp),%rsi
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
movups 0xeed(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11a6 <main+0x86>
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1193 <main+0x73>
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11a6 <main+0x86>
movzbl (%rsp,%rbx,1),%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1180 <main+0x60>
add    $0xe0,%al
mov    %al,(%rsp,%rbx,1)
jmp    1180 <main+0x60>
lea    0xe93(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    122c <main+0x10c>
mov    $0x1,%ebp
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1200 <main+0xe0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %cl,%al
mov    %al,(%rsp,%rbx,1)
xor    %ebp,%ebp
cmp    $0x20,%al
sete   %bpl
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    122c <main+0x10c>
movzbl (%rsp,%rbx,1),%eax
test   %ebp,%ebp
je     1220 <main+0x100>
lea    -0x61(%rax),%edx
mov    $0xe0,%cl
cmp    $0x1a,%dl
jb     11e0 <main+0xc0>
jmp    11e5 <main+0xc5>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x41(%rax),%edx
mov    $0x20,%cl
cmp    $0x19,%dl
jbe    11e0 <main+0xc0>
jmp    11e5 <main+0xc5>
lea    0xe22(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.cadena = [44 x i8] c"the quick brown fox jumps over the lazy dog\00"
@.str = [20 x i8] c"Original: %s (%lu)\0A\00"
@.str.1 = [21 x i8] c"Todo mayusculas: %s\0A\00"
@.str.2 = [19 x i8] c"Estilo Titulo: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [44 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [44 x i8]* %2 to i8*
%7 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
store i32 0, i32* %3
br label %11
11: ; preds = %42, %0
%12 = load i32, i32* %3
%13 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = icmp slt i32 %12, %14
br i1 %15, label %16, label %45
16: ; preds = %11
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 97
br i1 %22, label %23, label %41
23: ; preds = %16
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 122
br i1 %29, label %30, label %41
30: ; preds = %23
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = sub nsw i32 %35, 32
%37 = trunc i32 %36 to i8
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %39
store i8 %37, i8* %40
br label %41
41: ; preds = %30, %23, %16
br label %42
42: ; preds = %41
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %11
45: ; preds = %11
%46 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 0
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %46)
store i32 1, i32* %4
store i32 0, i32* %5
br label %48
48: ; preds = %116, %45
%49 = load i32, i32* %5
%50 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %119
53: ; preds = %48
%54 = load i32, i32* %4
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %82
56: ; preds = %53
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp sge i32 %61, 97
br i1 %62, label %63, label %81
63: ; preds = %56
%64 = load i32, i32* %5
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp sle i32 %68, 122
br i1 %69, label %70, label %81
70: ; preds = %63
%71 = load i32, i32* %5
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = sub nsw i32 %75, 32
%77 = trunc i32 %76 to i8
%78 = load i32, i32* %5
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %79
store i8 %77, i8* %80
br label %81
81: ; preds = %70, %63, %56
br label %108
82: ; preds = %53
%83 = load i32, i32* %5
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %84
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp sge i32 %87, 65
br i1 %88, label %89, label %107
89: ; preds = %82
%90 = load i32, i32* %5
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %91
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = icmp sle i32 %94, 90
br i1 %95, label %96, label %107
96: ; preds = %89
%97 = load i32, i32* %5
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %98
%100 = load i8, i8* %99
%101 = sext i8 %100 to i32
%102 = add nsw i32 %101, 32
%103 = trunc i32 %102 to i8
%104 = load i32, i32* %5
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %105
store i8 %103, i8* %106
br label %107
107: ; preds = %96, %89, %82
br label %108
108: ; preds = %107, %81
%109 = load i32, i32* %5
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 %110
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp eq i32 %113, 32
%115 = zext i1 %114 to i32
store i32 %115, i32* %4
br label %116
116: ; preds = %108
%117 = load i32, i32* %5
%118 = add nsw i32 %117, 1
store i32 %118, i32* %5
br label %48
119: ; preds = %48
%120 = getelementptr inbounds [44 x i8], [44 x i8]* %2, i64 0, i64 0
%121 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %120)
ret i32 0
}

LLVM IR (-O2):
@__const.main.cadena = [44 x i8] c"the quick brown fox jumps over the lazy dog\00"
@.str = [20 x i8] c"Original: %s (%lu)\0A\00"
@.str.1 = [21 x i8] c"Todo mayusculas: %s\0A\00"
@.str.2 = [19 x i8] c"Estilo Titulo: %s\0A\00"
define i32 @main() {
%1 = alloca [44 x i8]
%2 = getelementptr inbounds [44 x i8], [44 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %19, %0
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = call i32 @strlen(i8* %2)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %26, label %24
11: ; preds = %0, %19
%12 = phi i64 [ %20, %19 ], [ 0, %0 ]
%13 = getelementptr inbounds [44 x i8], [44 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = add i8 %14, -97
%16 = icmp ult i8 %15, 26
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = add nsw i8 %14, -32
store i8 %18, i8* %13
br label %19
19: ; preds = %11, %17
%20 = add nuw nsw i64 %12, 1
%21 = call i32 @strlen(i8* %2)
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %11, label %7
24: ; preds = %41, %7
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
26: ; preds = %7, %41
%27 = phi i64 [ %45, %41 ], [ 0, %7 ]
%28 = phi i32 [ %44, %41 ], [ 1, %7 ]
%29 = icmp eq i32 %28, 0
%30 = getelementptr inbounds [44 x i8], [44 x i8]* %1, i64 0, i64 %27
%31 = load i8, i8* %30
br i1 %29, label %35, label %32
32: ; preds = %26
%33 = add i8 %31, -97
%34 = icmp ult i8 %33, 26
br i1 %34, label %38, label %41
35: ; preds = %26
%36 = add i8 %31, -65
%37 = icmp ult i8 %36, 26
br i1 %37, label %38, label %41
38: ; preds = %35, %32
%39 = phi i8 [ -32, %32 ], [ 32, %35 ]
%40 = add nsw i8 %31, %39
store i8 %40, i8* %30
br label %41
41: ; preds = %38, %35, %32
%42 = phi i8 [ %31, %35 ], [ %31, %32 ], [ %40, %38 ]
%43 = icmp eq i8 %42, 32
%44 = zext i1 %43 to i32
%45 = add nuw nsw i64 %27, 1
%46 = call i32 @strlen(i8* %2)
%47 = sext i32 %46 to i64
%48 = icmp slt i64 %45, %47
br i1 %48, label %26, label %24
}