#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 ft_printf_array(char **arr) {
  int i;
  int j;
  i = 0;
  j = 0;
  while (arr[i] != 0) {
    while (arr[i][j] != '\0') {
      printf("%c", arr[i][j]);
      j++;
    }
    printf("\n");
    j = 0;
    i++;
  }
}


x86 assembly (clang, -O0):
<ft_printf_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11b2 <ft_printf_array+0xa2>
jmp    1142 <ft_printf_array+0x32>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     118f <ft_printf_array+0x7f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <ft_printf_array+0x32>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <ft_printf_array+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_printf_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    (%rdi),%rax
test   %rax,%rax
je     117a <ft_printf_array+0x6a>
mov    %rdi,%r14
xor    %r15d,%r15d
mov    %rdi,%r12
jmp    1150 <ft_printf_array+0x40>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    (%r14,%r15,8),%r12
add    $0x8,%r12
mov    0x8(%r14,%r15,8),%rax
add    $0x1,%r15
test   %rax,%rax
je     117a <ft_printf_array+0x6a>
mov    (%rax),%al
test   %al,%al
je     1130 <ft_printf_array+0x20>
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    (%r12),%rax
movzbl (%rax,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <ft_printf_array+0x50>
jmp    1130 <ft_printf_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_printf_array(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %26, label %4
4: ; preds = %1, %20
%5 = phi i8* [ %24, %20 ], [ %2, %1 ]
%6 = phi i64 [ %22, %20 ], [ 0, %1 ]
%7 = phi i8** [ %23, %20 ], [ %0, %1 ]
%8 = load i8, i8* %5
%9 = icmp eq i8 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %4, %10
%11 = phi i64 [ %15, %10 ], [ 0, %4 ]
%12 = phi i8 [ %18, %10 ], [ %8, %4 ]
%13 = sext i8 %12 to i32
%14 = tail call i32 @putchar(i32 %13)
%15 = add nuw i64 %11, 1
%16 = load i8*, i8** %7
%17 = getelementptr inbounds i8, i8* %16, i64 %15
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %10
20: ; preds = %10, %4
%21 = tail call i32 @putchar(i32 10)
%22 = add nuw i64 %6, 1
%23 = getelementptr inbounds i8*, i8** %0, i64 %22
%24 = load i8*, i8** %23
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %4
26: ; preds = %20, %1
ret void
}