#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*/ q_internal(char *, char *, int);
char *s_cat2(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ s_internal(char *, char *, char *, int);
int system(char *);
int delete_directory(char *pathspec, int recursive) {
  char *cmd;
  int ret;
  if (recursive) {
    cmd =
        s_cat2((q_internal("rm -rf ",
                           "/scratch/repos/new/home/jordi_armengol_estape/"
                           "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                           "fukamachi/roswell/refs/heads/master/src/util_dir.c",
                           146)),
               (q_internal(pathspec,
                           "/scratch/repos/new/home/jordi_armengol_estape/"
                           "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                           "fukamachi/roswell/refs/heads/master/src/util_dir.c",
                           146)));
  } else {
    cmd =
        s_cat2((q_internal("rmdir ",
                           "/scratch/repos/new/home/jordi_armengol_estape/"
                           "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                           "fukamachi/roswell/refs/heads/master/src/util_dir.c",
                           148)),
               (q_internal(pathspec,
                           "/scratch/repos/new/home/jordi_armengol_estape/"
                           "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                           "fukamachi/roswell/refs/heads/master/src/util_dir.c",
                           148)));
  }
  ret = system(cmd);
  (s_internal(cmd, "cmd",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/"
              "src/util_dir.c",
              151));
  return ret == 0;
}


x86 assembly (clang, -O0):
<delete_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     119c <delete_directory+0x5c>
lea    0xea0(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x92,%edx
call   1060 <q_internal@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x92,%edx
call   1060 <q_internal@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1050 <s_cat2@plt>
mov    %rax,-0x18(%rbp)
jmp    11da <delete_directory+0x9a>
lea    0xef2(%rip),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x94,%edx
call   1060 <q_internal@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe46(%rip),%rsi
mov    $0x94,%edx
call   1060 <q_internal@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   1050 <s_cat2@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeab(%rip),%rsi
lea    0xe10(%rip),%rdx
mov    $0x97,%ecx
call   1030 <s_internal@plt>
cmpl   $0x0,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_directory>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %esi,%esi
je     1168 <delete_directory+0x28>
lea    0xeab(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x92,%ebp
mov    $0x92,%edx
jmp    1180 <delete_directory+0x40>
lea    0xf26(%rip),%rdi
lea    0xe92(%rip),%rsi
mov    $0x94,%ebp
mov    $0x94,%edx
call   1060 <q_internal@plt>
mov    %eax,%ebx
lea    0xe7a(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1060 <q_internal@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <s_cat2@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <system@plt>
mov    %eax,%ebp
lea    0xee4(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    $0x97,%ecx
call   1030 <s_internal@plt>
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"rm -rf \00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/src/util_dir.c\00"
@.str.2 = [7 x i8] c"rmdir \00"
@.str.3 = [4 x i8] c"cmd\00"
define i32 @delete_directory(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = call i32 @q_internal(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 146)
%11 = load i8*, i8** %3
%12 = call i32 @q_internal(i8* %11, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 146)
%13 = call i8* @s_cat2(i32 %10, i32 %12)
store i8* %13, i8** %5
br label %19
14: ; preds = %2
%15 = call i32 @q_internal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 148)
%16 = load i8*, i8** %3
%17 = call i32 @q_internal(i8* %16, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 148)
%18 = call i8* @s_cat2(i32 %15, i32 %17)
store i8* %18, i8** %5
br label %19
19: ; preds = %14, %9
%20 = load i8*, i8** %5
%21 = call i32 @system(i8* %20)
store i32 %21, i32* %6
%22 = load i8*, i8** %5
%23 = call i32 @s_internal(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 151)
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
@.str = [8 x i8] c"rm -rf \00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fukamachi/roswell/refs/heads/master/src/util_dir.c\00"
@.str.2 = [7 x i8] c"rmdir \00"
@.str.3 = [4 x i8] c"cmd\00"
define i32 @delete_directory(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @q_internal(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 146)
br label %8
6: ; preds = %2
%7 = tail call i32 @q_internal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 148)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ 148, %6 ], [ 146, %4 ]
%10 = phi i32 [ %7, %6 ], [ %5, %4 ]
%11 = tail call i32 @q_internal(i8* %0, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%12 = tail call i8* @s_cat2(i32 %10, i32 %11)
%13 = tail call i32 @system(i8* %12)
%14 = tail call i32 @s_internal(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 151)
%15 = icmp eq i32 %13, 0
%16 = zext i1 %15 to i32
ret i32 %16
}