#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 */
char *dynamic_cat(char *, size_t *, char *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ sscanf(char *, char *, char *, int *);
int /*<<< orphan*/ strcat(char *, char *);
int read_numeric(char *s[], char *rezult[], size_t *rezult_size, char delim[]) {
  int read_dot = 0;
  int num_read;
  char tmp[128 * 2];
  if (**s == '-' && *(*s + 1) == '.') {
    read_dot = 1;
    tmp[0] = '-';
    tmp[1] = '.';
    *s += 2;
    sscanf(*s, "%[0-9] %n", &tmp[2], &num_read);
  } else if (**s == '-') {
    tmp[0] = '-';
    ++*s;
    sscanf(*s, "%[0-9] %n", &tmp[1], &num_read);
  } else if (**s == '.') {
    read_dot = 1;
    tmp[0] = '.';
    ++*s;
    sscanf(*s, "%[0-9] %n", &tmp[1], &num_read);
  } else {
    sscanf(*s, "%[0-9] %n", tmp, &num_read);
  }
  *s += num_read;
  if (!read_dot && **s == '.' && isdigit(*(*s + 1))) {
    *s += 1;
    char postdot[128];
    sscanf(*s, "%[0-9] %n", postdot, &num_read);
    *s += num_read;
    strcat(tmp, ".");
    strcat(tmp, postdot);
  }
  char *test;
  if (!(test = dynamic_cat(*rezult, rezult_size, tmp)))
    return -1;
  else
    *rezult = test;
  if (!(test = dynamic_cat(*rezult, rezult_size, delim)))
    return -1;
  else
    *rezult = test;
  return 0;
}


x86 assembly (clang, -O0):
<read_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11d3 <read_numeric+0x93>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    11d3 <read_numeric+0x93>
movl   $0x1,-0x2c(%rbp)
movb   $0x2d,-0x130(%rbp)
movb   $0x2e,-0x12f(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x130(%rbp),%rdx
add    $0x2,%rdx
lea    0xe3b(%rip),%rsi
lea    -0x30(%rbp),%rcx
call   1040 <sscanf@plt>
jmp    12a0 <read_numeric+0x160>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1222 <read_numeric+0xe2>
movb   $0x2d,-0x130(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x130(%rbp),%rdx
add    $0x1,%rdx
lea    0xdec(%rip),%rsi
lea    -0x30(%rbp),%rcx
call   1040 <sscanf@plt>
jmp    129b <read_numeric+0x15b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1278 <read_numeric+0x138>
movl   $0x1,-0x2c(%rbp)
movb   $0x2e,-0x130(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x130(%rbp),%rdx
add    $0x1,%rdx
lea    0xd96(%rip),%rsi
lea    -0x30(%rbp),%rcx
call   1040 <sscanf@plt>
jmp    1296 <read_numeric+0x156>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x130(%rbp),%rdx
lea    0xd73(%rip),%rsi
lea    -0x30(%rbp),%rcx
call   1040 <sscanf@plt>
jmp    129b <read_numeric+0x15b>
jmp    12a0 <read_numeric+0x160>
mov    -0x30(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
cmpl   $0x0,-0x2c(%rbp)
jne    134f <read_numeric+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    134f <read_numeric+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     134f <read_numeric+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x1b0(%rbp),%rdx
lea    0xcf3(%rip),%rsi
lea    -0x30(%rbp),%rcx
call   1040 <sscanf@plt>
mov    -0x30(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
lea    -0x130(%rbp),%rdi
lea    0xcd3(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x130(%rbp),%rdx
call   1060 <dynamic_cat@plt>
mov    %rax,-0x1b8(%rbp)
cmp    $0x0,%rax
jne    1383 <read_numeric+0x243>
movl   $0xffffffff,-0x4(%rbp)
jmp    13d7 <read_numeric+0x297>
mov    -0x1b8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1060 <dynamic_cat@plt>
mov    %rax,-0x1b8(%rbp)
cmp    $0x0,%rax
jne    13c2 <read_numeric+0x282>
movl   $0xffffffff,-0x4(%rbp)
jmp    13d7 <read_numeric+0x297>
mov    -0x1b8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_numeric>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x190,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    (%rdi),%al
cmp    $0x2e,%al
je     1180 <read_numeric+0x40>
cmp    $0x2d,%al
jne    11b6 <read_numeric+0x76>
cmpb   $0x2e,0x1(%rdi)
movb   $0x2d,0x10(%rsp)
jne    11c4 <read_numeric+0x84>
movb   $0x2e,0x11(%rsp)
mov    $0x2,%eax
jmp    118a <read_numeric+0x4a>
movb   $0x2e,0x10(%rsp)
mov    $0x1,%eax
add    %rax,%rdi
mov    %rdi,(%rbx)
lea    (%rsp,%rax,1),%rdx
add    $0x10,%rdx
lea    0xe61(%rip),%rsi
lea    0xc(%rsp),%rcx
call   1040 <sscanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,(%rbx)
jmp    1251 <read_numeric+0x111>
lea    0xe43(%rip),%rsi
lea    0x10(%rsp),%rdx
jmp    11d7 <read_numeric+0x97>
add    $0x1,%rdi
mov    %rdi,(%rbx)
lea    0x11(%rsp),%rdx
lea    0xe29(%rip),%rsi
lea    0xc(%rsp),%rcx
call   1040 <sscanf@plt>
movslq 0xc(%rsp),%rcx
mov    (%rbx),%rdx
lea    (%rdx,%rcx,1),%rax
mov    %rax,(%rbx)
cmpb   $0x2e,(%rdx,%rcx,1)
jne    1251 <read_numeric+0x111>
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1251 <read_numeric+0x111>
mov    (%rbx),%rdi
add    $0x1,%rdi
mov    %rdi,(%rbx)
lea    0xdeb(%rip),%rsi
lea    0x110(%rsp),%r13
lea    0xc(%rsp),%rcx
mov    %r13,%rdx
call   1040 <sscanf@plt>
movslq 0xc(%rsp),%rax
add    %rax,(%rbx)
lea    0xdd1(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcat@plt>
mov    (%r12),%rdi
lea    0x10(%rsp),%rdx
mov    %r15,%rsi
call   1060 <dynamic_cat@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
je     1289 <read_numeric+0x149>
mov    %rax,(%r12)
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <dynamic_cat@plt>
test   %rax,%rax
je     1289 <read_numeric+0x149>
mov    %rax,(%r12)
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%[0-9] %n\00"
@.str.1 = [2 x i8] c".\00"
define i32 @read_numeric(i8** %0, i8** %1, i64* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i64*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [256 x i8]
%13 = alloca [128 x i8]
%14 = alloca i8*
store i8** %0, i8*** %6
store i8** %1, i8*** %7
store i64* %2, i64** %8
store i8* %3, i8** %9
store i32 0, i32* %10
%15 = load i8**, i8*** %6
%16 = load i8*, i8** %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 45
br i1 %19, label %20, label %37
20: ; preds = %4
%21 = load i8**, i8*** %6
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 46
br i1 %26, label %27, label %37
27: ; preds = %20
store i32 1, i32* %10
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
store i8 45, i8* %28
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 1
store i8 46, i8* %29
%30 = load i8**, i8*** %6
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i64 2
store i8* %32, i8** %30
%33 = load i8**, i8*** %6
%34 = load i8*, i8** %33
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 2
%36 = call i32 @sscanf(i8* %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %35, i32* %11)
br label %74
37: ; preds = %20, %4
%38 = load i8**, i8*** %6
%39 = load i8*, i8** %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 45
br i1 %42, label %43, label %52
43: ; preds = %37
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
store i8 45, i8* %44
%45 = load i8**, i8*** %6
%46 = load i8*, i8** %45
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %45
%48 = load i8**, i8*** %6
%49 = load i8*, i8** %48
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 1
%51 = call i32 @sscanf(i8* %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %50, i32* %11)
br label %73
52: ; preds = %37
%53 = load i8**, i8*** %6
%54 = load i8*, i8** %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 46
br i1 %57, label %58, label %67
58: ; preds = %52
store i32 1, i32* %10
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
store i8 46, i8* %59
%60 = load i8**, i8*** %6
%61 = load i8*, i8** %60
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %60
%63 = load i8**, i8*** %6
%64 = load i8*, i8** %63
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 1
%66 = call i32 @sscanf(i8* %64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %65, i32* %11)
br label %72
67: ; preds = %52
%68 = load i8**, i8*** %6
%69 = load i8*, i8** %68
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%71 = call i32 @sscanf(i8* %69, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %70, i32* %11)
br label %72
72: ; preds = %67, %58
br label %73
73: ; preds = %72, %43
br label %74
74: ; preds = %73, %27
%75 = load i32, i32* %11
%76 = load i8**, i8*** %6
%77 = load i8*, i8** %76
%78 = sext i32 %75 to i64
%79 = getelementptr inbounds i8, i8* %77, i64 %78
store i8* %79, i8** %76
%80 = load i32, i32* %10
%81 = icmp ne i32 %80, 0
br i1 %81, label %113, label %82
82: ; preds = %74
%83 = load i8**, i8*** %6
%84 = load i8*, i8** %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp eq i32 %86, 46
br i1 %87, label %88, label %113
88: ; preds = %82
%89 = load i8**, i8*** %6
%90 = load i8*, i8** %89
%91 = getelementptr inbounds i8, i8* %90, i64 1
%92 = load i8, i8* %91
%93 = call i64 @isdigit(i8 signext %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %113
95: ; preds = %88
%96 = load i8**, i8*** %6
%97 = load i8*, i8** %96
%98 = getelementptr inbounds i8, i8* %97, i64 1
store i8* %98, i8** %96
%99 = load i8**, i8*** %6
%100 = load i8*, i8** %99
%101 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%102 = call i32 @sscanf(i8* %100, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %101, i32* %11)
%103 = load i32, i32* %11
%104 = load i8**, i8*** %6
%105 = load i8*, i8** %104
%106 = sext i32 %103 to i64
%107 = getelementptr inbounds i8, i8* %105, i64 %106
store i8* %107, i8** %104
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%109 = call i32 @strcat(i8* %108, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%110 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%111 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%112 = call i32 @strcat(i8* %110, i8* %111)
br label %113
113: ; preds = %95, %88, %82, %74
%114 = load i8**, i8*** %7
%115 = load i8*, i8** %114
%116 = load i64*, i64** %8
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%118 = call i8* @dynamic_cat(i8* %115, i64* %116, i8* %117)
store i8* %118, i8** %14
%119 = icmp ne i8* %118, null
br i1 %119, label %121, label %120
120: ; preds = %113
store i32 -1, i32* %5
br label %136
121: ; preds = %113
%122 = load i8*, i8** %14
%123 = load i8**, i8*** %7
store i8* %122, i8** %123
br label %124
124: ; preds = %121
%125 = load i8**, i8*** %7
%126 = load i8*, i8** %125
%127 = load i64*, i64** %8
%128 = load i8*, i8** %9
%129 = call i8* @dynamic_cat(i8* %126, i64* %127, i8* %128)
store i8* %129, i8** %14
%130 = icmp ne i8* %129, null
br i1 %130, label %132, label %131
131: ; preds = %124
store i32 -1, i32* %5
br label %136
132: ; preds = %124
%133 = load i8*, i8** %14
%134 = load i8**, i8*** %7
store i8* %133, i8** %134
br label %135
135: ; preds = %132
store i32 0, i32* %5
br label %136
136: ; preds = %135, %131, %120
%137 = load i32, i32* %5
ret i32 %137
}

LLVM IR (-O2):
@.str = [10 x i8] c"%[0-9] %n\00"
@.str.1 = [2 x i8] c".\00"
define i32 @read_numeric(i8** nocapture %0, i8** nocapture %1, i64* %2, i8* %3) {
%5 = alloca i32
%6 = alloca [256 x i8]
%7 = alloca [128 x i8]
%8 = bitcast i32* %5 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = load i8*, i8** %0
%11 = load i8, i8* %10
switch i8 %11, label %22 [
i8 45, label %12
i8 46, label %21
]
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %10, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 46
store i8 45, i8* %9
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 1
store i8 46, i8* %17
br label %24
18: ; preds = %12
store i8* %13, i8** %0
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 1
%20 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %19, i32* %5)
br label %33
21: ; preds = %4
store i8 46, i8* %9
br label %24
22: ; preds = %4
%23 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %9, i32* %5)
br label %33
24: ; preds = %21, %16
%25 = phi i64 [ 1, %21 ], [ 2, %16 ]
%26 = getelementptr inbounds i8, i8* %10, i64 %25
store i8* %26, i8** %0
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %25
%28 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %27, i32* %5)
%29 = load i32, i32* %5
%30 = load i8*, i8** %0
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %30, i64 %31
store i8* %32, i8** %0
br label %56
33: ; preds = %18, %22
%34 = load i32, i32* %5
%35 = load i8*, i8** %0
%36 = sext i32 %34 to i64
%37 = getelementptr inbounds i8, i8* %35, i64 %36
store i8* %37, i8** %0
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 46
br i1 %39, label %40, label %56
40: ; preds = %33
%41 = getelementptr inbounds i8, i8* %37, i64 1
%42 = load i8, i8* %41
%43 = call i64 @isdigit(i8 signext %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %56, label %45
45: ; preds = %40
%46 = load i8*, i8** %0
%47 = getelementptr inbounds i8, i8* %46, i64 1
store i8* %47, i8** %0
%48 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%49 = call i32 @sscanf(i8* %47, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %48, i32* %5)
%50 = load i32, i32* %5
%51 = load i8*, i8** %0
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds i8, i8* %51, i64 %52
store i8* %53, i8** %0
%54 = call i32 @strcat(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%55 = call i32 @strcat(i8* %9, i8* %48)
br label %56
56: ; preds = %24, %45, %40, %33
%57 = load i8*, i8** %1
%58 = call i8* @dynamic_cat(i8* %57, i64* %2, i8* %9)
%59 = icmp eq i8* %58, null
br i1 %59, label %64, label %60
60: ; preds = %56
store i8* %58, i8** %1
%61 = call i8* @dynamic_cat(i8* %58, i64* %2, i8* %3)
%62 = icmp eq i8* %61, null
br i1 %62, label %64, label %63
63: ; preds = %60
store i8* %61, i8** %1
br label %64
64: ; preds = %60, %56, %63
%65 = phi i32 [ 0, %63 ], [ -1, %56 ], [ -1, %60 ]
ret i32 %65
}