#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 */
struct util_ptr_list {
  int dummy;
};
struct gc_scan {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int atoi(char *);
struct util_ptr_list *fasta_read(char *);
int /*<<< orphan*/ fatal_error(char *, char *, char *);
int /*<<< orphan*/ gc_scan_destroy(struct gc_scan *);
struct gc_scan *gc_scan_init(int, struct util_ptr_list *);
int /*<<< orphan*/ gc_scan_report(struct gc_scan *);
int test_gc_scan(int argc, char *argv[]) {
  struct util_ptr_list *seqs;
  struct gc_scan *gcs;
  int window_size;
  if (argc != 4)
    fatal_error("usage: %s %s <window size in bases> <fasta filename (may be "
                "gzipped)>\n",
                argv[0], argv[1]);
  window_size = atoi(argv[2]);
  seqs = fasta_read(argv[3]);
  gcs = gc_scan_init(window_size, seqs);
  gc_scan_report(gcs);
  gc_scan_destroy(gcs);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<test_gc_scan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
je     1194 <test_gc_scan+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe71(%rip),%rdi
call   1040 <fatal_error@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <fasta_read@plt>
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <gc_scan_init@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <gc_scan_report@plt>
mov    -0x20(%rbp),%rdi
call   1030 <gc_scan_destroy@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_gc_scan>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
je     117e <test_gc_scan+0x1e>
mov    (%rbx),%rsi
mov    0x8(%rbx),%rdx
lea    0xe87(%rip),%rdi
call   1040 <fatal_error@plt>
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x18(%rbx),%rdi
call   1050 <fasta_read@plt>
mov    %ebp,%edi
mov    %rax,%rsi
call   1080 <gc_scan_init@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <gc_scan_report@plt>
mov    %rbx,%rdi
call   1030 <gc_scan_destroy@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.util_ptr_list = type { i32 }
%struct.gc_scan = type { i32 }
@.str = [71 x i8] c"usage: %s %s <window size in bases> <fasta filename (may be gzipped)>\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @test_gc_scan(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.util_ptr_list*
%6 = alloca %struct.gc_scan*
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 4
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @fatal_error(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %16)
br label %18
18: ; preds = %10, %2
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %7
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call %struct.util_ptr_list* @fasta_read(i8* %25)
store %struct.util_ptr_list* %26, %struct.util_ptr_list** %5
%27 = load i32, i32* %7
%28 = load %struct.util_ptr_list*, %struct.util_ptr_list** %5
%29 = call %struct.gc_scan* @gc_scan_init(i32 %27, %struct.util_ptr_list* %28)
store %struct.gc_scan* %29, %struct.gc_scan** %6
%30 = load %struct.gc_scan*, %struct.gc_scan** %6
%31 = call i32 @gc_scan_report(%struct.gc_scan* %30)
%32 = load %struct.gc_scan*, %struct.gc_scan** %6
%33 = call i32 @gc_scan_destroy(%struct.gc_scan* %32)
%34 = load i32, i32* @EXIT_SUCCESS
ret i32 %34
}

LLVM IR (-O2):
%struct.util_ptr_list = type { i32 }
%struct.gc_scan = type { i32 }
@.str = [71 x i8] c"usage: %s %s <window size in bases> <fasta filename (may be gzipped)>\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @test_gc_scan(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @fatal_error(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %7)
br label %9
9: ; preds = %4, %2
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = tail call %struct.util_ptr_list* @fasta_read(i8* %14)
%16 = tail call %struct.gc_scan* @gc_scan_init(i32 %12, %struct.util_ptr_list* %15)
%17 = tail call i32 @gc_scan_report(%struct.gc_scan* %16)
%18 = tail call i32 @gc_scan_destroy(%struct.gc_scan* %16)
%19 = load i32, i32* @EXIT_SUCCESS
ret i32 %19
}