#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
scalar_t__ isalnum(char);
scalar_t__ isalpha(char);
scalar_t__ isupper(char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
char tolower(char);
char toupper(char);
void main(void) {
  char name[100];
  char daStr[80] = "";
  int i;
  printf("Bienvenido Usuario. Para empezar porfavor introdusca su nombre\n>>");
  fgets(name, 100, stdin);
  puts("Este programa lee y evalua todos los caracteres de una cadena de hasta "
       "80 caracteres");
  puts("Al terminar de evaluar la cadena se imprimira en pantalla todas las "
       "letras mayusculas en minusculas y vice-versa");
  printf("%s, Porfavor introduce una cadena para ser evaluada \n>>", name);
  fgets(daStr, 80, stdin);
  for (i = 0; i < strlen(daStr); i++) {
    if (isalnum(daStr[i]) != 0) {
      if (isalpha(daStr[i]) != 0) {
        if (isupper(daStr[i]) != 0) {
          daStr[i] = tolower(daStr[i]);
        } else {
          daStr[i] = toupper(daStr[i]);
        }
      } else {
      }
    } else {
    }
  }
  puts("Acontinuacion se Desplegara la Cadena Resultante:\n [Press any Key to "
       "Continue]\n");
  getchar();
  puts(daStr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1080 <memset@plt>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e01(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1090 <fgets@plt>
lea    0xe48(%rip),%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rsi
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xc0(%rbp),%rdi
mov    0x2dbd(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1090 <fgets@plt>
movl   $0x0,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
mov    %eax,-0xc8(%rbp)
lea    -0xc0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0xc8(%rbp),%eax
cmp    %ecx,%eax
jge    133d <main+0x18d>
movslq -0xc4(%rbp),%rax
movsbl -0xc0(%rbp,%rax,1),%edi
ff
call   1070 <isalnum@plt>
cmp    $0x0,%rax
je     131f <main+0x16f>
movslq -0xc4(%rbp),%rax
movsbl -0xc0(%rbp,%rax,1),%edi
ff
call   10c0 <isalpha@plt>
cmp    $0x0,%rax
je     1315 <main+0x165>
movslq -0xc4(%rbp),%rax
movsbl -0xc0(%rbp,%rax,1),%edi
ff
call   10d0 <isupper@plt>
cmp    $0x0,%rax
je     12ec <main+0x13c>
movslq -0xc4(%rbp),%rax
movsbl -0xc0(%rbp,%rax,1),%edi
ff
call   10b0 <tolower@plt>
mov    %al,%cl
movslq -0xc4(%rbp),%rax
mov    %cl,-0xc0(%rbp,%rax,1)
jmp    1310 <main+0x160>
movslq -0xc4(%rbp),%rax
movsbl -0xc0(%rbp,%rax,1),%edi
ff
call   1030 <toupper@plt>
mov    %al,%cl
movslq -0xc4(%rbp),%rax
mov    %cl,-0xc0(%rbp,%rax,1)
jmp    131a <main+0x16a>
jmp    131a <main+0x16a>
jmp    1324 <main+0x174>
jmp    1324 <main+0x174>
jmp    1329 <main+0x179>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1241 <main+0x91>
lea    0xdfc(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
lea    -0xc0(%rbp),%rdi
call   1040 <puts@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xb8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2e0e(%rip),%r14
mov    (%r14),%edx
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1080 <fgets@plt>
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe95(%rip),%rdi
call   1040 <puts@plt>
lea    0xefa(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%r14),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1080 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1290 <main+0xf0>
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    125b <main+0xbb>
xchg   %ax,%ax
call   10a0 <tolower@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    1290 <main+0xf0>
movsbl (%rsp,%rbx,1),%edi
call   1070 <isalnum@plt>
test   %rax,%rax
je     1248 <main+0xa8>
movsbl (%rsp,%rbx,1),%edi
call   10b0 <isalpha@plt>
test   %rax,%rax
je     1248 <main+0xa8>
movsbl (%rsp,%rbx,1),%edi
call   10c0 <isupper@plt>
movsbl (%rsp,%rbx,1),%edi
test   %rax,%rax
jne    1240 <main+0xa0>
call   1030 <toupper@plt>
jmp    1245 <main+0xa5>
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
mov    %rsp,%rdi
call   1040 <puts@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [66 x i8] c"Bienvenido Usuario. Para empezar porfavor introdusca su nombre\0A>>\00"
@stdin = global i32 0
@.str.1 = [85 x i8] c"Este programa lee y evalua todos los caracteres de una cadena de hasta 80 caracteres\00"
@.str.2 = [113 x i8] c"Al terminar de evaluar la cadena se imprimira en pantalla todas las letras mayusculas en minusculas y vice-versa\00"
@.str.3 = [56 x i8] c"%s, Porfavor introduce una cadena para ser evaluada \0A>>\00"
@.str.4 = [80 x i8] c"Acontinuacion se Desplegara la Cadena Resultante:\0A [Press any Key to Continue]\0A\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = bitcast [80 x i8]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 100, i32 %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 80, i32 %14)
store i32 0, i32* %3
br label %16
16: ; preds = %65, %0
%17 = load i32, i32* %3
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %68
21: ; preds = %16
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = call i64 @isalnum(i8 signext %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %63
28: ; preds = %21
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = call i64 @isalpha(i8 signext %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %61
35: ; preds = %28
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = call i64 @isupper(i8 signext %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %51
42: ; preds = %35
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = call signext i8 @tolower(i8 signext %46)
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %49
store i8 %47, i8* %50
br label %60
51: ; preds = %35
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = call signext i8 @toupper(i8 signext %55)
%57 = load i32, i32* %3
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %58
store i8 %56, i8* %59
br label %60
60: ; preds = %51, %42
br label %62
61: ; preds = %28
br label %62
62: ; preds = %61, %60
br label %64
63: ; preds = %21
br label %64
64: ; preds = %63, %62
br label %65
65: ; preds = %64
%66 = load i32, i32* %3
%67 = add nsw i32 %66, 1
store i32 %67, i32* %3
br label %16
68: ; preds = %16
%69 = call i32 @puts(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.4, i64 0, i64 0))
%70 = call i32 (...) @getchar()
%71 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%72 = call i32 @puts(i8* %71)
ret void
}

LLVM IR (-O2):
@.str = [66 x i8] c"Bienvenido Usuario. Para empezar porfavor introdusca su nombre\0A>>\00"
@stdin = global i32 0
@.str.1 = [85 x i8] c"Este programa lee y evalua todos los caracteres de una cadena de hasta 80 caracteres\00"
@.str.2 = [113 x i8] c"Al terminar de evaluar la cadena se imprimira en pantalla todas las letras mayusculas en minusculas y vice-versa\00"
@.str.3 = [56 x i8] c"%s, Porfavor introduce una cadena para ser evaluada \0A>>\00"
@.str.4 = [80 x i8] c"Acontinuacion se Desplegara la Cadena Resultante:\0A [Press any Key to Continue]\0A\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %3, i32 100, i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %4, i32 80, i32 %11)
%13 = call i32 @strlen(i8* %4)
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %41
15: ; preds = %0, %36
%16 = phi i64 [ %37, %36 ], [ 0, %0 ]
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = call i64 @isalnum(i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %36, label %21
21: ; preds = %15
%22 = load i8, i8* %17
%23 = call i64 @isalpha(i8 signext %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %36, label %25
25: ; preds = %21
%26 = load i8, i8* %17
%27 = call i64 @isupper(i8 signext %26)
%28 = icmp eq i64 %27, 0
%29 = load i8, i8* %17
br i1 %28, label %32, label %30
30: ; preds = %25
%31 = call signext i8 @tolower(i8 signext %29)
br label %34
32: ; preds = %25
%33 = call signext i8 @toupper(i8 signext %29)
br label %34
34: ; preds = %32, %30
%35 = phi i8 [ %31, %30 ], [ %33, %32 ]
store i8 %35, i8* %17
br label %36
36: ; preds = %34, %21, %15
%37 = add nuw nsw i64 %16, 1
%38 = call i32 @strlen(i8* %4)
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %15, label %41
41: ; preds = %36, %0
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.4, i64 0, i64 0))
%43 = call i32 (...) @getchar()
%44 = call i32 @puts(i8* %4)
ret void
}