#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*/ STDOUT_FILENO;
int fill_fs(char const *, long, long, int);
int isatty(int /*<<< orphan*/);
int parse_args(char *, int, char **, long *, long *, char const **);
int /*<<< orphan*/ unlink_old_files(char const *, long, long);
int main(int argc, char **argv) {
  long start_at, end_at;
  const char *path;
  int progress;
  int rc;
  rc = parse_args("write", argc, argv, &start_at, &end_at, &path);
  if (rc)
    return rc;
  unlink_old_files(path, start_at, end_at);
  progress = isatty(STDOUT_FILENO);
  return fill_fs(path, start_at, end_at, progress);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe9c(%rip),%rdi
lea    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1040 <parse_args@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     118d <main+0x4d>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c6 <main+0x86>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <unlink_old_files@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1030 <isatty@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1050 <fill_fs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    %rsi,%rdx
mov    %edi,%esi
lea    0xeb0(%rip),%rdi
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rsp,%r9
call   1040 <parse_args@plt>
test   %eax,%eax
je     116b <main+0x2b>
add    $0x18,%rsp
ret
mov    (%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
call   1060 <unlink_old_files@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1030 <isatty@plt>
mov    (%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %eax,%ecx
call   1050 <fill_fs@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"write\00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @parse_args(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %11, i8** %12, i64* %6, i64* %7, i8** %8)
store i32 %13, i32* %10
%14 = load i32, i32* %10
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = load i32, i32* %10
store i32 %17, i32* %3
br label %30
18: ; preds = %2
%19 = load i8*, i8** %8
%20 = load i64, i64* %6
%21 = load i64, i64* %7
%22 = call i32 @unlink_old_files(i8* %19, i64 %20, i64 %21)
%23 = load i32, i32* @STDOUT_FILENO
%24 = call i32 @isatty(i32 %23)
store i32 %24, i32* %9
%25 = load i8*, i8** %8
%26 = load i64, i64* %6
%27 = load i64, i64* %7
%28 = load i32, i32* %9
%29 = call i32 @fill_fs(i8* %25, i64 %26, i64 %27, i32 %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %18, %16
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [6 x i8] c"write\00"
@STDOUT_FILENO = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = bitcast i64* %3 to i8*
%7 = bitcast i64* %4 to i8*
%8 = bitcast i8** %5 to i8*
%9 = call i32 @parse_args(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0, i8** %1, i64* %3, i64* %4, i8** %5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = call i32 @unlink_old_files(i8* %12, i64 %13, i64 %14)
%16 = load i32, i32* @STDOUT_FILENO
%17 = call i32 @isatty(i32 %16)
%18 = load i8*, i8** %5
%19 = load i64, i64* %3
%20 = load i64, i64* %4
%21 = call i32 @fill_fs(i8* %18, i64 %19, i64 %20, i32 %17)
br label %22
22: ; preds = %2, %11
%23 = phi i32 [ %21, %11 ], [ %9, %2 ]
ret i32 %23
}