#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 print_array(char *array) {
  int i;
  for (i = 0; i < 256; i++) {
    if (i % 32 == 0 && i != 0) {
      printf("\n");
    }
    if (i != 256 - 1) {
      printf("%d,", array[i]);
    } else {
      printf("%d\n", array[i]);
    }
  }
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    11b5 <print_array+0xa5>
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115c <print_array+0x4c>
cmpl   $0x0,-0xc(%rbp)
je     115c <print_array+0x4c>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xff,-0xc(%rbp)
je     1188 <print_array+0x78>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a2 <print_array+0x92>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a7 <print_array+0x97>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_array+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%r14
xor    %ebx,%ebx
test   %rbx,%rbx
je     1154 <print_array+0x34>
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%eax
and    $0x1f,%eax
test   %rax,%rax
jne    1154 <print_array+0x34>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0xff,%rbx
je     1177 <print_array+0x57>
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
test   %rbx,%rbx
jne    1140 <print_array+0x20>
jmp    1154 <print_array+0x34>
movsbl 0xff(%r15),%esi
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

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

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