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

/* Variables and functions */
int /*<<< orphan*/ ShowErrorMessage(char *, ...);
int /*<<< orphan*/ ShowWarningMessage(char *, char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ isspace(char);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int sscanf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int strspn(char *, char *);
void rdsvar_old(FILE *infile, char varname[], void *address, int parmtype,
                int crit) {
  int foundit, namelen, check1, check2, gotit;
  char buffer[255] = "\0";
  namelen = strlen(varname);
  foundit = 0;
  rewind(infile);
  fgets(buffer, 255, infile);
  do {
    check1 = 0;
    check2 = 0;
    while (buffer[check1++] == varname[check2++])
      ;
    if (check1 > (namelen)) {
      foundit++;
      switch (parmtype) {
      case 3:
        gotit = sscanf(&buffer[check1], " %f", (float *)address);
        break;
      case 4:
        gotit = sscanf(&buffer[check1], " %lf", (double *)address);
        break;
      case 1:
        gotit = sscanf(&buffer[check1], " %d", (int *)address);
        break;
      case 2:
        gotit = sscanf(&buffer[check1], " %ld", (long int *)address);
        break;
      case 5:
        check1 += strspn(&buffer[check1], " ,");
        for (check2 = strlen(&buffer[check1]) - 1;
             isspace(buffer[check1 + check2]) != 0; check2--)
          ;
        if (strlen(&buffer[check1]) < 2)
          buffer[check1] = '\0';
        buffer[check1 + check2 + 1] = '\0';
        strcpy((char *)address, &buffer[check1]);
        gotit = 1;
        break;
      default:
        ShowErrorMessage("Invalid parameter type request %d: \n", parmtype);
      }
      if (!gotit) {
        ShowWarningMessage(
            "WARNING: found bad value for variable %s. Value ignored\n",
            varname);
        foundit--;
      }
    }
    fgets(buffer, 255, infile);
  } while (!(feof(infile)));
  if (!foundit) {
    if (crit)
      ShowErrorMessage("Unable to find %s in input file.\n", varname);
  }
  if (foundit > 1) {
    ShowWarningMessage("WARNING variable: %s appears more than once in the "
                       "input file. Final value taken\n",
                       varname);
  }
  return;
}


x86 assembly (clang, -O0):
<rdsvar_old>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <rewind@plt>
lea    -0x140(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xff,%esi
call   10a0 <fgets@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x2c(%rbp)
cltq
movsbl -0x140(%rbp,%rax,1),%eax
ff
mov    -0x10(%rbp),%rcx
mov    -0x30(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x30(%rbp)
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1258 <rdsvar_old+0xa8>
jmp    1220 <rdsvar_old+0x70>
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    143d <rdsvar_old+0x28d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x148(%rbp)
sub    $0x4,%eax
ja     1404 <rdsvar_old+0x254>
mov    -0x148(%rbp),%rax
lea    0xd6d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xd5f(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x34(%rbp)
jmp    1415 <rdsvar_old+0x265>
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xd3b(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x34(%rbp)
jmp    1415 <rdsvar_old+0x265>
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xd18(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x34(%rbp)
jmp    1415 <rdsvar_old+0x265>
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xcf4(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x34(%rbp)
jmp    1415 <rdsvar_old+0x265>
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
lea    0xcd5(%rip),%rsi
call   1080 <strspn@plt>
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cltq
movsbl -0x140(%rbp,%rax,1),%edi
ff
call   1090 <isspace@plt>
cmp    $0x0,%eax
je     13a6 <rdsvar_old+0x1f6>
jmp    1398 <rdsvar_old+0x1e8>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    1375 <rdsvar_old+0x1c5>
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jge    13ce <rdsvar_old+0x21e>
movslq -0x2c(%rbp),%rax
movb   $0x0,-0x140(%rbp,%rax,1)
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x140(%rbp,%rax,1)
mov    -0x18(%rbp),%rdi
movslq -0x2c(%rbp),%rax
lea    -0x140(%rbp),%rsi
add    %rax,%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x34(%rbp)
jmp    1415 <rdsvar_old+0x265>
mov    -0x1c(%rbp),%esi
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   10d0 <ShowErrorMessage@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1438 <rdsvar_old+0x288>
mov    -0x10(%rbp),%rsi
lea    0xc24(%rip),%rdi
call   1030 <ShowWarningMessage@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    143d <rdsvar_old+0x28d>
lea    -0x140(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xff,%esi
call   10a0 <fgets@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1212 <rdsvar_old+0x62>
cmpl   $0x0,-0x24(%rbp)
jne    1496 <rdsvar_old+0x2e6>
cmpl   $0x0,-0x20(%rbp)
je     1491 <rdsvar_old+0x2e1>
mov    -0x10(%rbp),%rsi
lea    0xbfd(%rip),%rdi
mov    $0x0,%al
call   10d0 <ShowErrorMessage@plt>
jmp    1496 <rdsvar_old+0x2e6>
cmpl   $0x1,-0x24(%rbp)
jle    14b0 <rdsvar_old+0x300>
mov    -0x10(%rbp),%rsi
lea    0xbfe(%rip),%rdi
call   1030 <ShowWarningMessage@plt>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdsvar_old>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %r8d,0x18(%rsp)
mov    %rcx,0x20(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,%r12
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x11f(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
mov    %rsi,%rdi
call   1050 <strlen@plt>
mov    %eax,0x1c(%rsp)
mov    %rbx,%rdi
call   1060 <rewind@plt>
lea    0x30(%rsp),%rdi
mov    $0xff,%esi
mov    %rbx,0x28(%rsp)
mov    %rbx,%rdx
call   1090 <fgets@plt>
xor    %ebx,%ebx
jmp    1299 <rdsvar_old+0xf9>
nopl   0x0(%rax)
mov    %ebp,%ebx
lea    0x30(%rsp),%rdi
mov    $0xff,%esi
mov    0x28(%rsp),%rbp
mov    %rbp,%rdx
call   1090 <fgets@plt>
mov    %rbp,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    1428 <rdsvar_old+0x288>
mov    %ebx,%ebp
mov    $0x2,%ecx
mov    $0x1,%edx
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    %r15,%rax
mov    %ecx,%r13d
mov    %edx,%r14d
add    $0x1,%r15
movzbl 0x30(%rsp,%rax,1),%ebx
lea    0x1(%r13),%ecx
lea    0x1(%r14),%edx
cmp    (%r12,%rax,1),%bl
je     12b0 <rdsvar_old+0x110>
cmp    %eax,0x1c(%rsp)
jg     1270 <rdsvar_old+0xd0>
lea    0x1(%rbp),%ebx
mov    0x20(%rsp),%rax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     130a <rdsvar_old+0x16a>
lea    0xd13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xd15(%rip),%rsi
jmp    135d <rdsvar_old+0x1bd>
lea    0xd18(%rip),%rdi
mov    0x20(%rsp),%rsi
xor    %eax,%eax
call   10c0 <ShowErrorMessage@plt>
mov    0xc(%rsp),%eax
jmp    1369 <rdsvar_old+0x1c9>
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xcec(%rip),%rsi
jmp    135d <rdsvar_old+0x1bd>
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xccb(%rip),%rsi
jmp    135d <rdsvar_old+0x1bd>
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xcbb(%rip),%rsi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   10b0 <sscanf@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
jne    1272 <rdsvar_old+0xd2>
lea    0xcd2(%rip),%rdi
mov    %r12,%rsi
call   1030 <ShowWarningMessage@plt>
movl   $0x0,0xc(%rsp)
jmp    1270 <rdsvar_old+0xd0>
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xc83(%rip),%rsi
call   1070 <strspn@plt>
mov    %eax,%ebp
add    %eax,%r15d
movslq %r15d,%rax
lea    (%rsp,%rax,1),%r15
add    $0x30,%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
cltq
add    %eax,%r13d
add    %ebp,%r13d
movslq %ebp,%rcx
add    %rax,%rcx
lea    0x2f(%rsp),%rax
add    %rax,%rcx
movslq %r14d,%rbp
add    %rcx,%rbp
nopl   0x0(%rax)
movsbl 0x0(%rbp),%edi
call   1080 <isspace@plt>
add    $0xffffffff,%r13d
add    $0xffffffffffffffff,%rbp
test   %eax,%eax
jne    13e0 <rdsvar_old+0x240>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x1,%eax
jg     1406 <rdsvar_old+0x266>
movb   $0x0,(%r15)
movslq %r13d,%rax
movb   $0x0,0x30(%rsp,%rax,1)
mov    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
movl   $0x1,0xc(%rsp)
jmp    1272 <rdsvar_old+0xd2>
cmpl   $0x0,0x18(%rsp)
je     1446 <rdsvar_old+0x2a6>
test   %ebx,%ebx
jne    1446 <rdsvar_old+0x2a6>
lea    0xc4d(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10c0 <ShowErrorMessage@plt>
jmp    145a <rdsvar_old+0x2ba>
cmp    $0x2,%ebx
jl     145a <rdsvar_old+0x2ba>
lea    0xc57(%rip),%rdi
mov    %r12,%rsi
call   1030 <ShowWarningMessage@plt>
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %f\00"
@.str.1 = [5 x i8] c" %lf\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [5 x i8] c" %ld\00"
@.str.4 = [3 x i8] c" ,\00"
@.str.5 = [37 x i8] c"Invalid parameter type request %d: \0A\00"
@.str.6 = [57 x i8] c"WARNING: found bad value for variable %s. Value ignored\0A\00"
@.str.7 = [34 x i8] c"Unable to find %s in input file.\0A\00"
@.str.8 = [82 x i8] c"WARNING variable: %s appears more than once in the input file. Final value taken\0A\00"
define void @rdsvar_old(i32* %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [255 x i8]
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%17 = bitcast [255 x i8]* %16 to i8*
%18 = load i8*, i8** %7
%19 = call i32 @strlen(i8* %18)
store i32 %19, i32* %12
store i32 0, i32* %11
%20 = load i32*, i32** %6
%21 = call i32 @rewind(i32* %20)
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 0
%23 = load i32*, i32** %6
%24 = call i32 @fgets(i8* %22, i32 255, i32* %23)
br label %25
25: ; preds = %141, %5
store i32 0, i32* %13
store i32 0, i32* %14
br label %26
26: ; preds = %41, %25
%27 = load i32, i32* %13
%28 = add nsw i32 %27, 1
store i32 %28, i32* %13
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = load i8*, i8** %7
%34 = load i32, i32* %14
%35 = add nsw i32 %34, 1
store i32 %35, i32* %14
%36 = sext i32 %34 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %32, %39
br i1 %40, label %41, label %42
41: ; preds = %26
br label %26
42: ; preds = %26
%43 = load i32, i32* %13
%44 = load i32, i32* %12
%45 = icmp sgt i32 %43, %44
br i1 %45, label %46, label %137
46: ; preds = %42
%47 = load i32, i32* %11
%48 = add nsw i32 %47, 1
store i32 %48, i32* %11
%49 = load i32, i32* %9
switch i32 %49, label %125 [
i32 3, label %50
i32 4, label %57
i32 1, label %64
i32 2, label %71
i32 5, label %78
]
50: ; preds = %46
%51 = load i32, i32* %13
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %52
%54 = load i8*, i8** %8
%55 = bitcast i8* %54 to float*
%56 = call i32 (i8*, i8*, ...) @sscanf(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %55)
store i32 %56, i32* %15
br label %128
57: ; preds = %46
%58 = load i32, i32* %13
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %59
%61 = load i8*, i8** %8
%62 = bitcast i8* %61 to double*
%63 = call i32 (i8*, i8*, ...) @sscanf(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %62)
store i32 %63, i32* %15
br label %128
64: ; preds = %46
%65 = load i32, i32* %13
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %66
%68 = load i8*, i8** %8
%69 = bitcast i8* %68 to i32*
%70 = call i32 (i8*, i8*, ...) @sscanf(i8* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %69)
store i32 %70, i32* %15
br label %128
71: ; preds = %46
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %73
%75 = load i8*, i8** %8
%76 = bitcast i8* %75 to i64*
%77 = call i32 (i8*, i8*, ...) @sscanf(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64* %76)
store i32 %77, i32* %15
br label %128
78: ; preds = %46
%79 = load i32, i32* %13
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %80
%82 = call i32 @strspn(i8* %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%83 = load i32, i32* %13
%84 = add nsw i32 %83, %82
store i32 %84, i32* %13
%85 = load i32, i32* %13
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %86
%88 = call i32 @strlen(i8* %87)
%89 = sub nsw i32 %88, 1
store i32 %89, i32* %14
br label %90
90: ; preds = %100, %78
%91 = load i32, i32* %13
%92 = load i32, i32* %14
%93 = add nsw i32 %91, %92
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %94
%96 = load i8, i8* %95
%97 = call i32 @isspace(i8 signext %96)
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %103
99: ; preds = %90
br label %100
100: ; preds = %99
%101 = load i32, i32* %14
%102 = add nsw i32 %101, -1
store i32 %102, i32* %14
br label %90
103: ; preds = %90
%104 = load i32, i32* %13
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %105
%107 = call i32 @strlen(i8* %106)
%108 = icmp slt i32 %107, 2
br i1 %108, label %109, label %113
109: ; preds = %103
%110 = load i32, i32* %13
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %111
store i8 0, i8* %112
br label %113
113: ; preds = %109, %103
%114 = load i32, i32* %13
%115 = load i32, i32* %14
%116 = add nsw i32 %114, %115
%117 = add nsw i32 %116, 1
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %118
store i8 0, i8* %119
%120 = load i8*, i8** %8
%121 = load i32, i32* %13
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 %122
%124 = call i32 @strcpy(i8* %120, i8* %123)
store i32 1, i32* %15
br label %128
125: ; preds = %46
%126 = load i32, i32* %9
%127 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %126)
br label %128
128: ; preds = %125, %113, %71, %64, %57, %50
%129 = load i32, i32* %15
%130 = icmp ne i32 %129, 0
br i1 %130, label %136, label %131
131: ; preds = %128
%132 = load i8*, i8** %7
%133 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %132)
%134 = load i32, i32* %11
%135 = add nsw i32 %134, -1
store i32 %135, i32* %11
br label %136
136: ; preds = %131, %128
br label %137
137: ; preds = %136, %42
%138 = getelementptr inbounds [255 x i8], [255 x i8]* %16, i64 0, i64 0
%139 = load i32*, i32** %6
%140 = call i32 @fgets(i8* %138, i32 255, i32* %139)
br label %141
141: ; preds = %137
%142 = load i32*, i32** %6
%143 = call i32 @feof(i32* %142)
%144 = icmp ne i32 %143, 0
%145 = xor i1 %144, true
br i1 %145, label %25, label %146
146: ; preds = %141
%147 = load i32, i32* %11
%148 = icmp ne i32 %147, 0
br i1 %148, label %156, label %149
149: ; preds = %146
%150 = load i32, i32* %10
%151 = icmp ne i32 %150, 0
br i1 %151, label %152, label %155
152: ; preds = %149
%153 = load i8*, i8** %7
%154 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %153)
br label %155
155: ; preds = %152, %149
br label %156
156: ; preds = %155, %146
%157 = load i32, i32* %11
%158 = icmp sgt i32 %157, 1
br i1 %158, label %159, label %162
159: ; preds = %156
%160 = load i8*, i8** %7
%161 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.8, i64 0, i64 0), i8* %160)
br label %162
162: ; preds = %159, %156
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" %f\00"
@.str.1 = [5 x i8] c" %lf\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [5 x i8] c" %ld\00"
@.str.4 = [3 x i8] c" ,\00"
@.str.5 = [37 x i8] c"Invalid parameter type request %d: \0A\00"
@.str.6 = [57 x i8] c"WARNING: found bad value for variable %s. Value ignored\0A\00"
@.str.7 = [34 x i8] c"Unable to find %s in input file.\0A\00"
@.str.8 = [82 x i8] c"WARNING variable: %s appears more than once in the input file. Final value taken\0A\00"
define void @rdsvar_old(i32* nocapture %0, i8* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca [255 x i8]
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %1)
%9 = tail call i32 @rewind(i32* %0)
%10 = call i32 @fgets(i8* %7, i32 255, i32* %0)
br label %11
11: ; preds = %78, %5
%12 = phi i32 [ 0, %5 ], [ %79, %78 ]
%13 = phi i32 [ undef, %5 ], [ %80, %78 ]
br label %14
14: ; preds = %14, %11
%15 = phi i64 [ %16, %14 ], [ 0, %11 ]
%16 = add nuw i64 %15, 1
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %15
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %1, i64 %15
%20 = load i8, i8* %19
%21 = icmp eq i8 %18, %20
br i1 %21, label %14, label %22
22: ; preds = %14
%23 = trunc i64 %15 to i32
%24 = trunc i64 %16 to i32
%25 = icmp sgt i32 %8, %23
br i1 %25, label %78, label %26
26: ; preds = %22
%27 = add nsw i32 %12, 1
switch i32 %3, label %71 [
i32 3, label %28
i32 4, label %32
i32 1, label %36
i32 2, label %40
i32 5, label %44
]
28: ; preds = %26
%29 = and i64 %16, 4294967295
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %29
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %73
32: ; preds = %26
%33 = and i64 %16, 4294967295
%34 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %33
%35 = call i32 (i8*, i8*, ...) @sscanf(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %73
36: ; preds = %26
%37 = and i64 %16, 4294967295
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %37
%39 = call i32 (i8*, i8*, ...) @sscanf(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %73
40: ; preds = %26
%41 = and i64 %16, 4294967295
%42 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %41
%43 = call i32 (i8*, i8*, ...) @sscanf(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %73
44: ; preds = %26
%45 = and i64 %16, 4294967295
%46 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %45
%47 = call i32 @strspn(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%48 = add nsw i32 %47, %24
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %49
%51 = call i32 @strlen(i8* %50)
%52 = sext i32 %51 to i64
br label %53
53: ; preds = %53, %44
%54 = phi i64 [ %55, %53 ], [ %52, %44 ]
%55 = add i64 %54, -1
%56 = add nsw i64 %55, %49
%57 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = call i32 @isspace(i8 signext %58)
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %53
61: ; preds = %53
%62 = trunc i64 %54 to i32
%63 = call i32 @strlen(i8* %50)
%64 = icmp slt i32 %63, 2
br i1 %64, label %65, label %66
65: ; preds = %61
store i8 0, i8* %50
br label %66
66: ; preds = %61, %65
%67 = add i32 %48, %62
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %68
store i8 0, i8* %69
%70 = call i32 @strcpy(i8* %2, i8* %50)
br label %78
71: ; preds = %26
%72 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %3)
br label %73
73: ; preds = %71, %40, %36, %32, %28
%74 = phi i32 [ %13, %71 ], [ %43, %40 ], [ %39, %36 ], [ %35, %32 ], [ %31, %28 ]
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %1)
br label %78
78: ; preds = %66, %73, %76, %22
%79 = phi i32 [ %27, %73 ], [ %12, %76 ], [ %12, %22 ], [ %27, %66 ]
%80 = phi i32 [ %74, %73 ], [ 0, %76 ], [ %13, %22 ], [ 1, %66 ]
%81 = call i32 @fgets(i8* %7, i32 255, i32* %0)
%82 = call i32 @feof(i32* %0)
%83 = icmp eq i32 %82, 0
br i1 %83, label %11, label %84
84: ; preds = %78
%85 = icmp eq i32 %79, 0
%86 = icmp ne i32 %4, 0
%87 = and i1 %86, %85
br i1 %87, label %88, label %90
88: ; preds = %84
%89 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %1)
br label %94
90: ; preds = %84
%91 = icmp sgt i32 %79, 1
br i1 %91, label %92, label %94
92: ; preds = %90
%93 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.8, i64 0, i64 0), i8* %1)
br label %94
94: ; preds = %88, %92, %90
ret void
}