#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*/ write(int, char *, int);
void print2DArray(char **array) {
  char **tokens = array;
  int i = 0;
  int count = 0;
  while (*tokens != 0) {
    while (*(*tokens + i) != 0) {
      count++;
      i++;
    }
    i = 0;
    write(1, *tokens, count);
    write(1, "\n", 1);
    count = 0;
    tokens++;
  }
}


x86 assembly (clang, -O0):
<print2DArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ba <print2DArray+0xaa>
jmp    1145 <print2DArray+0x35>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1174 <print2DArray+0x64>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <print2DArray+0x35>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xe65(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1132 <print2DArray+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print2DArray>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rsi
test   %rsi,%rsi
je     117d <print2DArray+0x6d>
mov    %rdi,%rbx
lea    0xeda(%rip),%r14
jmp    1159 <print2DArray+0x49>
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    0x8(%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
je     117d <print2DArray+0x6d>
cmpb   $0x0,(%rsi)
mov    $0x0,%edx
je     1130 <print2DArray+0x20>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x0,0x1(%rsi,%rdx,1)
lea    0x1(%rdx),%rdx
jne    1170 <print2DArray+0x60>
jmp    1130 <print2DArray+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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