#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 */
scalar_t__ __path_iterator(char *, char **, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char path[] = "/home/peter/path/world";
  char name[256] = {0};
  char *pos = path;
  while (__path_iterator(path, &pos, name)) {
    printf("%s\n", name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xe9d(%rip),%al
mov    %al,-0x1a(%rbp)
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1040 <memset@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x138(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x130(%rbp),%rdx
lea    -0x138(%rbp),%rsi
call   1050 <__path_iterator@plt>
cmp    $0x0,%rax
je     11d3 <main+0xa3>
lea    -0x130(%rbp),%rsi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
jmp    119a <main+0x6a>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x138,%rsp
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x646c726f772f68,%rax
mov    %rax,0x1f(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
lea    0x10(%rsp),%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rsi
lea    0x30(%rsp),%rdx
call   1040 <__path_iterator@plt>
test   %rax,%rax
je     121e <main+0xfe>
lea    0xe35(%rip),%r14
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <__path_iterator@plt>
test   %rax,%rax
jne    1200 <main+0xe0>
xor    %eax,%eax
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.path = [23 x i8] c"/home/peter/path/world\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [23 x i8]
%7 = alloca [256 x i8]
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [23 x i8]* %6 to i8*
%10 = bitcast [256 x i8]* %7 to i8*
%11 = getelementptr inbounds [23 x i8], [23 x i8]* %6, i64 0, i64 0
store i8* %11, i8** %8
br label %12
12: ; preds = %17, %2
%13 = getelementptr inbounds [23 x i8], [23 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%15 = call i64 @__path_iterator(i8* %13, i8** %8, i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %12
20: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@__const.main.path = [23 x i8] c"/home/peter/path/world\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [23 x i8]
%4 = alloca [256 x i8]
%5 = alloca i8*
%6 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = bitcast i8** %5 to i8*
store i8* %6, i8** %5
%9 = call i64 @__path_iterator(i8* %6, i8** %5, i8* %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2, %11
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%13 = call i64 @__path_iterator(i8* %6, i8** %5, i8* %7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %11
15: ; preds = %11, %2
ret i32 0
}