#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*/ ushort;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ write_usvector(int /*<<< orphan*/ *, long, long, char *,
                                  char *);
void write_usvector_k(ushort *v, long nl, long nh, char *format, char *filename,
                      int k) {
  static char filename_k[256];
  sprintf(filename_k, "%s%02d.txt", filename, k);
  write_usvector(v, nl, nh, format, filename_k);
}


x86 assembly (clang, -O0):
<write_usvector_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
lea    0x2ef2(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0x2ecf(%rip),%r8
call   1030 <write_usvector@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_usvector_k>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0x2f04(%rip),%r13
lea    0xebd(%rip),%rsi
mov    %r13,%rdi
mov    %r8,%rdx
mov    %r9d,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %r13,%r8
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <write_usvector@plt>

LLVM IR (-O0):
@write_usvector_k.filename_k = internal global [256 x i8] zeroinitializer
@.str = [11 x i8] c"%s%02d.txt\00"
define void @write_usvector_k(i32* %0, i64 %1, i64 %2, i8* %3, i8* %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i32* %0, i32** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%13 = load i8*, i8** %11
%14 = load i32, i32* %12
%15 = call i32 @sprintf(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @write_usvector_k.filename_k, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14)
%16 = load i32*, i32** %7
%17 = load i64, i64* %8
%18 = load i64, i64* %9
%19 = load i8*, i8** %10
%20 = call i32 @write_usvector(i32* %16, i64 %17, i64 %18, i8* %19, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @write_usvector_k.filename_k, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@write_usvector_k.filename_k = internal global [256 x i8] zeroinitializer
@.str = [11 x i8] c"%s%02d.txt\00"
define void @write_usvector_k(i32* %0, i64 %1, i64 %2, i8* %3, i8* %4, i32 %5) {
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @write_usvector_k.filename_k, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5)
%8 = tail call i32 @write_usvector(i32* %0, i64 %1, i64 %2, i8* %3, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @write_usvector_k.filename_k, i64 0, i64 0))
ret void
}