#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*/ append(char *, char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void make_upper(char word[80]) {
  int i;
  int length_word = strlen(word);
  char res[80] = {0};
  strcpy(res, "");
  for (i = 0; i < length_word; i++) {
    char letter = word[i];
    int c, k;
    int n = (int)letter;
    if (letter == '\0') {
      break;
    }
    if ((n >> 5) & 1) {
      n ^= (1u << 5);
    }
    char n_string = n;
    append(res, n_string);
  }
  printf("%s\n", res);
}


x86 assembly (clang, -O0):
<make_upper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1070 <memset@plt>
lea    -0x60(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1201 <make_upper+0xb1>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x61(%rbp)
movsbl -0x61(%rbp),%eax
mov    %eax,-0x70(%rbp)
movsbl -0x61(%rbp),%eax
cmp    $0x0,%eax
jne    11c5 <make_upper+0x75>
jmp    1201 <make_upper+0xb1>
mov    -0x70(%rbp),%eax
sar    $0x5,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11e0 <make_upper+0x90>
mov    -0x70(%rbp),%eax
xor    $0x20,%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    %al,-0x71(%rbp)
lea    -0x60(%rbp),%rdi
movsbl -0x71(%rbp),%esi
call   1030 <append@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1192 <make_upper+0x42>
lea    -0x60(%rbp),%rsi
lea    0xdf4(%rip),%rdi
call   1060 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_upper>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%r15
call   1050 <strlen@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe8d(%rip),%rsi
mov    %rsp,%rdi
call   1040 <strcpy@plt>
test   %ebp,%ebp
jle    11af <make_upper+0x6f>
mov    %ebp,%ebp
xor    %ebx,%ebx
mov    %rsp,%r14
nopl   0x0(%rax)
movzbl (%r15,%rbx,1),%eax
test   %al,%al
je     11af <make_upper+0x6f>
and    $0xdf,%al
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <append@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <make_upper+0x50>
lea    0xe4a(%rip),%rdi
mov    %rsp,%rsi
call   1060 <printf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%s\0A\00"
define void @make_upper(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [80 x i8]
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i8* %0, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %4
%13 = bitcast [80 x i8]* %5 to i8*
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %16
16: ; preds = %46, %1
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %49
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
store i8 %25, i8* %6
%26 = load i8, i8* %6
%27 = sext i8 %26 to i32
store i32 %27, i32* %9
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %20
br label %49
32: ; preds = %20
%33 = load i32, i32* %9
%34 = ashr i32 %33, 5
%35 = and i32 %34, 1
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load i32, i32* %9
%39 = xor i32 %38, 32
store i32 %39, i32* %9
br label %40
40: ; preds = %37, %32
%41 = load i32, i32* %9
%42 = trunc i32 %41 to i8
store i8 %42, i8* %10
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%44 = load i8, i8* %10
%45 = call i32 @append(i8* %43, i8 signext %44)
br label %46
46: ; preds = %40
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %16
49: ; preds = %31, %16
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %50)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%s\0A\00"
define void @make_upper(i8* %0) {
%2 = alloca [80 x i8]
%3 = tail call i32 @strlen(i8* %0)
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %19
7: ; preds = %1
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %14
%10 = phi i64 [ 0, %7 ], [ %17, %14 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = and i8 %12, -33
%16 = call i32 @append(i8* %4, i8 signext %15)
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %19, label %9
19: ; preds = %14, %9, %1
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}