#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 */
scalar_t__ convert_eso_to_std_FITS(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ generate_default_convtab();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  char name_conv[512];
  char name_in[512];
  if (argc < 2)
    usage(argv[0]);
  if (!strcmp(argv[1], "-g")) {
    generate_default_convtab();
    return 0;
  }
  strcpy(name_in, argv[1]);
  if (argc == 3) {
    strcpy(name_conv, argv[2]);
  } else {
    strcpy(name_conv, "table.conv");
  }
  if (convert_eso_to_std_FITS(name_in, name_conv) != 0) {
    fprintf(stderr, "error during conversion: aborting\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118f <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe62(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11bf <main+0x5f>
mov    $0x0,%al
call   1040 <generate_default_convtab@plt>
movl   $0x0,-0x4(%rbp)
jmp    1242 <main+0xe2>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11f6 <main+0x96>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
jmp    1209 <main+0xa9>
lea    -0x210(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1070 <convert_eso_to_std_FITS@plt>
cmp    $0x0,%rax
je     123b <main+0xdb>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0x1,%edi
jg     117d <main+0x1d>
mov    (%r14),%rdi
call   1080 <usage@plt>
mov    0x8(%r14),%rbx
lea    0xe78(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11aa <main+0x4a>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
cmp    $0x3,%ebp
jne    11b3 <main+0x53>
mov    0x10(%r14),%rsi
jmp    11ba <main+0x5a>
xor    %eax,%eax
call   1040 <generate_default_convtab@plt>
jmp    11ef <main+0x8f>
lea    0xe49(%rip),%rsi
lea    0x200(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1070 <convert_eso_to_std_FITS@plt>
test   %rax,%rax
je     11ef <main+0x8f>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe24(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-g\00"
@.str.1 = [11 x i8] c"table.conv\00"
@stderr = global i32 0
@.str.2 = [35 x i8] c"error during conversion: aborting\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @usage(i8* %13)
br label %15
15: ; preds = %10, %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %15
%22 = call i32 (...) @generate_default_convtab()
store i32 0, i32* %3
br label %49
23: ; preds = %15
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strcpy(i8* %24, i8* %27)
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 3
br i1 %30, label %31, label %37
31: ; preds = %23
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @strcpy(i8* %32, i8* %35)
br label %40
37: ; preds = %23
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %37, %31
%41 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%43 = call i64 @convert_eso_to_std_FITS(i8* %41, i8* %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %48
48: ; preds = %45, %40
store i32 0, i32* %3
br label %49
49: ; preds = %48, %21
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [3 x i8] c"-g\00"
@.str.1 = [11 x i8] c"table.conv\00"
@stderr = global i32 0
@.str.2 = [35 x i8] c"error during conversion: aborting\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @usage(i8* %9)
br label %11
11: ; preds = %8, %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 (...) @generate_default_convtab()
br label %32
18: ; preds = %11
%19 = call i32 @strcpy(i8* %6, i8* %13)
%20 = icmp eq i32 %0, 3
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
br label %24
24: ; preds = %18, %21
%25 = phi i8* [ %23, %21 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %18 ]
%26 = call i32 @strcpy(i8* %5, i8* %25)
%27 = call i64 @convert_eso_to_std_FITS(i8* %6, i8* %5)
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %24, %29, %16
ret i32 0
}