#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_char_array(char array_c[]) {
  int index;
  printf("array_c :\n");
  printf("=========\n\n");
  for (index = 0; index < 120; index++) {
    printf("%1c", array_c[index]);
    if ((index % 50) == 0)
      printf("\n");
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<print_char_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x78,-0xc(%rbp)
jge    1198 <print_char_array+0x88>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1185 <print_char_array+0x75>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118a <print_char_array+0x7a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <print_char_array+0x2f>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char_array>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%r14
xor    %r12d,%r12d
xor    %ebx,%ebx
jmp    117e <print_char_array+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0xff,%r12b
cmp    $0x78,%rbx
je     11b0 <print_char_array+0x80>
movzbl %bl,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%eax
movzwl %ax,%eax
shr    $0xb,%eax
imul   $0x32,%eax,%ebp
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    %r12b,%bpl
jne    1170 <print_char_array+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <print_char_array+0x40>
lea    0xe60(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"array_c :\0A\00"
@.str.1 = [12 x i8] c"=========\0A\0A\00"
@.str.2 = [4 x i8] c"%1c\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
define void @print_char_array(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %23, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 120
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %3
%18 = srem i32 %17, 50
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %9
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %9
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %6
26: ; preds = %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

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