int getvaluestat(char *s, char *arg, char *type, int *var) {
  int pos, inum;
  double *dbl;
  float *flt;
  char argt[10], *str, *symb[4];
  symb[0] = "=";
  symb[1] = ":";
  symb[2] = " =";
  symb[3] = " :";
  pos = 0;
  inum = 0;
  while (pos == 0 && inum < 4) {
    strcpy(argt, arg);
    strcat(argt, symb[inum]);
    pos = stringpos(s, argt);
    inum++;
  }
  if (pos == 0) {
    return (-1);
  }
  switch (type[0]) {
  case 'd':
    *var = atoi(&s[pos]);
    return (0);
  case 'f':
    flt = (float *)var;
    *flt = atof(&s[pos]);
    return (0);
  case 'F':
    dbl = (double *)var;
    *dbl = atof(&s[pos]);
    return (0);
  case 's':
    str = (char *)var;
    strcpy(str, &s[pos]);
    return (0);
  default:
    printf("WARNING: bad argument type \"%s\" found!\n", type);
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<getvaluestat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
lea    0xe6f(%rip),%rax
mov    %rax,-0x80(%rbp)
lea    0xe67(%rip),%rax
mov    %rax,-0x78(%rbp)
lea    0xe58(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe50(%rip),%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x81(%rbp)
jne    11e4 <getvaluestat+0x74>
cmpl   $0x4,-0x30(%rbp)
setl   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11f7 <getvaluestat+0x87>
jmp    1236 <getvaluestat+0xc6>
lea    -0x4a(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x4a(%rbp),%rdi
movslq -0x30(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
call   1080 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    -0x4a(%rbp),%rsi
mov    $0x0,%al
call   1060 <stringpos@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11c5 <getvaluestat+0x55>
cmpl   $0x0,-0x2c(%rbp)
jne    124c <getvaluestat+0xdc>
movl   $0xffffffff,-0x4(%rbp)
jmp    1371 <getvaluestat+0x201>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x88(%rbp)
sub    $0x46,%eax
je     12fb <getvaluestat+0x18b>
jmp    1267 <getvaluestat+0xf7>
mov    -0x88(%rbp),%eax
sub    $0x64,%eax
je     12a3 <getvaluestat+0x133>
jmp    127b <getvaluestat+0x10b>
mov    -0x88(%rbp),%eax
sub    $0x66,%eax
je     12c9 <getvaluestat+0x159>
jmp    128f <getvaluestat+0x11f>
mov    -0x88(%rbp),%eax
sub    $0x73,%eax
je     132d <getvaluestat+0x1bd>
jmp    1355 <getvaluestat+0x1e5>
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    $0x0,%al
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1371 <getvaluestat+0x201>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    $0x0,%al
call   1040 <atof@plt>
cvtsi2ss %eax,%xmm0
mov    -0x40(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1371 <getvaluestat+0x201>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x2c(%rbp),%rax
add    %rax,%rdi
mov    $0x0,%al
call   1040 <atof@plt>
cvtsi2sd %eax,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1371 <getvaluestat+0x201>
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x2c(%rbp),%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    1371 <getvaluestat+0x201>
mov    -0x20(%rbp),%rsi
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getvaluestat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,0x8(%rsp)
mov    %rdx,%r15
mov    %rsi,%r13
mov    %rdi,%r12
lea    0xe5e(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe55(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xe45(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0xe3c(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0x16(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movw   $0x3d,0x16(%rsp,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <stringpos@plt>
test   %eax,%eax
sete   %cl
jne    124c <getvaluestat+0xcc>
mov    $0x1,%r14d
lea    0x16(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp,%r14,8),%rbp
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <strcat@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <stringpos@plt>
test   %eax,%eax
sete   %cl
jne    124c <getvaluestat+0xcc>
lea    0x1(%r14),%rdx
cmp    $0x3,%r14
mov    %rdx,%r14
jb     1210 <getvaluestat+0x90>
mov    $0xffffffff,%ebx
test   %cl,%cl
je     1266 <getvaluestat+0xe6>
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movsbl (%r15),%ecx
cmp    $0x65,%ecx
jg     1293 <getvaluestat+0x113>
cmp    $0x46,%ecx
je     12b3 <getvaluestat+0x133>
cmp    $0x64,%ecx
jne    12f6 <getvaluestat+0x176>
cltq
add    %rax,%r12
xor    %ebx,%ebx
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <atoi@plt>
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
jmp    1255 <getvaluestat+0xd5>
cmp    $0x66,%ecx
je     12d3 <getvaluestat+0x153>
cmp    $0x73,%ecx
jne    12f6 <getvaluestat+0x176>
cltq
add    %rax,%r12
mov    0x8(%rsp),%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
xor    %ebx,%ebx
jmp    1255 <getvaluestat+0xd5>
cltq
add    %rax,%r12
xor    %ebx,%ebx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <atof@plt>
cvtsi2sd %eax,%xmm0
mov    0x8(%rsp),%rax
movsd  %xmm0,(%rax)
jmp    1255 <getvaluestat+0xd5>
cltq
add    %rax,%r12
xor    %ebx,%ebx
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <atof@plt>
cvtsi2ss %eax,%xmm0
mov    0x8(%rsp),%rax
movss  %xmm0,(%rax)
jmp    1255 <getvaluestat+0xd5>
lea    0xd09(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [3 x i8] c" =\00"
@.str.3 = [3 x i8] c" :\00"
@.str.4 = [40 x i8] c"WARNING: bad argument type \22%s\22 found!\0A\00"
define i32 @getvaluestat(i8* %0, i8* %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca float*
%14 = alloca [10 x i8]
%15 = alloca i8*
%16 = alloca [4 x i8*]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32* %3, i32** %9
%17 = getelementptr inbounds [4 x i8*], [4 x i8*]* %16, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [4 x i8*], [4 x i8*]* %16, i64 0, i64 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %18
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %16, i64 0, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %19
%20 = getelementptr inbounds [4 x i8*], [4 x i8*]* %16, i64 0, i64 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %20
store i32 0, i32* %10
store i32 0, i32* %11
br label %21
21: ; preds = %29, %4
%22 = load i32, i32* %10
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %11
%26 = icmp slt i32 %25, 4
br label %27
27: ; preds = %24, %21
%28 = phi i1 [ false, %21 ], [ %26, %24 ]
br i1 %28, label %29, label %44
29: ; preds = %27
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%31 = load i8*, i8** %7
%32 = call i8* @strcpy(i8* %30, i8* %31)
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i8*], [4 x i8*]* %16, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = call i8* @strcat(i8* %33, i8* %37)
%39 = load i8*, i8** %6
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%41 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @stringpos to i32 (i8*, i8*, ...)*)(i8* %39, i8* %40)
store i32 %41, i32* %10
%42 = load i32, i32* %11
%43 = add nsw i32 %42, 1
store i32 %43, i32* %11
br label %21
44: ; preds = %27
%45 = load i32, i32* %10
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %44
store i32 -1, i32* %5
br label %92
48: ; preds = %44
%49 = load i8*, i8** %8
%50 = getelementptr inbounds i8, i8* %49, i64 0
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
switch i32 %52, label %89 [
i32 100, label %53
i32 102, label %60
i32 70, label %70
i32 115, label %80
]
53: ; preds = %48
%54 = load i8*, i8** %6
%55 = load i32, i32* %10
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %54, i64 %56
%58 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %57)
%59 = load i32*, i32** %9
store i32 %58, i32* %59
store i32 0, i32* %5
br label %92
60: ; preds = %48
%61 = load i32*, i32** %9
%62 = bitcast i32* %61 to float*
store float* %62, float** %13
%63 = load i8*, i8** %6
%64 = load i32, i32* %10
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
%67 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %66)
%68 = sitofp i32 %67 to float
%69 = load float*, float** %13
store float %68, float* %69
store i32 0, i32* %5
br label %92
70: ; preds = %48
%71 = load i32*, i32** %9
%72 = bitcast i32* %71 to double*
store double* %72, double** %12
%73 = load i8*, i8** %6
%74 = load i32, i32* %10
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %76)
%78 = sitofp i32 %77 to double
%79 = load double*, double** %12
store double %78, double* %79
store i32 0, i32* %5
br label %92
80: ; preds = %48
%81 = load i32*, i32** %9
%82 = bitcast i32* %81 to i8*
store i8* %82, i8** %15
%83 = load i8*, i8** %15
%84 = load i8*, i8** %6
%85 = load i32, i32* %10
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = call i8* @strcpy(i8* %83, i8* %87)
store i32 0, i32* %5
br label %92
89: ; preds = %48
%90 = load i8*, i8** %8
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %90)
unreachable
92: ; preds = %80, %70, %60, %53, %47
%93 = load i32, i32* %5
ret i32 %93
}

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [3 x i8] c" =\00"
@.str.3 = [3 x i8] c" :\00"
@.str.4 = [40 x i8] c"WARNING: bad argument type \22%s\22 found!\0A\00"
define i32 @getvaluestat(i8* %0, i8* nocapture %1, i8* %2, i32* %3) {
%5 = alloca [10 x i8]
%6 = alloca [4 x i8*]
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%8 = bitcast [4 x i8*]* %6 to i8*
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %12
%13 = call i8* @strcpy(i8* %7, i8* dereferenceable(1) %1)
%14 = call i64 @strlen(i8* %7)
%15 = getelementptr [10 x i8], [10 x i8]* %5, i64 0, i64 %14
%16 = bitcast i8* %15 to i16*
store i16 61, i16* %16
%17 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @stringpos to i32 (i8*, i8*, ...)*)(i8* %0, i8* %7)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %4, %19
%20 = phi i64 [ %26, %19 ], [ 1, %4 ]
%21 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 %20
%22 = load i8*, i8** %21
%23 = call i8* @strcpy(i8* %7, i8* dereferenceable(1) %1)
%24 = call i8* @strcat(i8* %7, i8* dereferenceable(1) %22)
%25 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @stringpos to i32 (i8*, i8*, ...)*)(i8* %0, i8* %7)
%26 = add nuw nsw i64 %20, 1
%27 = icmp eq i32 %25, 0
%28 = icmp ult i64 %20, 3
%29 = select i1 %27, i1 %28, i1 false
br i1 %29, label %19, label %30
30: ; preds = %19, %4
%31 = phi i32 [ %17, %4 ], [ %25, %19 ]
%32 = phi i1 [ %18, %4 ], [ %27, %19 ]
br i1 %32, label %59, label %33
33: ; preds = %30
%34 = load i8, i8* %2
%35 = sext i8 %34 to i32
switch i32 %35, label %57 [
i32 100, label %36
i32 102, label %40
i32 70, label %46
i32 115, label %52
]
36: ; preds = %33
%37 = sext i32 %31 to i64
%38 = getelementptr inbounds i8, i8* %0, i64 %37
%39 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %38)
store i32 %39, i32* %3
br label %59
40: ; preds = %33
%41 = bitcast i32* %3 to float*
%42 = sext i32 %31 to i64
%43 = getelementptr inbounds i8, i8* %0, i64 %42
%44 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %43)
%45 = sitofp i32 %44 to float
store float %45, float* %41
br label %59
46: ; preds = %33
%47 = bitcast i32* %3 to double*
%48 = sext i32 %31 to i64
%49 = getelementptr inbounds i8, i8* %0, i64 %48
%50 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %49)
%51 = sitofp i32 %50 to double
store double %51, double* %47
br label %59
52: ; preds = %33
%53 = bitcast i32* %3 to i8*
%54 = sext i32 %31 to i64
%55 = getelementptr inbounds i8, i8* %0, i64 %54
%56 = call i8* @strcpy(i8* dereferenceable(1) %53, i8* %55)
br label %59
57: ; preds = %33
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %2)
unreachable
59: ; preds = %30, %52, %46, %40, %36
%60 = phi i32 [ 0, %52 ], [ 0, %46 ], [ 0, %40 ], [ 0, %36 ], [ -1, %30 ]
ret i32 %60
}