// File: /workspace/github_c_makefile_star2_O0/fm4dd[P]learn-ssl/set_asn1_time.c
// Function: main
int main() {

  const char timestr[] = "20121018162433Z";
  BIO          *outbio = NULL;
  ASN1_TIME *str_asn1time, *now_asn1time;

  /* ---------------------------------------------------------- *
   * Create the Input/Output BIO's.                             *
   * ---------------------------------------------------------- */
  outbio  = BIO_new(BIO_s_file());
  outbio  = BIO_new_fp(stdout, BIO_NOCLOSE);

  /* ---------------------------------------------------------- *
   * Set the ASN1 date & time structure                         *
   * ---------------------------------------------------------- */
  str_asn1time = ASN1_TIME_new();
  now_asn1time = ASN1_TIME_new();

  if (! ASN1_TIME_set_string(str_asn1time, timestr))
        BIO_printf(outbio, "Error date is invalid, should be YYYYMMDDHHMMSSZ");

  ASN1_TIME_set(now_asn1time, time(NULL));

  /* ---------------------------------------------------------- *
   * Print the ASN1 date and time here                          *
   * ---------------------------------------------------------- */
  BIO_printf(outbio, "Set ASN1 date & time from String: ");
  if (!ASN1_TIME_print(outbio, str_asn1time))
    BIO_printf(outbio, "Error printing ASN1 time");
  else
    BIO_printf(outbio, "\n");

  BIO_printf(outbio, "Set ASN1 date & time from time(): ");
  if (!ASN1_TIME_print(outbio, now_asn1time))
    BIO_printf(outbio, "Error printing ASN1 time");
  else
    BIO_printf(outbio, "\n");

  /* ---------------------------------------------------------- *
   * Free up all structures                                     *
   * ---------------------------------------------------------- */
  ASN1_TIME_free(str_asn1time);
  ASN1_TIME_free(now_asn1time);
  BIO_free_all(outbio);
  exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movq 0xe0a(%rip), %rax       # 0x2010
movq %rax, -0x20(%rbp)
movq 0xe07(%rip), %rax       # 0x2018
movq %rax, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
callq 0x1030
movq %rax, %rdi
callq 0x10c0
movq %rax, -0x28(%rbp)
movq 0x2d9b(%rip), %rax      # 0x3fd0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x1060
movq %rax, -0x28(%rbp)
callq 0x1080
movq %rax, -0x30(%rbp)
callq 0x1080
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1040
cmpl $0x0, %eax
jne 0x1279
movq -0x28(%rbp), %rdi
leaq 0xdae(%rip), %rsi       # 0x2020
movb $0x0, %al
callq 0x10e0
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x1070
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x10a0
movq -0x28(%rbp), %rdi
leaq 0xdb0(%rip), %rsi       # 0x2051
movb $0x0, %al
callq 0x10e0
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0x12ce
movq -0x28(%rbp), %rdi
leaq 0xdaf(%rip), %rsi       # 0x2074
movb $0x0, %al
callq 0x10e0
jmp 0x12e0
movq -0x28(%rbp), %rdi
leaq 0xdb4(%rip), %rsi       # 0x208d
movb $0x0, %al
callq 0x10e0
movq -0x28(%rbp), %rdi
leaq 0xda4(%rip), %rsi       # 0x208f
movb $0x0, %al
callq 0x10e0
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0x1318
movq -0x28(%rbp), %rdi
leaq 0xd65(%rip), %rsi       # 0x2074
movb $0x0, %al
callq 0x10e0
jmp 0x132a
movq -0x28(%rbp), %rdi
leaq 0xd6a(%rip), %rsi       # 0x208d
movb $0x0, %al
callq 0x10e0
movq -0x30(%rbp), %rdi
callq 0x10b0
movq -0x38(%rbp), %rdi
callq 0x10b0
movq -0x28(%rbp), %rdi
callq 0x1050
xorl %edi, %edi
callq 0x1090