int cmd_world(char *arg_list[], int n) {
  unsigned int i;
  sw_puts("world\n\r");
  for (i = 0; arg_list[i] != ((void *)0); i++) {
    sw_printf("arg_list[%u]: %s\n\r", i, arg_list[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmd_world>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <sw_puts@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1180 <cmd_world+0x60>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,8),%rdx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <sw_printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <cmd_world+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_world>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <sw_puts@plt>
mov    (%r15),%rdx
test   %rdx,%rdx
je     1168 <cmd_world+0x48>
lea    0xec3(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <sw_printf@plt>
add    $0x1,%ebx
mov    (%r15,%rbx,8),%rdx
test   %rdx,%rdx
jne    1150 <cmd_world+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"world\0A\0D\00"
@.str.1 = [19 x i8] c"arg_list[%u]: %s\0A\0D\00"
define i32 @cmd_world(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @sw_puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %22, %2
%8 = load i8**, i8*** %3
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8*, i8** %8, i64 %10
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %25
14: ; preds = %7
%15 = load i32, i32* %5
%16 = load i8**, i8*** %3
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @sw_printf to i32 (i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %20)
br label %22
22: ; preds = %14
%23 = load i32, i32* %5
%24 = add i32 %23, 1
store i32 %24, i32* %5
br label %7
25: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"world\0A\0D\00"
@.str.1 = [19 x i8] c"arg_list[%u]: %s\0A\0D\00"
define i32 @cmd_world(i8** nocapture %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @sw_puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %15, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %13, %6 ], [ %4, %2 ]
%8 = phi i32 [ %10, %6 ], [ 0, %2 ]
%9 = tail call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @sw_printf to i32 (i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %7)
%10 = add i32 %8, 1
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %0, i64 %11
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret i32 0
}