#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 int32_t;

/* Variables and functions */
int /*<<< orphan*/ dumpio_mk_fname(char *, char *, char *, int, int);
int /*<<< orphan*/ dumpio_set_str(char *, char const *, int);
void dumpio_mk_fname_(char *fname, const char *base, const char *ext,
                      int32_t *i, int32_t *y, int32_t fname_len,
                      int32_t base_len, int32_t ext_len) {
  char _base[256];
  char _ext[16];
  int32_t _base_len = base_len;
  int32_t _ext_len = ext_len;
  if (_base_len > 256 - 1) {
    _base_len = 256 - 1;
  }
  if (_ext_len > 16 - 1) {
    _ext_len = 16 - 1;
  }
  dumpio_set_str(_base, base, _base_len);
  dumpio_set_str(_ext, ext, _ext_len);
  dumpio_mk_fname(fname, _base, _ext, *i, *y);
}


x86 assembly (clang, -O0):
<dumpio_mk_fname_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
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    0x10(%rbp),%eax
mov    %eax,-0x144(%rbp)
mov    0x18(%rbp),%eax
mov    %eax,-0x148(%rbp)
cmpl   $0xff,-0x144(%rbp)
jle    1175 <dumpio_mk_fname_+0x55>
movl   $0xff,-0x144(%rbp)
cmpl   $0xf,-0x148(%rbp)
jle    118c <dumpio_mk_fname_+0x6c>
movl   $0xf,-0x148(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x144(%rbp),%edx
call   1040 <dumpio_set_str@plt>
lea    -0x140(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x148(%rbp),%edx
call   1040 <dumpio_set_str@plt>
mov    -0x8(%rbp),%rdi
lea    -0x130(%rbp),%rsi
lea    -0x140(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    (%rax),%r8d
call   1030 <dumpio_mk_fname@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpio_mk_fname_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rdi,%r12
mov    0x158(%rsp),%eax
mov    0x150(%rsp),%ecx
cmp    $0xff,%ecx
mov    $0xff,%edx
cmovl  %ecx,%edx
cmp    $0xf,%eax
mov    $0xf,%ebp
cmovl  %eax,%ebp
lea    0x10(%rsp),%rdi
call   1040 <dumpio_set_str@plt>
mov    %rsp,%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <dumpio_set_str@plt>
mov    (%r15),%ecx
mov    (%r14),%r8d
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
mov    %r13,%rdx
call   1030 <dumpio_mk_fname@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @dumpio_mk_fname_(i8* %0, i8* %1, i8* %2, i32* %3, i32* %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [256 x i8]
%18 = alloca [16 x i8]
%19 = alloca i32
%20 = alloca i32
store i8* %0, i8** %9
store i8* %1, i8** %10
store i8* %2, i8** %11
store i32* %3, i32** %12
store i32* %4, i32** %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%21 = load i32, i32* %15
store i32 %21, i32* %19
%22 = load i32, i32* %16
store i32 %22, i32* %20
%23 = load i32, i32* %19
%24 = icmp sgt i32 %23, 255
br i1 %24, label %25, label %26
25: ; preds = %8
store i32 255, i32* %19
br label %26
26: ; preds = %25, %8
%27 = load i32, i32* %20
%28 = icmp sgt i32 %27, 15
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 15, i32* %20
br label %30
30: ; preds = %29, %26
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%32 = load i8*, i8** %10
%33 = load i32, i32* %19
%34 = call i32 @dumpio_set_str(i8* %31, i8* %32, i32 %33)
%35 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%36 = load i8*, i8** %11
%37 = load i32, i32* %20
%38 = call i32 @dumpio_set_str(i8* %35, i8* %36, i32 %37)
%39 = load i8*, i8** %9
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%41 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%42 = load i32*, i32** %12
%43 = load i32, i32* %42
%44 = load i32*, i32** %13
%45 = load i32, i32* %44
%46 = call i32 @dumpio_mk_fname(i8* %39, i8* %40, i8* %41, i32 %43, i32 %45)
ret void
}

LLVM IR (-O2):
define void @dumpio_mk_fname_(i8* %0, i8* %1, i8* %2, i32* nocapture %3, i32* nocapture %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca [256 x i8]
%10 = alloca [16 x i8]
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%13 = icmp slt i32 %6, 255
%14 = select i1 %13, i32 %6, i32 255
%15 = icmp slt i32 %7, 15
%16 = select i1 %15, i32 %7, i32 15
%17 = call i32 @dumpio_set_str(i8* %11, i8* %1, i32 %14)
%18 = call i32 @dumpio_set_str(i8* %12, i8* %2, i32 %16)
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @dumpio_mk_fname(i8* %0, i8* %11, i8* %12, i32 %19, i32 %20)
ret void
}