#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 *, unsigned int, int /*<<< orphan*/);
void argsrows(char *argv[]) {
  unsigned argc = 0;
  while (argv && *argv)
    printf("%3d. \"%s\"\n", ++argc, *argv++);
}


x86 assembly (clang, -O0):
<argsrows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1141 <argsrows+0x31>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1151 <argsrows+0x41>
jmp    117f <argsrows+0x6f>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%edx
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    1123 <argsrows+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argsrows>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1157 <argsrows+0x47>
mov    %rdi,%r14
mov    (%rdi),%rdx
test   %rdx,%rdx
je     1157 <argsrows+0x47>
mov    $0x1,%ebx
lea    0xecf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    (%r14,%rbx,8),%rdx
add    $0x1,%rbx
test   %rdx,%rdx
jne    1140 <argsrows+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%3d. \22%s\22\0A\00"
define void @argsrows(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i8**, i8*** %2
%6 = icmp ne i8** %5, null
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br label %11
11: ; preds = %7, %4
%12 = phi i1 [ false, %4 ], [ %10, %7 ]
br i1 %12, label %13, label %21
13: ; preds = %11
%14 = load i32, i32* %3
%15 = add i32 %14, 1
store i32 %15, i32* %3
%16 = load i8**, i8*** %2
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %2
%18 = load i8*, i8** %16
%19 = ptrtoint i8* %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %19)
br label %4
21: ; preds = %11
ret void
}

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