#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ qfits_card_build(char *, char *, char *, char *);
char *qfits_getcomment(char *);
char *qfits_getvalue(char *);
char *qfits_query_card(char *, char *);
int qfits_replace_card(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
char *strdup(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  char *name_in;
  char *card;
  char *place;
  char *key;
  char *key_tmp;
  char *val;
  char *val_tmp;
  char *com;
  char *com_tmp;
  int keep_com;
  int numeric;
  char *stmp;
  int i;
  char card_tmp[512];
  if (argc < 2)
    usage(argv[0]);
  name_in = NULL;
  card = NULL;
  place = NULL;
  key = NULL;
  val = NULL;
  com = NULL;
  keep_com = 0;
  numeric = 0;
  i = 1;
  while (i < argc) {
    if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
      usage(argv[0]);
    } else if (!strcmp(argv[i], "-p")) {
      if ((i + 1) >= argc) {
        fprintf(stderr, "option -p needs an argument\n");
        return -1;
      }
      i++;
      place = strdup(argv[i]);
    } else if (!strcmp(argv[i], "-k")) {
      if ((i + 1) >= argc) {
        fprintf(stderr, "option -k needs an argument\n");
        return -1;
      }
      i++;
      key = strdup(argv[i]);
    } else if (!strcmp(argv[i], "-v")) {
      if ((i + 1) >= argc) {
        fprintf(stderr, "option -v needs an argument\n");
        return -1;
      }
      i++;
      val = strdup(argv[i]);
    } else if (!strcmp(argv[i], "-c")) {
      if ((i + 1) >= argc) {
        fprintf(stderr, "option -c needs an argument\n");
        return -1;
      }
      i++;
      com = strdup(argv[i]);
    } else if (!strcmp(argv[i], "-C")) {
      keep_com = 1;
    } else if (!strcmp(argv[i], "-n")) {
      numeric = 1;
    } else {
      break;
    }
    i++;
  }
  if ((keep_com == 1) && (com != NULL)) {
    fprintf(stderr, "options -c and -C should not be used together\n");
    if (place)
      free(place);
    if (key)
      free(key);
    if (val)
      free(val);
    free(com);
    return -1;
  }
  if (place == NULL) {
    fprintf(stderr, "options -p has to be used\n");
    if (key)
      free(key);
    if (val)
      free(val);
    if (com)
      free(com);
    return -1;
  }
  if ((argc - i) < 1) {
    fprintf(stderr, "missing input file name\n");
    return -1;
  }
  while (argc - i >= 1) {
    name_in = strdup(argv[i]);
    key_tmp = NULL;
    if (key == NULL)
      key_tmp = strdup(place);
    else
      key_tmp = strdup(key);
    val_tmp = NULL;
    if (val == NULL) {
      card = qfits_query_card(name_in, place);
      if (card != NULL) {
        stmp = qfits_getvalue(card);
        val_tmp = strdup(stmp);
      }
    } else
      val_tmp = strdup(val);
    com_tmp = NULL;
    if ((com == NULL) && (keep_com == 1)) {
      if (card == NULL)
        card = qfits_query_card(name_in, place);
      if (card != NULL) {
        stmp = qfits_getcomment(card);
        com_tmp = strdup(stmp);
      }
    } else if (com != NULL)
      com_tmp = strdup(com);
    if (card != NULL)
      free(card);
    card = NULL;
    printf("DEBUG: %s\n", key_tmp);
    qfits_card_build(card_tmp, key_tmp, val_tmp, com_tmp);
    if (key_tmp)
      free(key_tmp);
    if (val_tmp)
      free(val_tmp);
    if (com_tmp)
      free(com_tmp);
    card = strdup(card_tmp);
    printf("File %s\n", name_in);
    printf("\tcard  : \n\t\t%s\n", card);
    printf("\tplace : \n\t\t%s\n", place);
    if (qfits_replace_card(name_in, place, card) == -1) {
      fprintf(stderr, "cannot replace the key %s\n", place);
    }
    free(name_in);
    free(card);
    card = NULL;
    i++;
  }
  if (val)
    free(val);
  if (com)
    free(com);
  if (key)
    free(key);
  free(place);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11df <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x50(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x1,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14e6 <main+0x336>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdbd(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     1272 <main+0xc2>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xda3(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1283 <main+0xd3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
jmp    14d8 <main+0x328>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd74(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12f9 <main+0x149>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     12d6 <main+0x126>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
lea    0xd4a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x28(%rbp)
jmp    14d3 <main+0x323>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd1e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    136f <main+0x1bf>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     134c <main+0x19c>
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
lea    0xcf4(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x30(%rbp)
jmp    14ce <main+0x31e>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcc8(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    13e5 <main+0x235>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     13c2 <main+0x212>
mov    0x2c3a(%rip),%rax
mov    (%rax),%edi
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x40(%rbp)
jmp    14c9 <main+0x319>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc72(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    145b <main+0x2ab>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
jl     1438 <main+0x288>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
lea    0xc48(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x50(%rbp)
jmp    14c4 <main+0x314>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc1c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1488 <main+0x2d8>
movl   $0x1,-0x5c(%rbp)
jmp    14bf <main+0x30f>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xbf2(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    14b5 <main+0x305>
movl   $0x1,-0x60(%rbp)
jmp    14ba <main+0x30a>
jmp    14e6 <main+0x336>
jmp    14bf <main+0x30f>
jmp    14c4 <main+0x314>
jmp    14c9 <main+0x319>
jmp    14ce <main+0x31e>
jmp    14d3 <main+0x323>
jmp    14d8 <main+0x328>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1224 <main+0x74>
cmpl   $0x1,-0x5c(%rbp)
jne    1563 <main+0x3b3>
cmpq   $0x0,-0x50(%rbp)
je     1563 <main+0x3b3>
mov    0x2ade(%rip),%rax
mov    (%rax),%edi
lea    0xb85(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
cmpq   $0x0,-0x28(%rbp)
je     1526 <main+0x376>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     153a <main+0x38a>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x40(%rbp)
je     154e <main+0x39e>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
cmpq   $0x0,-0x28(%rbp)
jne    15cd <main+0x41d>
mov    0x2a6b(%rip),%rax
mov    (%rax),%edi
lea    0xb41(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
cmpq   $0x0,-0x30(%rbp)
je     1599 <main+0x3e9>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x40(%rbp)
je     15ad <main+0x3fd>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x50(%rbp)
je     15c1 <main+0x411>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
mov    -0x8(%rbp),%eax
sub    -0x6c(%rbp),%eax
cmp    $0x1,%eax
jge    15ff <main+0x44f>
mov    0x29fd(%rip),%rax
mov    (%rax),%edi
lea    0xaee(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    189e <main+0x6ee>
jmp    1604 <main+0x454>
mov    -0x8(%rbp),%eax
sub    -0x6c(%rbp),%eax
cmp    $0x1,%eax
jl     1852 <main+0x6a2>
mov    -0x10(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    164d <main+0x49d>
mov    -0x28(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x38(%rbp)
jmp    165a <main+0x4aa>
mov    -0x30(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x48(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    16a8 <main+0x4f8>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <qfits_query_card@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     16a3 <main+0x4f3>
mov    -0x20(%rbp),%rdi
call   10c0 <qfits_getvalue@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x48(%rbp)
jmp    16b5 <main+0x505>
mov    -0x40(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x58(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1718 <main+0x568>
cmpl   $0x1,-0x5c(%rbp)
jne    1718 <main+0x568>
cmpq   $0x0,-0x20(%rbp)
jne    16ee <main+0x53e>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <qfits_query_card@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1713 <main+0x563>
mov    -0x20(%rbp),%rdi
call   10a0 <qfits_getcomment@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x58(%rbp)
jmp    1735 <main+0x585>
cmpq   $0x0,-0x50(%rbp)
je     1730 <main+0x580>
mov    -0x50(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x58(%rbp)
jmp    1735 <main+0x585>
cmpq   $0x0,-0x20(%rbp)
je     1749 <main+0x599>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x38(%rbp),%rsi
lea    0x997(%rip),%rdi
call   1040 <printf@plt>
lea    -0x270(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    -0x58(%rbp),%rcx
call   1090 <qfits_card_build@plt>
cmpq   $0x0,-0x38(%rbp)
je     178d <main+0x5dd>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x48(%rbp)
je     17a1 <main+0x5f1>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x58(%rbp)
je     17b5 <main+0x605>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
lea    -0x270(%rbp),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0x92e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0x927(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0x927(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <qfits_replace_card@plt>
cmp    $0xffffffff,%eax
jne    182a <main+0x67a>
mov    0x27ca(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0x904(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1604 <main+0x454>
cmpq   $0x0,-0x40(%rbp)
je     1866 <main+0x6b6>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x50(%rbp)
je     187a <main+0x6ca>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x30(%rbp)
je     188e <main+0x6de>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x248,%rsp
mov    %rsi,%rbp
cmp    $0x2,%edi
jge    11f3 <main+0x43>
mov    0x0(%rbp),%rdi
call   10b0 <usage@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    172a <main+0x57a>
mov    %edi,%r14d
xor    %eax,%eax
mov    %rax,0x18(%rsp)
mov    $0x1,%r12d
lea    0xdf6(%rip),%r15
lea    0xdf6(%rip),%rbx
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
jmp    1246 <main+0x96>
nop
mov    0x0(%rbp),%rdi
call   10b0 <usage@plt>
add    $0x1,%r12d
cmp    %r14d,%r12d
jge    1396 <main+0x1e6>
movslq %r12d,%rax
mov    0x0(%rbp,%rax,8),%r13
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1230 <main+0x80>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1230 <main+0x80>
mov    %r13,%rdi
lea    0xd94(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12f7 <main+0x147>
mov    %r13,%rdi
lea    0xda1(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     131b <main+0x16b>
mov    %r13,%rdi
lea    0xdaa(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     133f <main+0x18f>
mov    %r13,%rdi
lea    0xdb3(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1363 <main+0x1b3>
mov    %r13,%rdi
lea    0xdbc(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1387 <main+0x1d7>
mov    %r13,%rdi
lea    0xda8(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1239 <main+0x89>
jmp    1751 <main+0x5a1>
add    $0x1,%r12d
cmp    %r14d,%r12d
jge    16f2 <main+0x542>
movslq %r12d,%rax
mov    0x0(%rbp,%rax,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,0x28(%rsp)
jmp    1239 <main+0x89>
add    $0x1,%r12d
cmp    %r14d,%r12d
jge    1707 <main+0x557>
movslq %r12d,%rax
mov    0x0(%rbp,%rax,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,0x10(%rsp)
jmp    1239 <main+0x89>
add    $0x1,%r12d
cmp    %r14d,%r12d
jge    173c <main+0x58c>
movslq %r12d,%rax
mov    0x0(%rbp,%rax,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,0x20(%rsp)
jmp    1239 <main+0x89>
add    $0x1,%r12d
cmp    %r14d,%r12d
jge    1758 <main+0x5a8>
movslq %r12d,%rax
mov    0x0(%rbp,%rax,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,0x8(%rsp)
jmp    1239 <main+0x89>
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
jmp    1239 <main+0x89>
xor    %eax,%eax
mov    0x18(%rsp),%rcx
cmp    $0x1,%ecx
mov    0x28(%rsp),%r15
jne    140b <main+0x25b>
cmpq   $0x0,0x8(%rsp)
je     140b <main+0x25b>
mov    0x2c2a(%rip),%rax
mov    (%rax),%edi
lea    0xcd1(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %r15,%r15
mov    0x20(%rsp),%rbp
je     13d8 <main+0x228>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
mov    0x8(%rsp),%rbx
je     13ec <main+0x23c>
call   1030 <free@plt>
test   %rbp,%rbp
je     13f9 <main+0x249>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0xffffffff,%eax
jmp    172a <main+0x57a>
test   %r15,%r15
je     1658 <main+0x4a8>
test   %al,%al
je     16a4 <main+0x4f4>
cmp    %r14d,%r12d
jge    16b9 <main+0x509>
cmp    $0x1,%ecx
sete   %al
cmpq   $0x0,0x8(%rsp)
sete   %cl
and    %al,%cl
mov    %cl,0x7(%rsp)
mov    0x10(%rsp),%rcx
test   %rcx,%rcx
movslq %r12d,%rax
cmove  %r15,%rcx
mov    %rcx,0x38(%rsp)
lea    0x0(,%rax,8),%rax
add    %rbp,%rax
mov    %rax,0x30(%rsp)
sub    %r12d,%r14d
xor    %r12d,%r12d
jmp    148d <main+0x2dd>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
add    $0x1,%r12
cmp    %r12d,%r14d
je     16b9 <main+0x509>
mov    0x30(%rsp),%rax
mov    (%rax,%r12,8),%rdi
call   10d0 <strdup@plt>
mov    %rax,%rbp
mov    0x38(%rsp),%rdi
call   10d0 <strdup@plt>
mov    %rax,%rbx
mov    0x20(%rsp),%rdi
test   %rdi,%rdi
mov    %rbp,0x18(%rsp)
je     1510 <main+0x360>
call   10d0 <strdup@plt>
mov    %rax,%r13
xor    %r15d,%r15d
cmpb   $0x0,0x7(%rsp)
je     1541 <main+0x391>
test   %r15,%r15
jne    14ec <main+0x33c>
mov    0x18(%rsp),%rdi
mov    0x28(%rsp),%rsi
call   1050 <qfits_query_card@plt>
mov    %rax,%r15
test   %rax,%rax
je     1651 <main+0x4a1>
mov    %r15,%rdi
call   10a0 <qfits_getcomment@plt>
mov    %rax,%rdi
call   10d0 <strdup@plt>
mov    %rax,%rbp
jmp    1570 <main+0x3c0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1050 <qfits_query_card@plt>
test   %rax,%rax
je     163b <main+0x48b>
mov    %rax,%r15
mov    %rax,%rdi
call   10c0 <qfits_getvalue@plt>
mov    %rax,%rdi
call   10d0 <strdup@plt>
mov    %rax,%r13
cmpb   $0x0,0x7(%rsp)
jne    14cc <main+0x31c>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     155a <main+0x3aa>
call   10d0 <strdup@plt>
mov    %rax,%rbp
test   %r15,%r15
jne    1570 <main+0x3c0>
jmp    1578 <main+0x3c8>
xor    %ebp,%ebp
test   %r15,%r15
je     1578 <main+0x3c8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xb74(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0x40(%rsp),%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
call   1090 <qfits_card_build@plt>
test   %rbx,%rbx
je     15a7 <main+0x3f7>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %r13,%r13
mov    0x28(%rsp),%r15
je     15b9 <main+0x409>
mov    %r13,%rdi
call   1030 <free@plt>
test   %rbp,%rbp
je     15c6 <main+0x416>
mov    %rbp,%rdi
call   1030 <free@plt>
lea    0x40(%rsp),%rdi
call   10d0 <strdup@plt>
mov    %rax,%rbp
lea    0xb24(%rip),%rdi
mov    0x18(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xb19(%rip),%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
lea    0xb1a(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1080 <qfits_replace_card@plt>
cmp    $0xffffffff,%eax
jne    1470 <main+0x2c0>
mov    0x29bd(%rip),%rax
mov    (%rax),%edi
lea    0xafb(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1470 <main+0x2c0>
xor    %r15d,%r15d
xor    %r13d,%r13d
cmpb   $0x0,0x7(%rsp)
jne    14cc <main+0x31c>
jmp    1541 <main+0x391>
xor    %ebp,%ebp
jmp    1578 <main+0x3c8>
mov    0x2981(%rip),%rax
mov    (%rax),%edi
lea    0xa57(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     167e <main+0x4ce>
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
test   %rdi,%rdi
mov    0x8(%rsp),%rbx
je     171c <main+0x56c>
call   1030 <free@plt>
test   %rbx,%rbx
jne    13f9 <main+0x249>
jmp    1725 <main+0x575>
mov    0x2935(%rip),%rax
mov    (%rax),%edi
lea    0xa26(%rip),%rsi
jmp    11e2 <main+0x32>
mov    0x20(%rsp),%rdi
test   %rdi,%rdi
je     16c8 <main+0x518>
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     16d7 <main+0x527>
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     16e6 <main+0x536>
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    172a <main+0x57a>
mov    0x28e7(%rip),%rax
mov    (%rax),%edi
lea    0x90b(%rip),%rsi
jmp    11e2 <main+0x32>
mov    0x28d2(%rip),%rax
mov    (%rax),%edi
lea    0x916(%rip),%rsi
jmp    11e2 <main+0x32>
test   %rbx,%rbx
jne    13f9 <main+0x249>
mov    $0xffffffff,%eax
add    $0x248,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x289d(%rip),%rax
mov    (%rax),%edi
lea    0x901(%rip),%rsi
jmp    11e2 <main+0x32>
mov    $0x1,%al
jmp    1398 <main+0x1e8>
mov    0x2881(%rip),%rax
mov    (%rax),%edi
lea    0x905(%rip),%rsi
jmp    11e2 <main+0x32>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [3 x i8] c"-p\00"
@stderr = global i32 0
@.str.3 = [29 x i8] c"option -p needs an argument\0A\00"
@.str.4 = [3 x i8] c"-k\00"
@.str.5 = [29 x i8] c"option -k needs an argument\0A\00"
@.str.6 = [3 x i8] c"-v\00"
@.str.7 = [29 x i8] c"option -v needs an argument\0A\00"
@.str.8 = [3 x i8] c"-c\00"
@.str.9 = [29 x i8] c"option -c needs an argument\0A\00"
@.str.10 = [3 x i8] c"-C\00"
@.str.11 = [3 x i8] c"-n\00"
@.str.12 = [47 x i8] c"options -c and -C should not be used together\0A\00"
@.str.13 = [27 x i8] c"options -p has to be used\0A\00"
@.str.14 = [25 x i8] c"missing input file name\0A\00"
@.str.15 = [11 x i8] c"DEBUG: %s\0A\00"
@.str.16 = [9 x i8] c"File %s\0A\00"
@.str.17 = [16 x i8] c"\09card : \0A\09\09%s\0A\00"
@.str.18 = [16 x i8] c"\09place : \0A\09\09%s\0A\00"
@.str.19 = [27 x i8] c"cannot replace the key %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i32
%19 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @usage(i8* %25)
br label %27
27: ; preds = %22, %2
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %11
store i8* null, i8** %13
store i32 0, i32* %15
store i32 0, i32* %16
store i32 1, i32* %18
br label %28
28: ; preds = %178, %27
%29 = load i32, i32* %18
%30 = load i32, i32* %4
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %181
32: ; preds = %28
%33 = load i8**, i8*** %5
%34 = load i32, i32* %18
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %32
%41 = load i8**, i8*** %5
%42 = load i32, i32* %18
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%47 = icmp ne i32 %46, 0
br i1 %47, label %53, label %48
48: ; preds = %40, %32
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 0
%51 = load i8*, i8** %50
%52 = call i32 @usage(i8* %51)
br label %178
53: ; preds = %40
%54 = load i8**, i8*** %5
%55 = load i32, i32* %18
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @strcmp(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%60 = icmp ne i32 %59, 0
br i1 %60, label %78, label %61
61: ; preds = %53
%62 = load i32, i32* %18
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %4
%65 = icmp sge i32 %63, %64
br i1 %65, label %66, label %69
66: ; preds = %61
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %387
69: ; preds = %61
%70 = load i32, i32* %18
%71 = add nsw i32 %70, 1
store i32 %71, i32* %18
%72 = load i8**, i8*** %5
%73 = load i32, i32* %18
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = call i8* @strdup(i8* %76)
store i8* %77, i8** %8
br label %177
78: ; preds = %53
%79 = load i8**, i8*** %5
%80 = load i32, i32* %18
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8*, i8** %79, i64 %81
%83 = load i8*, i8** %82
%84 = call i32 @strcmp(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%85 = icmp ne i32 %84, 0
br i1 %85, label %103, label %86
86: ; preds = %78
%87 = load i32, i32* %18
%88 = add nsw i32 %87, 1
%89 = load i32, i32* %4
%90 = icmp sge i32 %88, %89
br i1 %90, label %91, label %94
91: ; preds = %86
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %387
94: ; preds = %86
%95 = load i32, i32* %18
%96 = add nsw i32 %95, 1
store i32 %96, i32* %18
%97 = load i8**, i8*** %5
%98 = load i32, i32* %18
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8*, i8** %97, i64 %99
%101 = load i8*, i8** %100
%102 = call i8* @strdup(i8* %101)
store i8* %102, i8** %9
br label %176
103: ; preds = %78
%104 = load i8**, i8*** %5
%105 = load i32, i32* %18
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8*, i8** %104, i64 %106
%108 = load i8*, i8** %107
%109 = call i32 @strcmp(i8* %108, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%110 = icmp ne i32 %109, 0
br i1 %110, label %128, label %111
111: ; preds = %103
%112 = load i32, i32* %18
%113 = add nsw i32 %112, 1
%114 = load i32, i32* %4
%115 = icmp sge i32 %113, %114
br i1 %115, label %116, label %119
116: ; preds = %111
%117 = load i32, i32* @stderr
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %3
br label %387
119: ; preds = %111
%120 = load i32, i32* %18
%121 = add nsw i32 %120, 1
store i32 %121, i32* %18
%122 = load i8**, i8*** %5
%123 = load i32, i32* %18
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8*, i8** %122, i64 %124
%126 = load i8*, i8** %125
%127 = call i8* @strdup(i8* %126)
store i8* %127, i8** %11
br label %175
128: ; preds = %103
%129 = load i8**, i8*** %5
%130 = load i32, i32* %18
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8*, i8** %129, i64 %131
%133 = load i8*, i8** %132
%134 = call i32 @strcmp(i8* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%135 = icmp ne i32 %134, 0
br i1 %135, label %153, label %136
136: ; preds = %128
%137 = load i32, i32* %18
%138 = add nsw i32 %137, 1
%139 = load i32, i32* %4
%140 = icmp sge i32 %138, %139
br i1 %140, label %141, label %144
141: ; preds = %136
%142 = load i32, i32* @stderr
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %142, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %3
br label %387
144: ; preds = %136
%145 = load i32, i32* %18
%146 = add nsw i32 %145, 1
store i32 %146, i32* %18
%147 = load i8**, i8*** %5
%148 = load i32, i32* %18
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8*, i8** %147, i64 %149
%151 = load i8*, i8** %150
%152 = call i8* @strdup(i8* %151)
store i8* %152, i8** %13
br label %174
153: ; preds = %128
%154 = load i8**, i8*** %5
%155 = load i32, i32* %18
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds i8*, i8** %154, i64 %156
%158 = load i8*, i8** %157
%159 = call i32 @strcmp(i8* %158, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%160 = icmp ne i32 %159, 0
br i1 %160, label %162, label %161
161: ; preds = %153
store i32 1, i32* %15
br label %173
162: ; preds = %153
%163 = load i8**, i8*** %5
%164 = load i32, i32* %18
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8*, i8** %163, i64 %165
%167 = load i8*, i8** %166
%168 = call i32 @strcmp(i8* %167, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%169 = icmp ne i32 %168, 0
br i1 %169, label %171, label %170
170: ; preds = %162
store i32 1, i32* %16
br label %172
171: ; preds = %162
br label %181
172: ; preds = %170
br label %173
173: ; preds = %172, %161
br label %174
174: ; preds = %173, %144
br label %175
175: ; preds = %174, %119
br label %176
176: ; preds = %175, %94
br label %177
177: ; preds = %176, %69
br label %178
178: ; preds = %177, %48
%179 = load i32, i32* %18
%180 = add nsw i32 %179, 1
store i32 %180, i32* %18
br label %28
181: ; preds = %171, %28
%182 = load i32, i32* %15
%183 = icmp eq i32 %182, 1
br i1 %183, label %184, label %210
184: ; preds = %181
%185 = load i8*, i8** %13
%186 = icmp ne i8* %185, null
br i1 %186, label %187, label %210
187: ; preds = %184
%188 = load i32, i32* @stderr
%189 = call i32 (i32, i8*, ...) @fprintf(i32 %188, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%190 = load i8*, i8** %8
%191 = icmp ne i8* %190, null
br i1 %191, label %192, label %195
192: ; preds = %187
%193 = load i8*, i8** %8
%194 = call i32 @free(i8* %193)
br label %195
195: ; preds = %192, %187
%196 = load i8*, i8** %9
%197 = icmp ne i8* %196, null
br i1 %197, label %198, label %201
198: ; preds = %195
%199 = load i8*, i8** %9
%200 = call i32 @free(i8* %199)
br label %201
201: ; preds = %198, %195
%202 = load i8*, i8** %11
%203 = icmp ne i8* %202, null
br i1 %203, label %204, label %207
204: ; preds = %201
%205 = load i8*, i8** %11
%206 = call i32 @free(i8* %205)
br label %207
207: ; preds = %204, %201
%208 = load i8*, i8** %13
%209 = call i32 @free(i8* %208)
store i32 -1, i32* %3
br label %387
210: ; preds = %184, %181
%211 = load i8*, i8** %8
%212 = icmp eq i8* %211, null
br i1 %212, label %213, label %234
213: ; preds = %210
%214 = load i32, i32* @stderr
%215 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%216 = load i8*, i8** %9
%217 = icmp ne i8* %216, null
br i1 %217, label %218, label %221
218: ; preds = %213
%219 = load i8*, i8** %9
%220 = call i32 @free(i8* %219)
br label %221
221: ; preds = %218, %213
%222 = load i8*, i8** %11
%223 = icmp ne i8* %222, null
br i1 %223, label %224, label %227
224: ; preds = %221
%225 = load i8*, i8** %11
%226 = call i32 @free(i8* %225)
br label %227
227: ; preds = %224, %221
%228 = load i8*, i8** %13
%229 = icmp ne i8* %228, null
br i1 %229, label %230, label %233
230: ; preds = %227
%231 = load i8*, i8** %13
%232 = call i32 @free(i8* %231)
br label %233
233: ; preds = %230, %227
store i32 -1, i32* %3
br label %387
234: ; preds = %210
%235 = load i32, i32* %4
%236 = load i32, i32* %18
%237 = sub nsw i32 %235, %236
%238 = icmp slt i32 %237, 1
br i1 %238, label %239, label %242
239: ; preds = %234
%240 = load i32, i32* @stderr
%241 = call i32 (i32, i8*, ...) @fprintf(i32 %240, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
store i32 -1, i32* %3
br label %387
242: ; preds = %234
br label %243
243: ; preds = %359, %242
%244 = load i32, i32* %4
%245 = load i32, i32* %18
%246 = sub nsw i32 %244, %245
%247 = icmp sge i32 %246, 1
br i1 %247, label %248, label %366
248: ; preds = %243
%249 = load i8**, i8*** %5
%250 = load i32, i32* %18
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i8*, i8** %249, i64 %251
%253 = load i8*, i8** %252
%254 = call i8* @strdup(i8* %253)
store i8* %254, i8** %6
store i8* null, i8** %10
%255 = load i8*, i8** %9
%256 = icmp eq i8* %255, null
br i1 %256, label %257, label %260
257: ; preds = %248
%258 = load i8*, i8** %8
%259 = call i8* @strdup(i8* %258)
store i8* %259, i8** %10
br label %263
260: ; preds = %248
%261 = load i8*, i8** %9
%262 = call i8* @strdup(i8* %261)
store i8* %262, i8** %10
br label %263
263: ; preds = %260, %257
store i8* null, i8** %12
%264 = load i8*, i8** %11
%265 = icmp eq i8* %264, null
br i1 %265, label %266, label %278
266: ; preds = %263
%267 = load i8*, i8** %6
%268 = load i8*, i8** %8
%269 = call i8* @qfits_query_card(i8* %267, i8* %268)
store i8* %269, i8** %7
%270 = load i8*, i8** %7
%271 = icmp ne i8* %270, null
br i1 %271, label %272, label %277
272: ; preds = %266
%273 = load i8*, i8** %7
%274 = call i8* @qfits_getvalue(i8* %273)
store i8* %274, i8** %17
%275 = load i8*, i8** %17
%276 = call i8* @strdup(i8* %275)
store i8* %276, i8** %12
br label %277
277: ; preds = %272, %266
br label %281
278: ; preds = %263
%279 = load i8*, i8** %11
%280 = call i8* @strdup(i8* %279)
store i8* %280, i8** %12
br label %281
281: ; preds = %278, %277
store i8* null, i8** %14
%282 = load i8*, i8** %13
%283 = icmp eq i8* %282, null
br i1 %283, label %284, label %303
284: ; preds = %281
%285 = load i32, i32* %15
%286 = icmp eq i32 %285, 1
br i1 %286, label %287, label %303
287: ; preds = %284
%288 = load i8*, i8** %7
%289 = icmp eq i8* %288, null
br i1 %289, label %290, label %294
290: ; preds = %287
%291 = load i8*, i8** %6
%292 = load i8*, i8** %8
%293 = call i8* @qfits_query_card(i8* %291, i8* %292)
store i8* %293, i8** %7
br label %294
294: ; preds = %290, %287
%295 = load i8*, i8** %7
%296 = icmp ne i8* %295, null
br i1 %296, label %297, label %302
297: ; preds = %294
%298 = load i8*, i8** %7
%299 = call i8* @qfits_getcomment(i8* %298)
store i8* %299, i8** %17
%300 = load i8*, i8** %17
%301 = call i8* @strdup(i8* %300)
store i8* %301, i8** %14
br label %302
302: ; preds = %297, %294
br label %310
303: ; preds = %284, %281
%304 = load i8*, i8** %13
%305 = icmp ne i8* %304, null
br i1 %305, label %306, label %309
306: ; preds = %303
%307 = load i8*, i8** %13
%308 = call i8* @strdup(i8* %307)
store i8* %308, i8** %14
br label %309
309: ; preds = %306, %303
br label %310
310: ; preds = %309, %302
%311 = load i8*, i8** %7
%312 = icmp ne i8* %311, null
br i1 %312, label %313, label %316
313: ; preds = %310
%314 = load i8*, i8** %7
%315 = call i32 @free(i8* %314)
br label %316
316: ; preds = %313, %310
store i8* null, i8** %7
%317 = load i8*, i8** %10
%318 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %317)
%319 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%320 = load i8*, i8** %10
%321 = load i8*, i8** %12
%322 = load i8*, i8** %14
%323 = call i32 @qfits_card_build(i8* %319, i8* %320, i8* %321, i8* %322)
%324 = load i8*, i8** %10
%325 = icmp ne i8* %324, null
br i1 %325, label %326, label %329
326: ; preds = %316
%327 = load i8*, i8** %10
%328 = call i32 @free(i8* %327)
br label %329
329: ; preds = %326, %316
%330 = load i8*, i8** %12
%331 = icmp ne i8* %330, null
br i1 %331, label %332, label %335
332: ; preds = %329
%333 = load i8*, i8** %12
%334 = call i32 @free(i8* %333)
br label %335
335: ; preds = %332, %329
%336 = load i8*, i8** %14
%337 = icmp ne i8* %336, null
br i1 %337, label %338, label %341
338: ; preds = %335
%339 = load i8*, i8** %14
%340 = call i32 @free(i8* %339)
br label %341
341: ; preds = %338, %335
%342 = getelementptr inbounds [512 x i8], [512 x i8]* %19, i64 0, i64 0
%343 = call i8* @strdup(i8* %342)
store i8* %343, i8** %7
%344 = load i8*, i8** %6
%345 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %344)
%346 = load i8*, i8** %7
%347 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i8* %346)
%348 = load i8*, i8** %8
%349 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8* %348)
%350 = load i8*, i8** %6
%351 = load i8*, i8** %8
%352 = load i8*, i8** %7
%353 = call i32 @qfits_replace_card(i8* %350, i8* %351, i8* %352)
%354 = icmp eq i32 %353, -1
br i1 %354, label %355, label %359
355: ; preds = %341
%356 = load i32, i32* @stderr
%357 = load i8*, i8** %8
%358 = call i32 (i32, i8*, ...) @fprintf(i32 %356, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0), i8* %357)
br label %359
359: ; preds = %355, %341
%360 = load i8*, i8** %6
%361 = call i32 @free(i8* %360)
%362 = load i8*, i8** %7
%363 = call i32 @free(i8* %362)
store i8* null, i8** %7
%364 = load i32, i32* %18
%365 = add nsw i32 %364, 1
store i32 %365, i32* %18
br label %243
366: ; preds = %243
%367 = load i8*, i8** %11
%368 = icmp ne i8* %367, null
br i1 %368, label %369, label %372
369: ; preds = %366
%370 = load i8*, i8** %11
%371 = call i32 @free(i8* %370)
br label %372
372: ; preds = %369, %366
%373 = load i8*, i8** %13
%374 = icmp ne i8* %373, null
br i1 %374, label %375, label %378
375: ; preds = %372
%376 = load i8*, i8** %13
%377 = call i32 @free(i8* %376)
br label %378
378: ; preds = %375, %372
%379 = load i8*, i8** %9
%380 = icmp ne i8* %379, null
br i1 %380, label %381, label %384
381: ; preds = %378
%382 = load i8*, i8** %9
%383 = call i32 @free(i8* %382)
br label %384
384: ; preds = %381, %378
%385 = load i8*, i8** %8
%386 = call i32 @free(i8* %385)
store i32 0, i32* %3
br label %387
387: ; preds = %384, %239, %233, %207, %141, %116, %91, %66
%388 = load i32, i32* %3
ret i32 %388
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [3 x i8] c"-p\00"
@stderr = global i32 0
@.str.3 = [29 x i8] c"option -p needs an argument\0A\00"
@.str.4 = [3 x i8] c"-k\00"
@.str.5 = [29 x i8] c"option -k needs an argument\0A\00"
@.str.6 = [3 x i8] c"-v\00"
@.str.7 = [29 x i8] c"option -v needs an argument\0A\00"
@.str.8 = [3 x i8] c"-c\00"
@.str.9 = [29 x i8] c"option -c needs an argument\0A\00"
@.str.10 = [3 x i8] c"-C\00"
@.str.11 = [3 x i8] c"-n\00"
@.str.12 = [47 x i8] c"options -c and -C should not be used together\0A\00"
@.str.13 = [27 x i8] c"options -p has to be used\0A\00"
@.str.14 = [25 x i8] c"missing input file name\0A\00"
@.str.15 = [11 x i8] c"DEBUG: %s\0A\00"
@.str.16 = [9 x i8] c"File %s\0A\00"
@.str.17 = [16 x i8] c"\09card : \0A\09\09%s\0A\00"
@.str.18 = [16 x i8] c"\09place : \0A\09\09%s\0A\00"
@.str.19 = [27 x i8] c"cannot replace the key %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @usage(i8* %7)
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
br label %235
11: ; preds = %2, %91
%12 = phi i32 [ %98, %91 ], [ 1, %2 ]
%13 = phi i32 [ %96, %91 ], [ 0, %2 ]
%14 = phi i8* [ %95, %91 ], [ null, %2 ]
%15 = phi i8* [ %94, %91 ], [ null, %2 ]
%16 = phi i8* [ %93, %91 ], [ null, %2 ]
%17 = phi i8* [ %92, %91 ], [ null, %2 ]
%18 = sext i32 %12 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %11
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23, %11
%27 = load i8*, i8** %1
%28 = tail call i32 @usage(i8* %27)
br label %91
29: ; preds = %23
%30 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %29
%33 = add nsw i32 %12, 1
%34 = icmp slt i32 %33, %0
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %235
38: ; preds = %32
%39 = sext i32 %33 to i64
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i8*, i8** %40
%42 = tail call i8* @strdup(i8* %41)
br label %91
43: ; preds = %29
%44 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %57
46: ; preds = %43
%47 = add nsw i32 %12, 1
%48 = icmp slt i32 %47, %0
br i1 %48, label %52, label %49
49: ; preds = %46
%50 = load i32, i32* @stderr
%51 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %235
52: ; preds = %46
%53 = sext i32 %47 to i64
%54 = getelementptr inbounds i8*, i8** %1, i64 %53
%55 = load i8*, i8** %54
%56 = tail call i8* @strdup(i8* %55)
br label %91
57: ; preds = %43
%58 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %71
60: ; preds = %57
%61 = add nsw i32 %12, 1
%62 = icmp slt i32 %61, %0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i32, i32* @stderr
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %235
66: ; preds = %60
%67 = sext i32 %61 to i64
%68 = getelementptr inbounds i8*, i8** %1, i64 %67
%69 = load i8*, i8** %68
%70 = tail call i8* @strdup(i8* %69)
br label %91
71: ; preds = %57
%72 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %85
74: ; preds = %71
%75 = add nsw i32 %12, 1
%76 = icmp slt i32 %75, %0
br i1 %76, label %80, label %77
77: ; preds = %74
%78 = load i32, i32* @stderr
%79 = tail call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %235
80: ; preds = %74
%81 = sext i32 %75 to i64
%82 = getelementptr inbounds i8*, i8** %1, i64 %81
%83 = load i8*, i8** %82
%84 = tail call i8* @strdup(i8* %83)
br label %91
85: ; preds = %71
%86 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%87 = icmp eq i32 %86, 0
br i1 %87, label %91, label %88
88: ; preds = %85
%89 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %100
91: ; preds = %88, %85, %38, %66, %80, %52, %26
%92 = phi i8* [ %17, %80 ], [ %17, %66 ], [ %17, %52 ], [ %42, %38 ], [ %17, %26 ], [ %17, %85 ], [ %17, %88 ]
%93 = phi i8* [ %16, %80 ], [ %16, %66 ], [ %56, %52 ], [ %16, %38 ], [ %16, %26 ], [ %16, %85 ], [ %16, %88 ]
%94 = phi i8* [ %15, %80 ], [ %70, %66 ], [ %15, %52 ], [ %15, %38 ], [ %15, %26 ], [ %15, %85 ], [ %15, %88 ]
%95 = phi i8* [ %84, %80 ], [ %14, %66 ], [ %14, %52 ], [ %14, %38 ], [ %14, %26 ], [ %14, %85 ], [ %14, %88 ]
%96 = phi i32 [ %13, %80 ], [ %13, %66 ], [ %13, %52 ], [ %13, %38 ], [ %13, %26 ], [ 1, %85 ], [ %13, %88 ]
%97 = phi i32 [ %75, %80 ], [ %61, %66 ], [ %47, %52 ], [ %33, %38 ], [ %12, %26 ], [ %12, %85 ], [ %12, %88 ]
%98 = add nsw i32 %97, 1
%99 = icmp slt i32 %98, %0
br i1 %99, label %11, label %100
100: ; preds = %91, %88
%101 = phi i8* [ %92, %91 ], [ %17, %88 ]
%102 = phi i8* [ %93, %91 ], [ %16, %88 ]
%103 = phi i8* [ %94, %91 ], [ %15, %88 ]
%104 = phi i8* [ %95, %91 ], [ %14, %88 ]
%105 = phi i32 [ %96, %91 ], [ %13, %88 ]
%106 = phi i32 [ %98, %91 ], [ %12, %88 ]
%107 = phi i1 [ false, %91 ], [ true, %88 ]
%108 = icmp eq i32 %105, 1
%109 = icmp ne i8* %104, null
%110 = select i1 %108, i1 %109, i1 false
br i1 %110, label %111, label %127
111: ; preds = %100
%112 = load i32, i32* @stderr
%113 = tail call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.12, i64 0, i64 0))
%114 = icmp eq i8* %101, null
br i1 %114, label %117, label %115
115: ; preds = %111
%116 = tail call i32 @free(i8* %101)
br label %117
117: ; preds = %115, %111
%118 = icmp eq i8* %102, null
br i1 %118, label %121, label %119
119: ; preds = %117
%120 = tail call i32 @free(i8* %102)
br label %121
121: ; preds = %119, %117
%122 = icmp eq i8* %103, null
br i1 %122, label %125, label %123
123: ; preds = %121
%124 = tail call i32 @free(i8* %103)
br label %125
125: ; preds = %123, %121
%126 = tail call i32 @free(i8* %104)
br label %235
127: ; preds = %100
%128 = icmp eq i8* %101, null
br i1 %128, label %129, label %142
129: ; preds = %127
%130 = load i32, i32* @stderr
%131 = tail call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%132 = icmp eq i8* %102, null
br i1 %132, label %135, label %133
133: ; preds = %129
%134 = tail call i32 @free(i8* %102)
br label %135
135: ; preds = %133, %129
%136 = icmp eq i8* %103, null
br i1 %136, label %139, label %137
137: ; preds = %135
%138 = tail call i32 @free(i8* %103)
br i1 %109, label %140, label %235
139: ; preds = %135
br i1 %109, label %140, label %235
140: ; preds = %137, %139
%141 = tail call i32 @free(i8* %104)
br label %235
142: ; preds = %127
br i1 %107, label %143, label %152
143: ; preds = %142
%144 = icmp slt i32 %106, %0
br i1 %144, label %145, label %222
145: ; preds = %143
%146 = icmp eq i8* %102, null
%147 = icmp eq i8* %103, null
%148 = icmp eq i8* %104, null
%149 = select i1 %148, i1 %108, i1 false
%150 = sext i32 %106 to i64
%151 = select i1 %146, i8* %101, i8* %102
br label %155
152: ; preds = %142
%153 = load i32, i32* @stderr
%154 = tail call i32 (i32, i8*, ...) @fprintf(i32 %153, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0))
br label %235
155: ; preds = %145, %216
%156 = phi i64 [ %150, %145 ], [ %219, %216 ]
%157 = getelementptr inbounds i8*, i8** %1, i64 %156
%158 = load i8*, i8** %157
%159 = call i8* @strdup(i8* %158)
%160 = call i8* @strdup(i8* %151)
br i1 %147, label %161, label %167
161: ; preds = %155
%162 = call i8* @qfits_query_card(i8* %159, i8* %101)
%163 = icmp eq i8* %162, null
br i1 %163, label %169, label %164
164: ; preds = %161
%165 = call i8* @qfits_getvalue(i8* %162)
%166 = call i8* @strdup(i8* %165)
br label %169
167: ; preds = %155
%168 = call i8* @strdup(i8* %103)
br label %169
169: ; preds = %161, %164, %167
%170 = phi i8* [ %162, %164 ], [ null, %161 ], [ null, %167 ]
%171 = phi i8* [ %166, %164 ], [ null, %161 ], [ %168, %167 ]
br i1 %149, label %172, label %181
172: ; preds = %169
%173 = icmp eq i8* %170, null
br i1 %173, label %174, label %177
174: ; preds = %172
%175 = call i8* @qfits_query_card(i8* %159, i8* %101)
%176 = icmp eq i8* %175, null
br i1 %176, label %191, label %177
177: ; preds = %174, %172
%178 = phi i8* [ %175, %174 ], [ %170, %172 ]
%179 = call i8* @qfits_getcomment(i8* %178)
%180 = call i8* @strdup(i8* %179)
br label %187
181: ; preds = %169
br i1 %109, label %182, label %184
182: ; preds = %181
%183 = call i8* @strdup(i8* %104)
br label %184
184: ; preds = %181, %182
%185 = phi i8* [ %183, %182 ], [ null, %181 ]
%186 = icmp eq i8* %170, null
br i1 %186, label %191, label %187
187: ; preds = %177, %184
%188 = phi i8* [ %180, %177 ], [ %185, %184 ]
%189 = phi i8* [ %178, %177 ], [ %170, %184 ]
%190 = call i32 @free(i8* %189)
br label %191
191: ; preds = %174, %187, %184
%192 = phi i8* [ %188, %187 ], [ %185, %184 ], [ null, %174 ]
%193 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %160)
%194 = call i32 @qfits_card_build(i8* %4, i8* %160, i8* %171, i8* %192)
%195 = icmp eq i8* %160, null
br i1 %195, label %198, label %196
196: ; preds = %191
%197 = call i32 @free(i8* %160)
br label %198
198: ; preds = %196, %191
%199 = icmp eq i8* %171, null
br i1 %199, label %202, label %200
200: ; preds = %198
%201 = call i32 @free(i8* %171)
br label %202
202: ; preds = %200, %198
%203 = icmp eq i8* %192, null
br i1 %203, label %206, label %204
204: ; preds = %202
%205 = call i32 @free(i8* %192)
br label %206
206: ; preds = %204, %202
%207 = call i8* @strdup(i8* %4)
%208 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8* %159)
%209 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i8* %207)
%210 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i8* %101)
%211 = call i32 @qfits_replace_card(i8* %159, i8* %101, i8* %207)
%212 = icmp eq i32 %211, -1
br i1 %212, label %213, label %216
213: ; preds = %206
%214 = load i32, i32* @stderr
%215 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0), i8* %101)
br label %216
216: ; preds = %213, %206
%217 = call i32 @free(i8* %159)
%218 = call i32 @free(i8* %207)
%219 = add nsw i64 %156, 1
%220 = trunc i64 %219 to i32
%221 = icmp eq i32 %220, %0
br i1 %221, label %222, label %155
222: ; preds = %216, %143
%223 = icmp eq i8* %103, null
br i1 %223, label %226, label %224
224: ; preds = %222
%225 = call i32 @free(i8* %103)
br label %226
226: ; preds = %224, %222
br i1 %109, label %227, label %229
227: ; preds = %226
%228 = call i32 @free(i8* %104)
br label %229
229: ; preds = %227, %226
%230 = icmp eq i8* %102, null
br i1 %230, label %233, label %231
231: ; preds = %229
%232 = call i32 @free(i8* %102)
br label %233
233: ; preds = %231, %229
%234 = call i32 @free(i8* %101)
br label %235
235: ; preds = %137, %6, %139, %140, %233, %152, %125, %77, %63, %49, %35
%236 = phi i32 [ -1, %125 ], [ -1, %152 ], [ 0, %233 ], [ -1, %77 ], [ -1, %63 ], [ -1, %49 ], [ -1, %35 ], [ -1, %140 ], [ -1, %139 ], [ -1, %6 ], [ -1, %137 ]
ret i32 %236
}