#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ atof(char *);
int extract_cmc1x_stars(int /*<<< orphan*/ *, int /*<<< orphan*/,
                        int /*<<< orphan*/, int /*<<< orphan*/,
                        int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ show_error_message();
int main(int argc, char **argv) {
  int rval = -9;
  if (argc < 5)
    show_error_message();
  else {
    FILE *ofile = fopen("cmc.txt", "w");
    rval =
        extract_cmc1x_stars(ofile, atof(argv[1]), atof(argv[2]), atof(argv[3]),
                            atof(argv[4]), (argc > 5 ? argv[5] : ""), 0);
    printf("%d stars extracted\n", rval);
    fclose(ofile);
  }
  return (rval);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xfffffff7,-0x14(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1193 <main+0x33>
mov    $0x0,%al
call   1060 <show_error_message@plt>
jmp    125b <main+0xfb>
lea    0xe66(%rip),%rdi
lea    0xe67(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x5,-0x8(%rbp)
jle    120d <main+0xad>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    121d <main+0xbd>
lea    0xe09(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    121d <main+0xbd>
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%esi
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%r9
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1080 <extract_cmc1x_stars@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xdbd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x4,%edi
jg     1181 <main+0x21>
xor    %eax,%eax
call   1060 <show_error_message@plt>
mov    $0xfffffff7,%ebx
jmp    120e <main+0xae>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe73(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
call   1030 <atof@plt>
mov    %eax,%r15d
mov    0x10(%rbx),%rdi
call   1030 <atof@plt>
mov    %eax,%r12d
mov    0x18(%rbx),%rdi
call   1030 <atof@plt>
mov    %eax,%r13d
mov    0x20(%rbx),%rdi
call   1030 <atof@plt>
cmp    $0x5,%ebp
jne    11d7 <main+0x77>
lea    0xe48(%rip),%r9
jmp    11db <main+0x7b>
mov    0x28(%rbx),%r9
movl   $0x0,(%rsp)
mov    %r14,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %eax,%r8d
call   1080 <extract_cmc1x_stars@plt>
mov    %eax,%ebx
lea    0xe0b(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"cmc.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [20 x i8] c"%d stars extracted\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -9, i32* %6
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @show_error_message()
br label %45
12: ; preds = %2
%13 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %7
%14 = load i32*, i32** %7
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atof(i8* %17)
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atof(i8* %21)
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @atof(i8* %25)
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 4
%29 = load i8*, i8** %28
%30 = call i32 @atof(i8* %29)
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 5
br i1 %32, label %33, label %37
33: ; preds = %12
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 5
%36 = load i8*, i8** %35
br label %38
37: ; preds = %12
br label %38
38: ; preds = %37, %33
%39 = phi i8* [ %36, %33 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %37 ]
%40 = call i32 @extract_cmc1x_stars(i32* %14, i32 %18, i32 %22, i32 %26, i32 %30, i8* %39, i32 0)
store i32 %40, i32* %6
%41 = load i32, i32* %6
%42 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%43 = load i32*, i32** %7
%44 = call i32 @fclose(i32* %43)
br label %45
45: ; preds = %38, %10
%46 = load i32, i32* %6
ret i32 %46
}

LLVM IR (-O2):
@.str = [8 x i8] c"cmc.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [20 x i8] c"%d stars extracted\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @show_error_message()
br label %29
6: ; preds = %2
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atof(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atof(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @atof(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 4
%18 = load i8*, i8** %17
%19 = tail call i32 @atof(i8* %18)
%20 = icmp eq i32 %0, 5
br i1 %20, label %24, label %21
21: ; preds = %6
%22 = getelementptr inbounds i8*, i8** %1, i64 5
%23 = load i8*, i8** %22
br label %24
24: ; preds = %6, %21
%25 = phi i8* [ %23, %21 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %6 ]
%26 = tail call i32 @extract_cmc1x_stars(i32* %7, i32 %10, i32 %13, i32 %16, i32 %19, i8* %25, i32 0)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = tail call i32 @fclose(i32* %7)
br label %29
29: ; preds = %24, %4
%30 = phi i32 [ -9, %4 ], [ %26, %24 ]
ret i32 %30
}