#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 *, long, int, int, int);
void seed_name(char *res, long sf, int procs, int step) {
  int pow = 0;
  while (sf > 9) {
    pow++;
    sf /= 10;
  }
  sprintf(res, "%1d%1d%03X%03X", sf, pow, procs, step);
  return;
}


x86 assembly (clang, -O0):
<seed_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x9,-0x10(%rbp)
jle    1158 <seed_name+0x48>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
jmp    112d <seed_name+0x1d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe8e(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seed_name>:
mov    %ecx,%r9d
mov    %edx,%r8d
xor    %ecx,%ecx
cmp    $0xa,%rsi
jl     1152 <seed_name+0x42>
xor    %ecx,%ecx
movabs $0xcccccccccccccccd,%r10
cc cc cc
nopw   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %rsi,%rax
mul    %r10
shr    $0x3,%rdx
cmp    $0x63,%rsi
mov    %rdx,%rsi
ja     1130 <seed_name+0x20>
lea    0xeb3(%rip),%rsi
jmp    1030 <sprintf@plt>
mov    %rsi,%rdx
lea    0xea4(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%1d%1d%03X%03X\00"
define void @seed_name(i8* %0, i64 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %13, %4
%11 = load i64, i64* %6
%12 = icmp sgt i64 %11, 9
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %9
%15 = add nsw i32 %14, 1
store i32 %15, i32* %9
%16 = load i64, i64* %6
%17 = sdiv i64 %16, 10
store i64 %17, i64* %6
br label %10
18: ; preds = %10
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = load i32, i32* %9
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %20, i32 %21, i32 %22, i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%1d%1d%03X%03X\00"
define void @seed_name(i8* nocapture writeonly %0, i64 %1, i32 %2, i32 %3) {
%5 = icmp sgt i64 %1, 9
br i1 %5, label %6, label %12
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ 0, %4 ]
%8 = phi i64 [ %10, %6 ], [ %1, %4 ]
%9 = add nuw nsw i32 %7, 1
%10 = udiv i64 %8, 10
%11 = icmp ugt i64 %8, 99
br i1 %11, label %6, label %12
12: ; preds = %6, %4
%13 = phi i64 [ %1, %4 ], [ %10, %6 ]
%14 = phi i32 [ 0, %4 ], [ %9, %6 ]
%15 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %13, i32 %14, i32 %2, i32 %3)
ret void
}