int getvalue(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) {
    printf("Variable \"%s\" not found!\n", arg);
    exit(-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):
<getvalue>:
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 <getvalue+0x74>
cmpl   $0x4,-0x30(%rbp)
setl   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11f7 <getvalue+0x87>
jmp    1236 <getvalue+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 <getvalue+0x55>
cmpl   $0x0,-0x2c(%rbp)
jne    125c <getvalue+0xec>
mov    -0x18(%rbp),%rsi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x88(%rbp)
sub    $0x46,%eax
je     130b <getvalue+0x19b>
jmp    1277 <getvalue+0x107>
mov    -0x88(%rbp),%eax
sub    $0x64,%eax
je     12b3 <getvalue+0x143>
jmp    128b <getvalue+0x11b>
mov    -0x88(%rbp),%eax
sub    $0x66,%eax
je     12d9 <getvalue+0x169>
jmp    129f <getvalue+0x12f>
mov    -0x88(%rbp),%eax
sub    $0x73,%eax
je     133d <getvalue+0x1cd>
jmp    1365 <getvalue+0x1f5>
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    1381 <getvalue+0x211>
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    1381 <getvalue+0x211>
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    1381 <getvalue+0x211>
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    1381 <getvalue+0x211>
mov    -0x20(%rbp),%rsi
lea    0xcb0(%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):
<getvalue>:
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 <getvalue+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 <getvalue+0xcc>
lea    0x1(%r14),%rdx
cmp    $0x3,%r14
mov    %rdx,%r14
jb     1210 <getvalue+0x90>
test   %cl,%cl
jne    12ec <getvalue+0x16c>
movsbl (%r15),%ecx
cmp    $0x65,%ecx
jg     1283 <getvalue+0x103>
cmp    $0x46,%ecx
je     12a1 <getvalue+0x121>
cmp    $0x64,%ecx
jne    1307 <getvalue+0x187>
cltq
add    %rax,%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <atoi@plt>
mov    0x8(%rsp),%rcx
mov    %eax,(%rcx)
jmp    12db <getvalue+0x15b>
cmp    $0x66,%ecx
je     12bf <getvalue+0x13f>
cmp    $0x73,%ecx
jne    1307 <getvalue+0x187>
cltq
add    %rax,%r12
mov    0x8(%rsp),%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
jmp    12db <getvalue+0x15b>
cltq
add    %rax,%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <atof@plt>
cvtsi2sd %eax,%xmm0
mov    0x8(%rsp),%rax
movsd  %xmm0,(%rax)
jmp    12db <getvalue+0x15b>
cltq
add    %rax,%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <atof@plt>
cvtsi2ss %eax,%xmm0
mov    0x8(%rsp),%rax
movss  %xmm0,(%rax)
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd13(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0xd12(%rip),%rdi
mov    %r15,%rsi
jmp    12f6 <getvalue+0x176>

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 = [26 x i8] c"Variable \22%s\22 not found!\0A\00"
@.str.5 = [40 x i8] c"WARNING: bad argument type \22%s\22 found!\0A\00"
define i32 @getvalue(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 %50
47: ; preds = %44
%48 = load i8*, i8** %7
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %48)
unreachable
50: ; preds = %44
%51 = load i8*, i8** %8
%52 = getelementptr inbounds i8, i8* %51, i64 0
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
switch i32 %54, label %91 [
i32 100, label %55
i32 102, label %62
i32 70, label %72
i32 115, label %82
]
55: ; preds = %50
%56 = load i8*, i8** %6
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
%60 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %59)
%61 = load i32*, i32** %9
store i32 %60, i32* %61
store i32 0, i32* %5
br label %94
62: ; preds = %50
%63 = load i32*, i32** %9
%64 = bitcast i32* %63 to float*
store float* %64, float** %13
%65 = load i8*, i8** %6
%66 = load i32, i32* %10
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %68)
%70 = sitofp i32 %69 to float
%71 = load float*, float** %13
store float %70, float* %71
store i32 0, i32* %5
br label %94
72: ; preds = %50
%73 = load i32*, i32** %9
%74 = bitcast i32* %73 to double*
store double* %74, double** %12
%75 = load i8*, i8** %6
%76 = load i32, i32* %10
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %78)
%80 = sitofp i32 %79 to double
%81 = load double*, double** %12
store double %80, double* %81
store i32 0, i32* %5
br label %94
82: ; preds = %50
%83 = load i32*, i32** %9
%84 = bitcast i32* %83 to i8*
store i8* %84, i8** %15
%85 = load i8*, i8** %15
%86 = load i8*, i8** %6
%87 = load i32, i32* %10
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %86, i64 %88
%90 = call i8* @strcpy(i8* %85, i8* %89)
store i32 0, i32* %5
br label %94
91: ; preds = %50
%92 = load i8*, i8** %8
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i8* %92)
unreachable
94: ; preds = %82, %72, %62, %55
%95 = load i32, i32* %5
ret i32 %95
}

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 = [26 x i8] c"Variable \22%s\22 not found!\0A\00"
@.str.5 = [40 x i8] c"WARNING: bad argument type \22%s\22 found!\0A\00"
define i32 @getvalue(i8* %0, i8* %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 %33, label %35
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %1)
unreachable
35: ; preds = %30
%36 = load i8, i8* %2
%37 = sext i8 %36 to i32
switch i32 %37, label %59 [
i32 100, label %38
i32 102, label %42
i32 70, label %48
i32 115, label %54
]
38: ; preds = %35
%39 = sext i32 %31 to i64
%40 = getelementptr inbounds i8, i8* %0, i64 %39
%41 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %40)
store i32 %41, i32* %3
br label %61
42: ; preds = %35
%43 = bitcast i32* %3 to float*
%44 = sext i32 %31 to i64
%45 = getelementptr inbounds i8, i8* %0, i64 %44
%46 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %45)
%47 = sitofp i32 %46 to float
store float %47, float* %43
br label %61
48: ; preds = %35
%49 = bitcast i32* %3 to double*
%50 = sext i32 %31 to i64
%51 = getelementptr inbounds i8, i8* %0, i64 %50
%52 = call i32 (i8*, ...) bitcast (i32 (...)* @atof to i32 (i8*, ...)*)(i8* %51)
%53 = sitofp i32 %52 to double
store double %53, double* %49
br label %61
54: ; preds = %35
%55 = bitcast i32* %3 to i8*
%56 = sext i32 %31 to i64
%57 = getelementptr inbounds i8, i8* %0, i64 %56
%58 = call i8* @strcpy(i8* dereferenceable(1) %55, i8* %57)
br label %61
59: ; preds = %35
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i8* %2)
unreachable
61: ; preds = %54, %48, %42, %38
ret i32 0
}