#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 PATH_MAX;
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const *, char *, int);
void verify_state_gen_name(char *out, size_t size, const char *name,
                           const char *prefix, int num) {
  char ename[PATH_MAX];
  char *ptr;
  ptr = ename;
  do {
    *ptr = *name;
    if (*ptr == '\0')
      break;
    else if (*ptr == '/')
      *ptr = '.';
    ptr++;
    name++;
  } while (1);
  snprintf(out, size, "%s-%s-%d-verify.state", prefix, ename, num);
  out[size - 1] = '\0';
}


x86 assembly (clang, -O0):
<verify_state_gen_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x30(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x48(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x38(%rbp)
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x40(%rbp),%rax
mov    %cl,(%rax)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    117f <verify_state_gen_name+0x6f>
jmp    11c2 <verify_state_gen_name+0xb2>
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1196 <verify_state_gen_name+0x86>
mov    -0x40(%rbp),%rax
movb   $0x2e,(%rax)
jmp    119b <verify_state_gen_name+0x8b>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    115e <verify_state_gen_name+0x4e>
jmp    11c2 <verify_state_gen_name+0xb2>
mov    -0x48(%rbp),%r8
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r9d
lea    0xe23(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_state_gen_name>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r9d
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2ec6(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r8
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r8
mov    %r8,%rsp
xor    %eax,%eax
jmp    1159 <verify_state_gen_name+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x2e,(%r8,%rax,1)
add    $0x1,%rax
movzbl (%rdx,%rax,1),%ebx
mov    %bl,(%r8,%rax,1)
cmp    $0x2f,%bl
je     1150 <verify_state_gen_name+0x40>
test   %bl,%bl
jne    1155 <verify_state_gen_name+0x45>
lea    0xe8f(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <snprintf@plt>
movb   $0x0,-0x1(%r14,%r15,1)
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [22 x i8] c"%s-%s-%d-verify.state\00"
define void @verify_state_gen_name(i8* %0, i64 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%14 = load i32, i32* @PATH_MAX
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %11
%17 = alloca i8, i64 %15
store i64 %15, i64* %12
store i8* %17, i8** %13
br label %18
18: ; preds = %40, %5
%19 = load i8*, i8** %8
%20 = load i8, i8* %19
%21 = load i8*, i8** %13
store i8 %20, i8* %21
%22 = load i8*, i8** %13
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %18
br label %41
27: ; preds = %18
%28 = load i8*, i8** %13
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 47
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = load i8*, i8** %13
store i8 46, i8* %33
br label %34
34: ; preds = %32, %27
br label %35
35: ; preds = %34
%36 = load i8*, i8** %13
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %13
%38 = load i8*, i8** %8
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %8
br label %40
40: ; preds = %35
br i1 true, label %18, label %41
41: ; preds = %40, %26
%42 = load i8*, i8** %6
%43 = load i64, i64* %7
%44 = load i8*, i8** %9
%45 = load i32, i32* %10
%46 = call i32 @snprintf(i8* %42, i64 %43, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %44, i8* %17, i32 %45)
%47 = load i8*, i8** %6
%48 = load i64, i64* %7
%49 = sub i64 %48, 1
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 0, i8* %50
%51 = load i8*, i8** %11
ret void
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [22 x i8] c"%s-%s-%d-verify.state\00"
define void @verify_state_gen_name(i8* %0, i64 %1, i8* nocapture %2, i8* %3, i32 %4) {
%6 = load i32, i32* @PATH_MAX
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
br label %9
9: ; preds = %14, %5
%10 = phi i8* [ %2, %5 ], [ %16, %14 ]
%11 = phi i8* [ %8, %5 ], [ %15, %14 ]
%12 = load i8, i8* %10
store i8 %12, i8* %11
switch i8 %12, label %14 [
i8 0, label %17
i8 47, label %13
]
13: ; preds = %9
store i8 46, i8* %11
br label %14
14: ; preds = %9, %13
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = getelementptr inbounds i8, i8* %10, i64 1
br label %9
17: ; preds = %9
%18 = call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %8, i32 %4)
%19 = add i64 %1, -1
%20 = getelementptr inbounds i8, i8* %0, i64 %19
store i8 0, i8* %20
ret void
}