#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*/ _assert(int, char *, int);
scalar_t__ fstat(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int prompt();
int /*<<< orphan*/ signal(int, int);
int main(int argc, char *argv[]) {
  char user_dir[100];
  signal(2, 1);
  _assert(fstat(0, 0) < 0,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/"
          "fsh.c",
          33);
  _assert(fstat(1, 0) < 0,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/"
          "fsh.c",
          34);
  _assert(fstat(2, 0) < 0,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/"
          "fsh.c",
          35);
  printf("------------------------------------------------------\n");
  printf("Fosix Shell\n");
  printf("------------------------------------------------------\n");
  printf("Enter ? for a list of available commands.\n");
  printf("------------------------------------------------------\n");
  return (prompt());
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%edi
mov    $0x1,%esi
call   1050 <signal@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <fstat@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe6c(%rip),%rsi
mov    $0x21,%edx
call   1060 <_assert@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1070 <fstat@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe43(%rip),%rsi
mov    $0x22,%edx
call   1060 <_assert@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1070 <fstat@plt>
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe1a(%rip),%rsi
mov    $0x23,%edx
call   1060 <_assert@plt>
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <prompt@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2,%edi
mov    $0x1,%esi
call   1050 <signal@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <fstat@plt>
shr    $0x3f,%rax
lea    0xe8c(%rip),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x21,%edx
call   1060 <_assert@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1070 <fstat@plt>
shr    $0x3f,%rax
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x22,%edx
call   1060 <_assert@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1070 <fstat@plt>
shr    $0x3f,%rax
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x23,%edx
call   1060 <_assert@plt>
lea    0xef7(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <prompt@plt>

LLVM IR (-O0):
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/fsh.c\00"
@.str.1 = [56 x i8] c"------------------------------------------------------\0A\00"
@.str.2 = [13 x i8] c"Fosix Shell\0A\00"
@.str.3 = [43 x i8] c"Enter ? for a list of available commands.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @signal(i32 2, i32 1)
%8 = call i64 @fstat(i32 0, i32 0)
%9 = icmp slt i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @_assert(i32 %10, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 33)
%12 = call i64 @fstat(i32 1, i32 0)
%13 = icmp slt i64 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @_assert(i32 %14, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 34)
%16 = call i64 @fstat(i32 2, i32 0)
%17 = icmp slt i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @_assert(i32 %18, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 35)
%20 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 (...) @prompt()
ret i32 %25
}

LLVM IR (-O2):
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fossum/wsu_cs460/refs/heads/master/final/fsh.c\00"
@str.4 = [12 x i8] c"Fosix Shell\00"
@str.6 = [42 x i8] c"Enter ? for a list of available commands.\00"
@str.7 = [55 x i8] c"------------------------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @signal(i32 2, i32 1)
%4 = tail call i64 @fstat(i32 0, i32 0)
%5 = lshr i64 %4, 63
%6 = trunc i64 %5 to i32
%7 = tail call i32 @_assert(i32 %6, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 33)
%8 = tail call i64 @fstat(i32 1, i32 0)
%9 = lshr i64 %8, 63
%10 = trunc i64 %9 to i32
%11 = tail call i32 @_assert(i32 %10, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 34)
%12 = tail call i64 @fstat(i32 2, i32 0)
%13 = lshr i64 %12, 63
%14 = trunc i64 %13 to i32
%15 = tail call i32 @_assert(i32 %14, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 35)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.6, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.7, i64 0, i64 0))
%21 = tail call i32 (...) @prompt()
ret i32 %21
}