#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*/ sprintf(char *, char *, char *, ...);
int system(char *);
int get_coverage(char *input_filename, int depth) {
  int return_value;
  char system_command[1000];
  sprintf(system_command, "samtools mpileup %s > %s.pileup", input_filename,
          input_filename);
  return_value = system(system_command);
  sprintf(system_command,
          "cut -f1,2,4 %s.pileup | awk '{ if ($3 > %d) print }' > %s.tmp",
          input_filename, depth, input_filename);
  return_value = system(system_command);
  return return_value;
}


x86 assembly (clang, -O0):
<get_coverage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%r8
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_coverage>:
push   %rbp
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xec8(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <system@plt>
lea    0xec6(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <system@plt>
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"samtools mpileup %s > %s.pileup\00"
@.str.1 = [62 x i8] c"cut -f1,2,4 %s.pileup | awk '{ if ($3 > %d) print }' > %s.tmp\00"
define i32 @get_coverage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1000 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%12 = call i32 @system(i8* %11)
store i32 %12, i32* %5
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = load i8*, i8** %3
%17 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %15, i8* %16)
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%19 = call i32 @system(i8* %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
@.str = [32 x i8] c"samtools mpileup %s > %s.pileup\00"
@.str.1 = [62 x i8] c"cut -f1,2,4 %s.pileup | awk '{ if ($3 > %d) print }' > %s.tmp\00"
define i32 @get_coverage(i8* %0, i32 %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%6 = call i32 @system(i8* %4)
%7 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1, i8* %0)
%8 = call i32 @system(i8* %4)
ret i32 %8
}