#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__ AURAE_Script_Read_Ext(char *, char *, int, char);
int /*<<< orphan*/ strcat(char *, char *);
void AURAE_Folder_Out(char *filename, char *folder) {
  int i = 0;
  char string[100];
  folder[0] = 0;
  while (AURAE_Script_Read_Ext(filename, string, i, '/') != 0) {
    if (AURAE_Script_Read_Ext(filename, NULL, i + 1, '/') != 0) {
      strcat(folder, string);
      strcat(folder, "/");
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<AURAE_Folder_Out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x2f,%ecx
call   1030 <AURAE_Script_Read_Ext@plt>
cmp    $0x0,%rax
je     11ad <AURAE_Folder_Out+0x8d>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2f,%ecx
call   1030 <AURAE_Script_Read_Ext@plt>
cmp    $0x0,%rax
je     119f <AURAE_Folder_Out+0x7f>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <AURAE_Folder_Out+0x21>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AURAE_Folder_Out>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movb   $0x0,(%rsi)
mov    %rsp,%rsi
xor    %edx,%edx
mov    $0x2f,%ecx
call   1030 <AURAE_Script_Read_Ext@plt>
test   %rax,%rax
je     11a8 <AURAE_Folder_Out+0x88>
mov    $0x1,%ebp
mov    %rsp,%r15
lea    0xea8(%rip),%r12
jmp    117a <AURAE_Folder_Out+0x5a>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    $0x2f,%ecx
call   1030 <AURAE_Script_Read_Ext@plt>
add    $0x1,%ebp
test   %rax,%rax
je     11a8 <AURAE_Folder_Out+0x88>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x2f,%ecx
call   1030 <AURAE_Script_Read_Ext@plt>
test   %rax,%rax
je     1160 <AURAE_Folder_Out+0x40>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strcat@plt>
jmp    1160 <AURAE_Folder_Out+0x40>
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define void @AURAE_Folder_Out(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
store i8 0, i8* %1
%5 = call i64 @AURAE_Script_Read_Ext(i8* %0, i8* %4, i32 0, i8 signext 47)
%6 = icmp eq i64 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %2, %15
%8 = phi i32 [ %9, %15 ], [ 0, %2 ]
%9 = add nuw nsw i32 %8, 1
%10 = call i64 @AURAE_Script_Read_Ext(i8* %0, i8* null, i32 %9, i8 signext 47)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = call i32 @strcat(i8* %1, i8* %4)
%14 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %12, %7
%16 = call i64 @AURAE_Script_Read_Ext(i8* %0, i8* %4, i32 %9, i8 signext 47)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %15, %2
ret void
}