#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*/ printf(char *, ...);
void showArray(unsigned int *array, unsigned long *ar, int size) {
  printf("\n\nSHOW ARRAY CHAR\n\n");
  for (int i = 0; i < size; i++) {
    if (array[i] != 0)
      printf("%d: %lu - %d\n", i, ar[i], array[i]);
  }
}


x86 assembly (clang, -O0):
<showArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1191 <showArray+0x81>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     117e <showArray+0x6e>
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1183 <showArray+0x73>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <showArray+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showArray>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    1173 <showArray+0x53>
mov    %ebx,%r13d
lea    0xeb5(%rip),%r15
xor    %ebx,%ebx
jmp    1159 <showArray+0x39>
nop
add    $0x1,%rbx
cmp    %rbx,%r13
je     1173 <showArray+0x53>
mov    (%r12,%rbx,4),%ecx
test   %ecx,%ecx
je     1150 <showArray+0x30>
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1150 <showArray+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0A\0ASHOW ARRAY CHAR\0A\0A\00"
@.str.1 = [14 x i8] c"%d: %lu - %d\0A\00"
define void @showArray(i32* %0, i64* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i64* %1, i64** %5
store i32 %2, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %9
9: ; preds = %34, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i32*, i32** %4
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %13
%21 = load i32, i32* %7
%22 = load i64*, i64** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %22, i64 %24
%26 = load i64, i64* %25
%27 = load i32*, i32** %4
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %21, i64 %26, i32 %31)
br label %33
33: ; preds = %20, %13
br label %34
34: ; preds = %33
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %9
37: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"%d: %lu - %d\0A\00"
@str = [19 x i8] c"\0A\0ASHOW ARRAY CHAR\0A\00"
define void @showArray(i32* nocapture %0, i64* nocapture %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = zext i32 %2 to i64
br label %9
8: ; preds = %19, %3
ret void
9: ; preds = %6, %19
%10 = phi i64 [ 0, %6 ], [ %20, %19 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %9
%15 = getelementptr inbounds i64, i64* %1, i64 %10
%16 = load i64, i64* %15
%17 = trunc i64 %10 to i32
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %17, i64 %16, i32 %12)
br label %19
19: ; preds = %9, %14
%20 = add nuw nsw i64 %10, 1
%21 = icmp eq i64 %20, %7
br i1 %21, label %8, label %9
}