#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 */
typedef int /*<<< orphan*/ cadena2;
typedef int /*<<< orphan*/ cadena;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char cadena[] = "holamundo";
  char cadena2[] = "hola mundo";
  printf("Convierte \"%s\" a mayúsculas:\n", cadena);
  for (unsigned int i = 0; i < sizeof(cadena) - 1; i++) {
    printf("%c", (cadena[i] - 32));
  }
  printf("\n\nSolo la primera letra de cada palabra en \"%s\":\n", cadena2);
  for (unsigned int i = 0; i < sizeof(cadena2) - 1; i++) {
    if (i == 0) {
      printf("%c", (cadena2[i] - 32));
    } else if (cadena2[i - 1] == ' ') {
      printf("%c", (cadena2[i] - 32));
    } else {
      printf("%c", (cadena2[i]));
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xecb(%rip),%ax
mov    %ax,-0x11(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0xf(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    $0x9,%rax
jae    11a1 <main+0x91>
mov    -0x20(%rbp),%eax
movsbl -0xe(%rbp,%rax,1),%esi
sub    $0x20,%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116d <main+0x5d>
lea    -0x19(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    $0xa,%rax
jae    1251 <main+0x141>
cmpl   $0x0,-0x24(%rbp)
jne    11ef <main+0xdf>
mov    -0x24(%rbp),%eax
movsbl -0x19(%rbp,%rax,1),%esi
sub    $0x20,%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0x12e>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,%eax
movsbl -0x19(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    1223 <main+0x113>
mov    -0x24(%rbp),%eax
movsbl -0x19(%rbp,%rax,1),%esi
sub    $0x20,%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1239 <main+0x129>
mov    -0x24(%rbp),%eax
movsbl -0x19(%rbp,%rax,1),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0x12e>
jmp    1243 <main+0x133>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ba <main+0xaa>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movabs $0x646e756d616c6f68,%rax
75 6e 64
mov    %rax,0x18(%rsp)
movw   $0x6f,0x20(%rsp)
movabs $0x6e756d20616c6f68,%rax
6d 75 6e
mov    %rax,0x8(%rsp)
movl   $0x6f646e,0xf(%rsp)
lea    0xebd(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x18(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x19(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x1a(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x1b(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x1c(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x1d(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x1e(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x1f(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x20(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
lea    0xe54(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x8(%rsp),%edi
add    $0xffffffe0,%edi
call   1030 <putchar@plt>
movsbl 0x9(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0x8(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0xa(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0x9(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0xb(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0xa(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0xc(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0xb(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0xd(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0xc(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0xe(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0xd(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0xf(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0xe(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0x10(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0xf(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
movsbl 0x11(%rsp),%eax
lea    -0x20(%rax),%edi
cmpb   $0x20,0x10(%rsp)
cmovne %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.cadena = [10 x i8] c"holamundo\00"
@__const.main.cadena2 = [11 x i8] c"hola mundo\00"
@.str = [31 x i8] c"Convierte \22%s\22 a may\C3\BAsculas:\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [50 x i8] c"\0A\0ASolo la primera letra de cada palabra en \22%s\22:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [11 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i8]* %2 to i8*
%7 = bitcast [11 x i8]* %3 to i8*
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %4
br label %10
10: ; preds = %22, %0
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = icmp ult i64 %12, 9
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %14
%23 = load i32, i32* %4
%24 = add i32 %23, 1
store i32 %24, i32* %4
br label %10
25: ; preds = %10
%26 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %26)
store i32 0, i32* %5
br label %28
28: ; preds = %68, %25
%29 = load i32, i32* %5
%30 = zext i32 %29 to i64
%31 = icmp ult i64 %30, 10
br i1 %31, label %32, label %71
32: ; preds = %28
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %43
35: ; preds = %32
%36 = load i32, i32* %5
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 32
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %41)
br label %67
43: ; preds = %32
%44 = load i32, i32* %5
%45 = sub i32 %44, 1
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 32
br i1 %50, label %51, label %59
51: ; preds = %43
%52 = load i32, i32* %5
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = sub nsw i32 %56, 32
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %57)
br label %66
59: ; preds = %43
%60 = load i32, i32* %5
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %59, %51
br label %67
67: ; preds = %66, %35
br label %68
68: ; preds = %67
%69 = load i32, i32* %5
%70 = add i32 %69, 1
store i32 %70, i32* %5
br label %28
71: ; preds = %28
%72 = load i32, i32* %1
ret i32 %72
}

LLVM IR (-O2):
@__const.main.cadena = [10 x i8] c"holamundo\00"
@__const.main.cadena2 = [11 x i8] c"hola mundo\00"
@.str = [31 x i8] c"Convierte \22%s\22 a may\C3\BAsculas:\0A\00"
@.str.2 = [50 x i8] c"\0A\0ASolo la primera letra de cada palabra en \22%s\22:\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = add nsw i32 %7, -32
%9 = call i32 @putchar(i32 %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, -32
%14 = call i32 @putchar(i32 %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = add nsw i32 %17, -32
%19 = call i32 @putchar(i32 %18)
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = add nsw i32 %22, -32
%24 = call i32 @putchar(i32 %23)
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = add nsw i32 %27, -32
%29 = call i32 @putchar(i32 %28)
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = add nsw i32 %32, -32
%34 = call i32 @putchar(i32 %33)
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = add nsw i32 %37, -32
%39 = call i32 @putchar(i32 %38)
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 7
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = add nsw i32 %42, -32
%44 = call i32 @putchar(i32 %43)
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = add nsw i32 %47, -32
%49 = call i32 @putchar(i32 %48)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%51 = load i8, i8* %4
%52 = sext i8 %51 to i32
%53 = add nsw i32 %52, -32
%54 = call i32 @putchar(i32 %53)
%55 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 32
%58 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 1
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = add nsw i32 %60, -32
%62 = select i1 %57, i32 %61, i32 %60
%63 = call i32 @putchar(i32 %62)
%64 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 1
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 32
%67 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 2
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = add nsw i32 %69, -32
%71 = select i1 %66, i32 %70, i32 %69
%72 = call i32 @putchar(i32 %71)
%73 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 2
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 32
%76 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 3
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = add nsw i32 %78, -32
%80 = select i1 %75, i32 %79, i32 %78
%81 = call i32 @putchar(i32 %80)
%82 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 3
%83 = load i8, i8* %82
%84 = icmp eq i8 %83, 32
%85 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 4
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = add nsw i32 %87, -32
%89 = select i1 %84, i32 %88, i32 %87
%90 = call i32 @putchar(i32 %89)
%91 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 4
%92 = load i8, i8* %91
%93 = icmp eq i8 %92, 32
%94 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 5
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = add nsw i32 %96, -32
%98 = select i1 %93, i32 %97, i32 %96
%99 = call i32 @putchar(i32 %98)
%100 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 5
%101 = load i8, i8* %100
%102 = icmp eq i8 %101, 32
%103 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 6
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = add nsw i32 %105, -32
%107 = select i1 %102, i32 %106, i32 %105
%108 = call i32 @putchar(i32 %107)
%109 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 6
%110 = load i8, i8* %109
%111 = icmp eq i8 %110, 32
%112 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 7
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = add nsw i32 %114, -32
%116 = select i1 %111, i32 %115, i32 %114
%117 = call i32 @putchar(i32 %116)
%118 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 7
%119 = load i8, i8* %118
%120 = icmp eq i8 %119, 32
%121 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 8
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = add nsw i32 %123, -32
%125 = select i1 %120, i32 %124, i32 %123
%126 = call i32 @putchar(i32 %125)
%127 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 8
%128 = load i8, i8* %127
%129 = icmp eq i8 %128, 32
%130 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 9
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = add nsw i32 %132, -32
%134 = select i1 %129, i32 %133, i32 %132
%135 = call i32 @putchar(i32 %134)
ret i32 0
}