#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 */
void *calloc(int, int);
int /*<<< orphan*/ print_char_arr(char *, int);
int /*<<< orphan*/ print_int_arr(int *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ println(char *, char *);
int /*<<< orphan*/ str_lower(char *);
int /*<<< orphan*/ str_upper(char *);
int main(int argc, char *argv[]) {
  int length = 10;
  int *arr = calloc(length, sizeof(int));
  print_int_arr(arr, length);
  for (int i = 0; i < length; i++) {
    arr[i] = i * i;
  }
  print_int_arr(arr, length);
  char *arr_char = calloc(length, sizeof(char));
  print_char_arr(arr_char, length);
  for (int i = 0; i < length; i++) {
    arr_char[i] = (char)(i + 65);
  }
  print_char_arr(arr_char, length);
  printf("%s\n", arr_char);
  str_lower(arr_char);
  println("%s", arr_char);
  str_upper(arr_char);
  println("%s", arr_char);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1090 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <print_int_arr@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11dd <main+0x6d>
mov    -0x24(%rbp),%edx
imul   -0x24(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11b1 <main+0x41>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <print_int_arr@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <print_char_arr@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123a <main+0xca>
mov    -0x34(%rbp),%eax
add    $0x41,%eax
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120d <main+0x9d>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <print_char_arr@plt>
mov    -0x30(%rbp),%rsi
lea    0xdaf(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1080 <str_lower@plt>
mov    -0x30(%rbp),%rsi
lea    0xd9a(%rip),%rdi
call   1060 <println@plt>
mov    -0x30(%rbp),%rdi
call   1030 <str_upper@plt>
mov    -0x30(%rbp),%rsi
lea    0xd81(%rip),%rdi
call   1060 <println@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xa,%edi
mov    $0x4,%esi
call   1090 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1040 <print_int_arr@plt>
movaps 0xe66(%rip),%xmm0
movups %xmm0,(%rbx)
movaps 0xe6c(%rip),%xmm0
movups %xmm0,0x10(%rbx)
movabs $0x5100000040,%rax
mov    %rax,0x20(%rbx)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print_int_arr@plt>
mov    $0xa,%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1070 <print_char_arr@plt>
movabs $0x4847464544434241,%rax
46 47 48
mov    %rax,(%rbx)
movw   $0x4a49,0x8(%rbx)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <print_char_arr@plt>
lea    0xe17(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1080 <str_lower@plt>
lea    0xe04(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <println@plt>
mov    %rbx,%rdi
call   1030 <str_upper@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <println@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
%11 = load i32, i32* %6
%12 = call i8* @calloc(i32 %11, i32 4)
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %7
%14 = load i32*, i32** %7
%15 = load i32, i32* %6
%16 = call i32 @print_int_arr(i32* %14, i32 %15)
store i32 0, i32* %8
br label %17
17: ; preds = %29, %2
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = load i32, i32* %8
%23 = load i32, i32* %8
%24 = mul nsw i32 %22, %23
%25 = load i32*, i32** %7
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 %24, i32* %28
br label %29
29: ; preds = %21
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %17
32: ; preds = %17
%33 = load i32*, i32** %7
%34 = load i32, i32* %6
%35 = call i32 @print_int_arr(i32* %33, i32 %34)
%36 = load i32, i32* %6
%37 = call i8* @calloc(i32 %36, i32 1)
store i8* %37, i8** %9
%38 = load i8*, i8** %9
%39 = load i32, i32* %6
%40 = call i32 @print_char_arr(i8* %38, i32 %39)
store i32 0, i32* %10
br label %41
41: ; preds = %53, %32
%42 = load i32, i32* %10
%43 = load i32, i32* %6
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %56
45: ; preds = %41
%46 = load i32, i32* %10
%47 = add nsw i32 %46, 65
%48 = trunc i32 %47 to i8
%49 = load i8*, i8** %9
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
store i8 %48, i8* %52
br label %53
53: ; preds = %45
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
store i32 %55, i32* %10
br label %41
56: ; preds = %41
%57 = load i8*, i8** %9
%58 = load i32, i32* %6
%59 = call i32 @print_char_arr(i8* %57, i32 %58)
%60 = load i8*, i8** %9
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %60)
%62 = load i8*, i8** %9
%63 = call i32 @str_lower(i8* %62)
%64 = load i8*, i8** %9
%65 = call i32 @println(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %64)
%66 = load i8*, i8** %9
%67 = call i32 @str_upper(i8* %66)
%68 = load i8*, i8** %9
%69 = call i32 @println(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(40) i8* @calloc(i32 10, i32 4)
%4 = bitcast i8* %3 to i32*
%5 = tail call i32 @print_int_arr(i32* %4, i32 10)
%6 = bitcast i8* %3 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 4, i32 9>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %4, i64 4
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 16, i32 25, i32 36, i32 49>, <4 x i32>* %8
%9 = getelementptr inbounds i32, i32* %4, i64 8
store i32 64, i32* %9
%10 = getelementptr inbounds i32, i32* %4, i64 9
store i32 81, i32* %10
%11 = tail call i32 @print_int_arr(i32* %4, i32 10)
%12 = tail call dereferenceable_or_null(10) i8* @calloc(i32 10, i32 1)
%13 = tail call i32 @print_char_arr(i8* %12, i32 10)
store i8 65, i8* %12
%14 = getelementptr inbounds i8, i8* %12, i64 1
store i8 66, i8* %14
%15 = getelementptr inbounds i8, i8* %12, i64 2
store i8 67, i8* %15
%16 = getelementptr inbounds i8, i8* %12, i64 3
store i8 68, i8* %16
%17 = getelementptr inbounds i8, i8* %12, i64 4
store i8 69, i8* %17
%18 = getelementptr inbounds i8, i8* %12, i64 5
store i8 70, i8* %18
%19 = getelementptr inbounds i8, i8* %12, i64 6
store i8 71, i8* %19
%20 = getelementptr inbounds i8, i8* %12, i64 7
store i8 72, i8* %20
%21 = getelementptr inbounds i8, i8* %12, i64 8
store i8 73, i8* %21
%22 = getelementptr inbounds i8, i8* %12, i64 9
store i8 74, i8* %22
%23 = tail call i32 @print_char_arr(i8* %12, i32 10)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%25 = tail call i32 @str_lower(i8* %12)
%26 = tail call i32 @println(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%27 = tail call i32 @str_upper(i8* %12)
%28 = tail call i32 @println(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret i32 0
}