#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 prefix_print(char **prefix, int nr) {
  int i;
  for (i = 0; i < nr; i++) {
    if (!prefix[i])
      continue;
    printf("char %d (", i);
    if (i > 127)
      printf("not viewable");
    else
      printf("%c", i);
    printf("), prefix = \"%s\"\n", prefix[i]);
  }
}


x86 assembly (clang, -O0):
<prefix_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b1 <prefix_print+0xa1>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    114a <prefix_print+0x3a>
jmp    11a3 <prefix_print+0x93>
mov    -0x10(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x7f,-0x10(%rbp)
jle    1178 <prefix_print+0x68>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1189 <prefix_print+0x79>
mov    -0x10(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <prefix_print+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1198 <prefix_print+0x78>
mov    %rdi,%r13
mov    %esi,%ebp
lea    0xec5(%rip),%r14
lea    0xec8(%rip),%r15
lea    0xece(%rip),%r12
xor    %ebx,%ebx
jmp    116f <prefix_print+0x4f>
nopl   (%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    0x0(%r13,%rbx,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1198 <prefix_print+0x78>
cmpq   $0x0,0x0(%r13,%rbx,8)
je     1166 <prefix_print+0x46>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x80,%rbx
jb     1150 <prefix_print+0x30>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1157 <prefix_print+0x37>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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