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

/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ logError(char *, int, ...);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int sprintf(char *, char *, char const *, char const *, ...);
char *strchr(char const *, char);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char const *);
int fdfs_gen_slave_filename(const char *master_filename,
                            const char *prefix_name, const char *ext_name,
                            char *filename, int *filename_len) {
  char true_ext_name[6 + 2];
  char *pDot;
  int master_file_len;
  master_file_len = strlen(master_filename);
  if (master_file_len < 28 + 6) {
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/fdfs_global.c"
             ", line: %d, "
             "master filename \"%s\" is invalid",
             84, master_filename);
    return EINVAL;
  }
  pDot = strchr(master_filename + (master_file_len - (6 + 1)), '.');
  if (ext_name != NULL) {
    if (*ext_name == '\0') {
      *true_ext_name = '\0';
    } else if (*ext_name == '.') {
      snprintf(true_ext_name, sizeof(true_ext_name), "%s", ext_name);
    } else {
      snprintf(true_ext_name, sizeof(true_ext_name), ".%s", ext_name);
    }
  } else {
    if (pDot == NULL) {
      *true_ext_name = '\0';
    } else {
      strcpy(true_ext_name, pDot);
    }
  }
  if (*true_ext_name == '\0' && strcmp(prefix_name, "-m") == 0) {
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/fdfs_global.c"
             ", line: %d, "
             "prefix_name \"%s\" is invalid",
             124, prefix_name);
    return EINVAL;
  }
  if ((*prefix_name == '\0') &&
      ((pDot == NULL && *true_ext_name == '\0') ||
       (pDot != NULL && strcmp(pDot, true_ext_name) == 0))) {
    logError("file: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/"
             "fastdfs-5.01/common/fdfs_global.c"
             ", line: %d, "
             "empty prefix_name is not allowed",
             135);
    return EINVAL;
  }
  if (pDot == NULL) {
    *filename_len = sprintf(filename, "%s%s%s", master_filename, prefix_name,
                            true_ext_name);
  } else {
    *filename_len = pDot - master_filename;
    memcpy(filename, master_filename, *filename_len);
    *filename_len +=
        sprintf(filename + *filename_len, "%s%s", prefix_name, true_ext_name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<fdfs_gen_slave_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x22,-0x44(%rbp)
jge    11da <fdfs_gen_slave_filename+0x5a>
mov    -0x10(%rbp),%rdx
lea    0xe43(%rip),%rdi
mov    $0x54,%esi
mov    $0x0,%al
call   1070 <logError@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13e0 <fdfs_gen_slave_filename+0x260>
mov    -0x10(%rbp),%rdi
mov    -0x44(%rbp),%eax
sub    $0x7,%eax
cltq
add    %rax,%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     126c <fdfs_gen_slave_filename+0xec>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    121b <fdfs_gen_slave_filename+0x9b>
movb   $0x0,-0x38(%rbp)
jmp    1267 <fdfs_gen_slave_filename+0xe7>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1249 <fdfs_gen_slave_filename+0xc9>
lea    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x8,%esi
lea    0xe92(%rip),%rdx
call   1060 <snprintf@plt>
jmp    1262 <fdfs_gen_slave_filename+0xe2>
lea    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x8,%esi
lea    0xe73(%rip),%rdx
call   1060 <snprintf@plt>
jmp    1267 <fdfs_gen_slave_filename+0xe7>
jmp    1292 <fdfs_gen_slave_filename+0x112>
cmpq   $0x0,-0x40(%rbp)
jne    1280 <fdfs_gen_slave_filename+0x100>
movb   $0x0,-0x38(%rbp)
jmp    128d <fdfs_gen_slave_filename+0x10d>
lea    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1292 <fdfs_gen_slave_filename+0x112>
movsbl -0x38(%rbp),%eax
cmp    $0x0,%eax
jne    12e1 <fdfs_gen_slave_filename+0x161>
mov    -0x18(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12e1 <fdfs_gen_slave_filename+0x161>
mov    -0x18(%rbp),%rdx
lea    0xe13(%rip),%rdi
mov    $0x7c,%esi
mov    $0x0,%al
call   1070 <logError@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13e0 <fdfs_gen_slave_filename+0x260>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    134f <fdfs_gen_slave_filename+0x1cf>
cmpq   $0x0,-0x40(%rbp)
jne    1309 <fdfs_gen_slave_filename+0x189>
movsbl -0x38(%rbp),%eax
cmp    $0x0,%eax
je     132b <fdfs_gen_slave_filename+0x1ab>
cmpq   $0x0,-0x40(%rbp)
je     134f <fdfs_gen_slave_filename+0x1cf>
mov    -0x40(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    134f <fdfs_gen_slave_filename+0x1cf>
lea    0xe71(%rip),%rdi
mov    $0x87,%esi
mov    $0x0,%al
call   1070 <logError@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13e0 <fdfs_gen_slave_filename+0x260>
cmpq   $0x0,-0x40(%rbp)
jne    1385 <fdfs_gen_slave_filename+0x205>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x38(%rbp),%r8
lea    0xf03(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
jmp    13d9 <fdfs_gen_slave_filename+0x259>
mov    -0x40(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   1090 <memcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rax
movslq (%rax),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdfs_gen_slave_filename>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x21,%eax
jg     11c8 <fdfs_gen_slave_filename+0x48>
lea    0xe55(%rip),%rdi
mov    $0x54,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <logError@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
jmp    12df <fdfs_gen_slave_filename+0x15f>
add    $0xfffffff9,%eax
add    %rbx,%rax
mov    %rax,%rdi
mov    $0x2e,%esi
call   1050 <strchr@plt>
mov    %rax,%r13
test   %rbp,%rbp
je     11f7 <fdfs_gen_slave_filename+0x77>
mov    0x0(%rbp),%al
cmp    $0x2e,%al
je     1215 <fdfs_gen_slave_filename+0x95>
test   %al,%al
je     120f <fdfs_gen_slave_filename+0x8f>
lea    0xedb(%rip),%rdx
jmp    121c <fdfs_gen_slave_filename+0x9c>
test   %r13,%r13
je     120f <fdfs_gen_slave_filename+0x8f>
mov    %rsp,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
cmpb   $0x0,(%rsp)
jne    124a <fdfs_gen_slave_filename+0xca>
jmp    1232 <fdfs_gen_slave_filename+0xb2>
movb   $0x0,(%rsp)
jmp    1232 <fdfs_gen_slave_filename+0xb2>
lea    0xeb5(%rip),%rdx
mov    %rsp,%rdi
mov    $0x8,%esi
mov    %rbp,%rcx
call   1060 <snprintf@plt>
cmpb   $0x0,(%rsp)
jne    124a <fdfs_gen_slave_filename+0xca>
lea    0xe9b(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     12ee <fdfs_gen_slave_filename+0x16e>
cmpb   $0x0,(%r15)
je     1288 <fdfs_gen_slave_filename+0x108>
test   %r13,%r13
je     12c0 <fdfs_gen_slave_filename+0x140>
sub    %ebx,%r13d
mov    %r13d,(%r14)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
call   1090 <memcpy@plt>
movslq (%r14),%rdi
add    %r12,%rdi
lea    0x1000(%rip),%rsi
mov    %rsp,%rcx
mov    %r15,%rdx
xor    %eax,%eax
call   10a0 <sprintf@plt>
add    (%r14),%eax
jmp    12da <fdfs_gen_slave_filename+0x15a>
test   %r13,%r13
jne    1293 <fdfs_gen_slave_filename+0x113>
cmpb   $0x0,(%rsp)
je     12a8 <fdfs_gen_slave_filename+0x128>
test   %r13,%r13
je     12c0 <fdfs_gen_slave_filename+0x140>
mov    %rsp,%rsi
mov    %r13,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1255 <fdfs_gen_slave_filename+0xd5>
lea    0xef4(%rip),%rdi
mov    $0x87,%esi
xor    %eax,%eax
call   1070 <logError@plt>
jmp    11ba <fdfs_gen_slave_filename+0x3a>
lea    0xfad(%rip),%rsi
mov    %rsp,%r8
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde2(%rip),%rdi
mov    $0x7c,%esi
mov    %r15,%rdx
jmp    11b3 <fdfs_gen_slave_filename+0x33>

LLVM IR (-O0):
@.str = [208 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, master filename \22%s\22 is invalid\00"
@EINVAL = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c".%s\00"
@.str.3 = [3 x i8] c"-m\00"
@.str.4 = [204 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, prefix_name \22%s\22 is invalid\00"
@.str.5 = [209 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, empty prefix_name is not allowed\00"
@.str.6 = [7 x i8] c"%s%s%s\00"
@.str.7 = [5 x i8] c"%s%s\00"
define i32 @fdfs_gen_slave_filename(i8* %0, i8* %1, i8* %2, i8* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca [8 x i8]
%13 = alloca i8*
%14 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
%15 = load i8*, i8** %7
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %14
%17 = load i32, i32* %14
%18 = icmp slt i32 %17, 34
br i1 %18, label %19, label %23
19: ; preds = %5
%20 = load i8*, i8** %7
%21 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([208 x i8], [208 x i8]* @.str, i64 0, i64 0), i32 84, i8* %20)
%22 = load i32, i32* @EINVAL
store i32 %22, i32* %6
br label %136
23: ; preds = %5
%24 = load i8*, i8** %7
%25 = load i32, i32* %14
%26 = sub nsw i32 %25, 7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
%29 = call i8* @strchr(i8* %28, i8 signext 46)
store i8* %29, i8** %13
%30 = load i8*, i8** %9
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %54
32: ; preds = %23
%33 = load i8*, i8** %9
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
store i8 0, i8* %38
br label %53
39: ; preds = %32
%40 = load i8*, i8** %9
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 46
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%46 = load i8*, i8** %9
%47 = call i32 @snprintf(i8* %45, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %46)
br label %52
48: ; preds = %39
%49 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%50 = load i8*, i8** %9
%51 = call i32 @snprintf(i8* %49, i32 8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %48, %44
br label %53
53: ; preds = %52, %37
br label %64
54: ; preds = %23
%55 = load i8*, i8** %13
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
store i8 0, i8* %58
br label %63
59: ; preds = %54
%60 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%61 = load i8*, i8** %13
%62 = call i32 @strcpy(i8* %60, i8* %61)
br label %63
63: ; preds = %59, %57
br label %64
64: ; preds = %63, %53
%65 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %77
69: ; preds = %64
%70 = load i8*, i8** %8
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %77
73: ; preds = %69
%74 = load i8*, i8** %8
%75 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str.4, i64 0, i64 0), i32 124, i8* %74)
%76 = load i32, i32* @EINVAL
store i32 %76, i32* %6
br label %136
77: ; preds = %69, %64
%78 = load i8*, i8** %8
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %101
82: ; preds = %77
%83 = load i8*, i8** %13
%84 = icmp eq i8* %83, null
br i1 %84, label %85, label %90
85: ; preds = %82
%86 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 0
br i1 %89, label %98, label %90
90: ; preds = %85, %82
%91 = load i8*, i8** %13
%92 = icmp ne i8* %91, null
br i1 %92, label %93, label %101
93: ; preds = %90
%94 = load i8*, i8** %13
%95 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%96 = call i64 @strcmp(i8* %94, i8* %95)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %93, %85
%99 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([209 x i8], [209 x i8]* @.str.5, i64 0, i64 0), i32 135)
%100 = load i32, i32* @EINVAL
store i32 %100, i32* %6
br label %136
101: ; preds = %93, %90, %77
%102 = load i8*, i8** %13
%103 = icmp eq i8* %102, null
br i1 %103, label %104, label %111
104: ; preds = %101
%105 = load i8*, i8** %10
%106 = load i8*, i8** %7
%107 = load i8*, i8** %8
%108 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%109 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %105, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %106, i8* %107, i8* %108)
%110 = load i32*, i32** %11
store i32 %109, i32* %110
br label %135
111: ; preds = %101
%112 = load i8*, i8** %13
%113 = load i8*, i8** %7
%114 = ptrtoint i8* %112 to i64
%115 = ptrtoint i8* %113 to i64
%116 = sub i64 %114, %115
%117 = trunc i64 %116 to i32
%118 = load i32*, i32** %11
store i32 %117, i32* %118
%119 = load i8*, i8** %10
%120 = load i8*, i8** %7
%121 = load i32*, i32** %11
%122 = load i32, i32* %121
%123 = call i32 @memcpy(i8* %119, i8* %120, i32 %122)
%124 = load i8*, i8** %10
%125 = load i32*, i32** %11
%126 = load i32, i32* %125
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8, i8* %124, i64 %127
%129 = load i8*, i8** %8
%130 = getelementptr inbounds [8 x i8], [8 x i8]* %12, i64 0, i64 0
%131 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %128, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %129, i8* %130)
%132 = load i32*, i32** %11
%133 = load i32, i32* %132
%134 = add nsw i32 %133, %131
store i32 %134, i32* %132
br label %135
135: ; preds = %111, %104
store i32 0, i32* %6
br label %136
136: ; preds = %135, %98, %73, %19
%137 = load i32, i32* %6
ret i32 %137
}

LLVM IR (-O2):
@.str = [208 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, master filename \22%s\22 is invalid\00"
@EINVAL = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c".%s\00"
@.str.3 = [3 x i8] c"-m\00"
@.str.4 = [204 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, prefix_name \22%s\22 is invalid\00"
@.str.5 = [209 x i8] c"file: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fatedier/studies/refs/heads/master/fastdfs-5.01/common/fdfs_global.c, line: %d, empty prefix_name is not allowed\00"
@.str.6 = [7 x i8] c"%s%s%s\00"
@.str.7 = [5 x i8] c"%s%s\00"
define i32 @fdfs_gen_slave_filename(i8* %0, i8* %1, i8* %2, i8* %3, i32* nocapture %4) {
%6 = alloca [8 x i8]
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %6, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp slt i32 %8, 34
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = tail call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([208 x i8], [208 x i8]* @.str, i64 0, i64 0), i32 84, i8* %0)
%12 = load i32, i32* @EINVAL
br label %72
13: ; preds = %5
%14 = add nsw i32 %8, -7
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = tail call i8* @strchr(i8* dereferenceable(1) %16, i8 signext 46)
%18 = icmp eq i8* %2, null
br i1 %18, label %26, label %19
19: ; preds = %13
%20 = load i8, i8* %2
switch i8 %20, label %24 [
i8 0, label %21
i8 46, label %22
]
21: ; preds = %19
store i8 0, i8* %7
br label %34
22: ; preds = %19
%23 = call i32 @snprintf(i8* %7, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %31
24: ; preds = %19
%25 = call i32 @snprintf(i8* %7, i32 8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %31
26: ; preds = %13
%27 = icmp eq i8* %17, null
br i1 %27, label %28, label %29
28: ; preds = %26
store i8 0, i8* %7
br label %34
29: ; preds = %26
%30 = call i32 @strcpy(i8* %7, i8* %17)
br label %31
31: ; preds = %29, %24, %22
%32 = load i8, i8* %7
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %21, %28, %31
%35 = call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str.4, i64 0, i64 0), i32 124, i8* %1)
%39 = load i32, i32* @EINVAL
br label %72
40: ; preds = %34, %31
%41 = load i8, i8* %1
%42 = icmp eq i8 %41, 0
%43 = icmp eq i8* %17, null
br i1 %42, label %44, label %55
44: ; preds = %40
%45 = load i8, i8* %7
%46 = icmp eq i8 %45, 0
%47 = select i1 %43, i1 %46, i1 false
br i1 %47, label %52, label %48
48: ; preds = %44
br i1 %43, label %56, label %49
49: ; preds = %48
%50 = call i64 @strcmp(i8* %17, i8* %7)
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %44, %49
%53 = call i32 (i8*, i32, ...) @logError(i8* getelementptr inbounds ([209 x i8], [209 x i8]* @.str.5, i64 0, i64 0), i32 135)
%54 = load i32, i32* @EINVAL
br label %72
55: ; preds = %40
br i1 %43, label %56, label %58
56: ; preds = %48, %55
%57 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %0, i8* %1, i8* %7)
br label %70
58: ; preds = %49, %55
%59 = ptrtoint i8* %17 to i64
%60 = ptrtoint i8* %0 to i64
%61 = sub i64 %59, %60
%62 = trunc i64 %61 to i32
store i32 %62, i32* %4
%63 = call i32 @memcpy(i8* %3, i8* %0, i32 %62)
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %3, i64 %65
%67 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %66, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %1, i8* %7)
%68 = load i32, i32* %4
%69 = add nsw i32 %68, %67
br label %70
70: ; preds = %58, %56
%71 = phi i32 [ %69, %58 ], [ %57, %56 ]
store i32 %71, i32* %4
br label %72
72: ; preds = %70, %52, %37, %10
%73 = phi i32 [ %12, %10 ], [ %39, %37 ], [ %54, %52 ], [ 0, %70 ]
ret i32 %73
}