#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*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *, unsigned long,
                            unsigned long, unsigned long);
int strlen(char *);
void write_index(FILE *file, unsigned long start, unsigned long end,
                 char *chromo_name) {
  size_t total_size = strlen(chromo_name) + 60;
  char out_str[total_size];
  snprintf(out_str, total_size, "%-20s %12lu %12lu %12lu\n", chromo_name, start,
           (end - 1), (end - start));
  fputs(out_str, file);
  return;
}


x86 assembly (clang, -O0):
<write_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x3c,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
sub    $0x1,%r9
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
lea    0xe5c(%rip),%rdx
sub    $0x10,%rsp
mov    %rax,(%rsp)
call   1040 <snprintf@plt>
mov    -0x40(%rbp),%rdi
add    $0x10,%rsp
mov    -0x8(%rbp),%rsi
call   1050 <fputs@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_index>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%r14
mov    %rcx,%rdi
call   1030 <strlen@plt>
cltq
lea    0x3c(%rax),%rsi
mov    %rsp,%rbx
add    $0x4b,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x1(%r13),%r9
sub    %r12,%r13
sub    $0x8,%rsp
lea    0xe85(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r12,%r8
push   %r13
call   1040 <snprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <fputs@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%-20s %12lu %12lu %12lu\0A\00"
define void @write_index(i32* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
store i32* %0, i32** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
%13 = call i32 @strlen(i8* %12)
%14 = add nsw i32 %13, 60
%15 = sext i32 %14 to i64
store i64 %15, i64* %9
%16 = load i64, i64* %9
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %10
%18 = alloca i8, i64 %16
store i64 %16, i64* %11
%19 = load i64, i64* %9
%20 = load i8*, i8** %8
%21 = load i64, i64* %6
%22 = load i64, i64* %7
%23 = sub i64 %22, 1
%24 = load i64, i64* %7
%25 = load i64, i64* %6
%26 = sub i64 %24, %25
%27 = call i32 @snprintf(i8* %18, i64 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %20, i64 %21, i64 %23, i64 %26)
%28 = load i32*, i32** %5
%29 = call i32 @fputs(i8* %18, i32* %28)
%30 = load i8*, i8** %10
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"%-20s %12lu %12lu %12lu\0A\00"
define void @write_index(i32* nocapture %0, i64 %1, i64 %2, i8* %3) {
%5 = tail call i32 @strlen(i8* %3)
%6 = add nsw i32 %5, 60
%7 = sext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = add i64 %2, -1
%10 = sub i64 %2, %1
%11 = call i32 @snprintf(i8* %8, i64 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3, i64 %1, i64 %9, i64 %10)
%12 = call i32 @fputs(i8* %8, i32* %0)
ret void
}