// File: /workspace/github_c_makefile_star2_O0/reactive-systems[P]aiger-ltl-model-checker/aiger.c
// Function: aiger_open_and_write_to_file
int
aiger_open_and_write_to_file (aiger * public, const char *file_name)
{
  IMPORT_private_FROM (public);
  int res, pclose_file;
  char *cmd, size_cmd;
  aiger_mode mode;
  FILE *file;

  assert (!aiger_error (public));

  assert (file_name);

  if (aiger_has_suffix (file_name, ".gz"))
    {
      size_cmd = strlen (file_name) + strlen (GZIP);
      NEWN (cmd, size_cmd);
      sprintf (cmd, GZIP, file_name);
      file = popen (cmd, "w");
      DELETEN (cmd, size_cmd);
      pclose_file = 1;
    }
  else
    {
      file = fopen (file_name, "w");
      pclose_file = 0;
    }

  if (!file)
    return 0;

  if (aiger_has_suffix (file_name, ".aag") ||
      aiger_has_suffix (file_name, ".aag.gz"))
    mode = aiger_ascii_mode;
  else
    mode = aiger_binary_mode;

  res = aiger_write_to_file (public, mode, file);

  if (pclose_file)
    pclose (file);
  else
    fclose (file);

  if (!res)
    unlink (file_name);

  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2a70
cmpq $0x0, %rax
jne 0x7599
jmp 0x75b8
leaq 0x4d57(%rip), %rdi      # 0xc2f7
leaq 0x4d02(%rip), %rsi      # 0xc2a9
movl $0x72e, %edx            # imm = 0x72E
leaq 0x51b9(%rip), %rcx      # 0xc76c
callq 0x10f0
cmpq $0x0, -0x18(%rbp)
je 0x75c1
jmp 0x75e0
leaq 0x51dc(%rip), %rdi      # 0xc7a4
leaq 0x4cda(%rip), %rsi      # 0xc2a9
movl $0x730, %edx            # imm = 0x730
leaq 0x5191(%rip), %rcx      # 0xc76c
callq 0x10f0
movq -0x18(%rbp), %rdi
leaq 0x51e5(%rip), %rsi      # 0xc7d0
callq 0x7760
cmpl $0x0, %eax
je 0x76ad
movq -0x18(%rbp), %rdi
callq 0x10b0
addq $0x18, %rax
movb %al, -0x31(%rbp)
movsbq -0x31(%rbp), %rax
shlq $0x0, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0xc0(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0xb8(%rcx), %rdi
movq -0x48(%rbp), %rsi
callq *%rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rdx
xorl %esi, %esi
callq 0x1100
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x515a(%rip), %rsi      # 0xc7ae
movb $0x0, %al
callq 0x1180
movq -0x30(%rbp), %rdi
leaq 0x57c3(%rip), %rsi      # 0xce29
callq 0x1160
movq %rax, -0x40(%rbp)
movsbq -0x31(%rbp), %rax
shlq $0x0, %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0xb8(%rcx), %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq *%rax
movq $0x0, -0x30(%rbp)
movl $0x1, -0x28(%rbp)
jmp 0x76c8
movq -0x18(%rbp), %rdi
leaq 0x5771(%rip), %rsi      # 0xce29
callq 0x1170
movq %rax, -0x40(%rbp)
movl $0x0, -0x28(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x76d8
movl $0x0, -0x4(%rbp)
jmp 0x7754
movq -0x18(%rbp), %rdi
leaq 0x50e4(%rip), %rsi      # 0xc7c7
callq 0x7760
cmpl $0x0, %eax
jne 0x7702
movq -0x18(%rbp), %rdi
leaq 0x50d4(%rip), %rsi      # 0xc7cc
callq 0x7760
cmpl $0x0, %eax
je 0x770b
movl $0x1, -0x38(%rbp)
jmp 0x7712
movl $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl -0x38(%rbp), %esi
movq -0x40(%rbp), %rdx
callq 0x73f0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x7736
movq -0x40(%rbp), %rdi
callq 0x10e0
jmp 0x773f
movq -0x40(%rbp), %rdi
callq 0x10a0
cmpl $0x0, -0x24(%rbp)
jne 0x774e
movq -0x18(%rbp), %rdi
callq 0x1060
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)