int main() {
  int arraySize;
  char *inputArray;
  int *freqMap;
  printf("Please enter size of array ( 0 or less to quit): ");
  scanf("%d", &arraySize);
  while (arraySize > 0) {
    inputArray = get_input_array(arraySize);
    freqMap = get_frequency_map(inputArray, arraySize);
    output_single_characters(freqMap);
    free(freqMap);
    free(inputArray);
    printf("Please enter size of array ( 0 or less to quit): ");
    scanf("%d", &arraySize);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11ff <main+0x9f>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1080 <get_input_array@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1060 <get_frequency_map@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <output_single_characters@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe43(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
jmp    118f <main+0x2f>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    1204 <main+0xa4>
lea    0xe63(%rip),%r14
lea    0xe8e(%rip),%r15
lea    0xc(%rsp),%r12
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <get_input_array@plt>
movslq %eax,%r13
mov    0xc(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <get_frequency_map@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <output_single_characters@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jg     11b0 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Please enter size of array ( 0 or less to quit): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %10, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call i32 (i32, ...) bitcast (i32 (...)* @get_input_array to i32 (i32, ...)*)(i32 %11)
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = load i32, i32* %2
%17 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @get_frequency_map to i32 (i8*, i32, ...)*)(i8* %15, i32 %16)
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store i32* %19, i32** %4
%20 = load i32*, i32** %4
%21 = call i32 (i32*, ...) bitcast (i32 (...)* @output_single_characters to i32 (i32*, ...)*)(i32* %20)
%22 = load i32*, i32** %4
%23 = bitcast i32* %22 to i8*
%24 = load i8*, i8** %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %7
27: ; preds = %7
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [50 x i8] c"Please enter size of array ( 0 or less to quit): \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %22
7: ; preds = %0, %7
%8 = phi i32 [ %20, %7 ], [ %5, %0 ]
%9 = call i32 (i32, ...) bitcast (i32 (...)* @get_input_array to i32 (i32, ...)*)(i32 %8)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = load i32, i32* %1
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @get_frequency_map to i32 (i8*, i32, ...)*)(i8* %11, i32 %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = call i32 (i32*, ...) bitcast (i32 (...)* @output_single_characters to i32 (i32*, ...)*)(i32* %15)
%17 = inttoptr i64 %14 to i8*
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 0
br i1 %21, label %7, label %22
22: ; preds = %7, %0
ret i32 0
}