#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 show(int arr[], int size, int shift) {
  int empty = 1;
  for (int i = 0; i < size; i++) {
    if (arr[i] != 0) {
      empty = 0;
      printf("%c: %d\n", i + shift, arr[i]);
    }
  }
  if (empty) {
    printf("none\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1187 <show+0x77>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1174 <show+0x64>
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%esi
add    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1179 <show+0x69>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1130 <show+0x20>
cmpl   $0x0,-0x14(%rbp)
je     119f <show+0x8f>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1187 <show+0x57>
mov    %rdi,%r15
mov    %esi,%r13d
mov    %edx,%r12d
mov    $0x1,%ebp
xor    %ebx,%ebx
lea    0xeaa(%rip),%r14
jmp    1169 <show+0x39>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1183 <show+0x53>
mov    (%r15,%rbx,4),%edx
test   %edx,%edx
je     1160 <show+0x30>
lea    (%r12,%rbx,1),%esi
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1160 <show+0x30>
test   %ebp,%ebp
je     1193 <show+0x63>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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