#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ jnx_file_recursive_delete(char *, int);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ system(char *);
void test_recursive_delete() {
  system("mkdir -p bob/james/frank");
  system("touch bob/a.txt");
  system("touch bob/james/b.txt");
  system("touch bob/james/frank/c.txt");
  system("touch bob/james/frank/d.txt");
  system("touch bob/james/e.txt");
  system("touch bob/f.txt");
  system("touch bob/g.txt");
  jnx_file_recursive_delete("bob", 3);
  struct stat _sb;
  assert(stat("bob", &_sb) != 0);
}


x86 assembly (clang, -O0):
<test_recursive_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <system@plt>
lea    0xebe(%rip),%rdi
call   1040 <system@plt>
lea    0xec2(%rip),%rdi
call   1040 <system@plt>
lea    0xecc(%rip),%rdi
call   1040 <system@plt>
lea    0xedc(%rip),%rdi
call   1040 <system@plt>
lea    0xeec(%rip),%rdi
call   1040 <system@plt>
lea    0xef6(%rip),%rdi
call   1040 <system@plt>
lea    0xefa(%rip),%rdi
call   1040 <system@plt>
lea    0xefe(%rip),%rdi
mov    $0x3,%esi
call   1030 <jnx_file_recursive_delete@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <stat@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_recursive_delete>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <system@plt>
lea    0xec1(%rip),%rdi
call   1040 <system@plt>
lea    0xec5(%rip),%rdi
call   1040 <system@plt>
lea    0xecf(%rip),%rdi
call   1040 <system@plt>
lea    0xedf(%rip),%rdi
call   1040 <system@plt>
lea    0xeef(%rip),%rdi
call   1040 <system@plt>
lea    0xef9(%rip),%rdi
call   1040 <system@plt>
lea    0xefd(%rip),%rdi
call   1040 <system@plt>
lea    0xf01(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <jnx_file_recursive_delete@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <stat@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [25 x i8] c"mkdir -p bob/james/frank\00"
@.str.1 = [16 x i8] c"touch bob/a.txt\00"
@.str.2 = [22 x i8] c"touch bob/james/b.txt\00"
@.str.3 = [28 x i8] c"touch bob/james/frank/c.txt\00"
@.str.4 = [28 x i8] c"touch bob/james/frank/d.txt\00"
@.str.5 = [22 x i8] c"touch bob/james/e.txt\00"
@.str.6 = [16 x i8] c"touch bob/f.txt\00"
@.str.7 = [16 x i8] c"touch bob/g.txt\00"
@.str.8 = [4 x i8] c"bob\00"
define void @test_recursive_delete() {
%1 = alloca %struct.stat
%2 = call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 @jnx_file_recursive_delete(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 3)
%11 = call i64 @stat(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %struct.stat* %1)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [25 x i8] c"mkdir -p bob/james/frank\00"
@.str.1 = [16 x i8] c"touch bob/a.txt\00"
@.str.2 = [22 x i8] c"touch bob/james/b.txt\00"
@.str.3 = [28 x i8] c"touch bob/james/frank/c.txt\00"
@.str.4 = [28 x i8] c"touch bob/james/frank/d.txt\00"
@.str.5 = [22 x i8] c"touch bob/james/e.txt\00"
@.str.6 = [16 x i8] c"touch bob/f.txt\00"
@.str.7 = [16 x i8] c"touch bob/g.txt\00"
@.str.8 = [4 x i8] c"bob\00"
define void @test_recursive_delete() {
%1 = alloca %struct.stat
%2 = tail call i32 @system(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%9 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%10 = tail call i32 @jnx_file_recursive_delete(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 3)
%11 = bitcast %struct.stat* %1 to i8*
%12 = call i64 @stat(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), %struct.stat* %1)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
ret void
}