#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(FILE *infile, char varname[], void *address, int parmtype, int crit,
            int present) {
  int foundit, namelen, check1, check2, gotit;
  char buffer[255] = "\0";
  namelen = strlen(varname);
  foundit = 0;
  rewind(infile);
  do {
    fgets(buffer, 255, infile);
    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--;
      }
    }
  } 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);
  present = foundit;
  return;
}


x86 assembly (clang, -O0):
<rdsvar>:
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)
mov    %r9d,-0x24(%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,-0x2c(%rbp)
movl   $0x0,-0x28(%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,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp)
cltq
movsbl -0x140(%rbp,%rax,1),%eax
ff
mov    -0x10(%rbp),%rcx
mov    -0x34(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x34(%rbp)
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    125c <rdsvar+0xac>
jmp    1224 <rdsvar+0x74>
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    1441 <rdsvar+0x291>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x148(%rbp)
sub    $0x4,%eax
ja     1408 <rdsvar+0x258>
mov    -0x148(%rbp),%rax
lea    0xd69(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xd5b(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x38(%rbp)
jmp    1419 <rdsvar+0x269>
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xd37(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x38(%rbp)
jmp    1419 <rdsvar+0x269>
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xd14(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x38(%rbp)
jmp    1419 <rdsvar+0x269>
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
lea    0xcf0(%rip),%rsi
mov    $0x0,%al
call   10c0 <sscanf@plt>
mov    %eax,-0x38(%rbp)
jmp    1419 <rdsvar+0x269>
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
lea    0xcd1(%rip),%rsi
call   1080 <strspn@plt>
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
cltq
movsbl -0x140(%rbp,%rax,1),%edi
ff
call   1090 <isspace@plt>
cmp    $0x0,%eax
je     13aa <rdsvar+0x1fa>
jmp    139c <rdsvar+0x1ec>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    1379 <rdsvar+0x1c9>
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rdi
add    %rax,%rdi
call   1050 <strlen@plt>
cmp    $0x2,%eax
jge    13d2 <rdsvar+0x222>
movslq -0x30(%rbp),%rax
movb   $0x0,-0x140(%rbp,%rax,1)
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x140(%rbp,%rax,1)
mov    -0x18(%rbp),%rdi
movslq -0x30(%rbp),%rax
lea    -0x140(%rbp),%rsi
add    %rax,%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x38(%rbp)
jmp    1419 <rdsvar+0x269>
mov    -0x1c(%rbp),%esi
lea    0xc17(%rip),%rdi
mov    $0x0,%al
call   10d0 <ShowErrorMessage@plt>
cmpl   $0x0,-0x38(%rbp)
jne    143c <rdsvar+0x28c>
mov    -0x10(%rbp),%rsi
lea    0xc20(%rip),%rdi
call   1030 <ShowWarningMessage@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1441 <rdsvar+0x291>
jmp    1446 <rdsvar+0x296>
mov    -0x8(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1201 <rdsvar+0x51>
cmpl   $0x0,-0x28(%rbp)
jne    148a <rdsvar+0x2da>
cmpl   $0x0,-0x20(%rbp)
je     1485 <rdsvar+0x2d5>
mov    -0x10(%rbp),%rsi
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   10d0 <ShowErrorMessage@plt>
jmp    148a <rdsvar+0x2da>
cmpl   $0x1,-0x28(%rbp)
jle    14a4 <rdsvar+0x2f4>
mov    -0x10(%rbp),%rsi
lea    0xc0a(%rip),%rdi
call   1030 <ShowWarningMessage@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdsvar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %r8d,0x20(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdx,0x18(%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,0x24(%rsp)
mov    %rbx,%rdi
call   1060 <rewind@plt>
xor    %ebp,%ebp
mov    %rbx,0x8(%rsp)
jmp    1275 <rdsvar+0xd5>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    1451 <rdsvar+0x2b1>
lea    0x30(%rsp),%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
mov    $0x2,%ecx
mov    $0x1,%edx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
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     12a0 <rdsvar+0x100>
cmp    %eax,0x24(%rsp)
jg     1260 <rdsvar+0xc0>
lea    0x1(%rbp),%eax
mov    %eax,0x4(%rsp)
mov    0x28(%rsp),%rax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1301 <rdsvar+0x161>
lea    0xd1f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rbp,%r14
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xd1e(%rip),%rsi
jmp    1369 <rdsvar+0x1c9>
mov    %rbp,%r14
lea    0xd1e(%rip),%rdi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   10c0 <ShowErrorMessage@plt>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    0x14(%rsp),%eax
jmp    137e <rdsvar+0x1de>
mov    %rbp,%r14
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xce6(%rip),%rsi
jmp    1369 <rdsvar+0x1c9>
mov    %rbp,%r14
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xcc2(%rip),%rsi
jmp    1369 <rdsvar+0x1c9>
mov    %rbp,%r14
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xcaf(%rip),%rsi
mov    0x18(%rsp),%rdx
xor    %eax,%eax
call   10b0 <sscanf@plt>
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
mov    %eax,0x14(%rsp)
test   %eax,%eax
jne    1265 <rdsvar+0xc5>
lea    0xcbd(%rip),%rdi
mov    %r12,%rsi
call   1030 <ShowWarningMessage@plt>
movl   $0x0,0x14(%rsp)
mov    %r14d,%ebp
jmp    1265 <rdsvar+0xc5>
mov    %r15d,%eax
lea    (%rsp,%rax,1),%rdi
add    $0x30,%rdi
lea    0xc6b(%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
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl 0x0(%rbp),%edi
call   1080 <isspace@plt>
add    $0xffffffff,%r13d
add    $0xffffffffffffffff,%rbp
test   %eax,%eax
jne    1400 <rdsvar+0x260>
mov    %r15,%rdi
call   1050 <strlen@plt>
cmp    $0x1,%eax
mov    0x8(%rsp),%rbx
mov    0x4(%rsp),%ebp
jg     142f <rdsvar+0x28f>
movb   $0x0,(%r15)
movslq %r13d,%rax
movb   $0x0,0x30(%rsp,%rax,1)
mov    0x18(%rsp),%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
movl   $0x1,0x14(%rsp)
jmp    1265 <rdsvar+0xc5>
cmpl   $0x0,0x20(%rsp)
je     146f <rdsvar+0x2cf>
test   %ebp,%ebp
jne    146f <rdsvar+0x2cf>
lea    0xc24(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10c0 <ShowErrorMessage@plt>
jmp    1483 <rdsvar+0x2e3>
cmp    $0x2,%ebp
jl     1483 <rdsvar+0x2e3>
lea    0xc2e(%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(i32* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca [255 x i8]
store i32* %0, i32** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%19 = bitcast [255 x i8]* %18 to i8*
%20 = load i8*, i8** %8
%21 = call i32 @strlen(i8* %20)
store i32 %21, i32* %14
store i32 0, i32* %13
%22 = load i32*, i32** %7
%23 = call i32 @rewind(i32* %22)
br label %24
24: ; preds = %140, %6
%25 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 0
%26 = load i32*, i32** %7
%27 = call i32 @fgets(i8* %25, i32 255, i32* %26)
store i32 0, i32* %15
store i32 0, i32* %16
br label %28
28: ; preds = %43, %24
%29 = load i32, i32* %15
%30 = add nsw i32 %29, 1
store i32 %30, i32* %15
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = load i8*, i8** %8
%36 = load i32, i32* %16
%37 = add nsw i32 %36, 1
store i32 %37, i32* %16
%38 = sext i32 %36 to i64
%39 = getelementptr inbounds i8, i8* %35, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %34, %41
br i1 %42, label %43, label %44
43: ; preds = %28
br label %28
44: ; preds = %28
%45 = load i32, i32* %15
%46 = load i32, i32* %14
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %139
48: ; preds = %44
%49 = load i32, i32* %13
%50 = add nsw i32 %49, 1
store i32 %50, i32* %13
%51 = load i32, i32* %10
switch i32 %51, label %127 [
i32 3, label %52
i32 4, label %59
i32 1, label %66
i32 2, label %73
i32 5, label %80
]
52: ; preds = %48
%53 = load i32, i32* %15
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %54
%56 = load i8*, i8** %9
%57 = bitcast i8* %56 to float*
%58 = call i32 (i8*, i8*, ...) @sscanf(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float* %57)
store i32 %58, i32* %17
br label %130
59: ; preds = %48
%60 = load i32, i32* %15
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %61
%63 = load i8*, i8** %9
%64 = bitcast i8* %63 to double*
%65 = call i32 (i8*, i8*, ...) @sscanf(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %64)
store i32 %65, i32* %17
br label %130
66: ; preds = %48
%67 = load i32, i32* %15
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %68
%70 = load i8*, i8** %9
%71 = bitcast i8* %70 to i32*
%72 = call i32 (i8*, i8*, ...) @sscanf(i8* %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %71)
store i32 %72, i32* %17
br label %130
73: ; preds = %48
%74 = load i32, i32* %15
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %75
%77 = load i8*, i8** %9
%78 = bitcast i8* %77 to i64*
%79 = call i32 (i8*, i8*, ...) @sscanf(i8* %76, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64* %78)
store i32 %79, i32* %17
br label %130
80: ; preds = %48
%81 = load i32, i32* %15
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %82
%84 = call i32 @strspn(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%85 = load i32, i32* %15
%86 = add nsw i32 %85, %84
store i32 %86, i32* %15
%87 = load i32, i32* %15
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %88
%90 = call i32 @strlen(i8* %89)
%91 = sub nsw i32 %90, 1
store i32 %91, i32* %16
br label %92
92: ; preds = %102, %80
%93 = load i32, i32* %15
%94 = load i32, i32* %16
%95 = add nsw i32 %93, %94
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = call i32 @isspace(i8 signext %98)
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %105
101: ; preds = %92
br label %102
102: ; preds = %101
%103 = load i32, i32* %16
%104 = add nsw i32 %103, -1
store i32 %104, i32* %16
br label %92
105: ; preds = %92
%106 = load i32, i32* %15
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %107
%109 = call i32 @strlen(i8* %108)
%110 = icmp slt i32 %109, 2
br i1 %110, label %111, label %115
111: ; preds = %105
%112 = load i32, i32* %15
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %113
store i8 0, i8* %114
br label %115
115: ; preds = %111, %105
%116 = load i32, i32* %15
%117 = load i32, i32* %16
%118 = add nsw i32 %116, %117
%119 = add nsw i32 %118, 1
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %120
store i8 0, i8* %121
%122 = load i8*, i8** %9
%123 = load i32, i32* %15
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [255 x i8], [255 x i8]* %18, i64 0, i64 %124
%126 = call i32 @strcpy(i8* %122, i8* %125)
store i32 1, i32* %17
br label %130
127: ; preds = %48
%128 = load i32, i32* %10
%129 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %128)
br label %130
130: ; preds = %127, %115, %73, %66, %59, %52
%131 = load i32, i32* %17
%132 = icmp ne i32 %131, 0
br i1 %132, label %138, label %133
133: ; preds = %130
%134 = load i8*, i8** %8
%135 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %134)
%136 = load i32, i32* %13
%137 = add nsw i32 %136, -1
store i32 %137, i32* %13
br label %138
138: ; preds = %133, %130
br label %139
139: ; preds = %138, %44
br label %140
140: ; preds = %139
%141 = load i32*, i32** %7
%142 = call i32 @feof(i32* %141)
%143 = icmp ne i32 %142, 0
%144 = xor i1 %143, true
br i1 %144, label %24, label %145
145: ; preds = %140
%146 = load i32, i32* %13
%147 = icmp ne i32 %146, 0
br i1 %147, label %155, label %148
148: ; preds = %145
%149 = load i32, i32* %11
%150 = icmp ne i32 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %148
%152 = load i8*, i8** %8
%153 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i8* %152)
br label %154
154: ; preds = %151, %148
br label %155
155: ; preds = %154, %145
%156 = load i32, i32* %13
%157 = icmp sgt i32 %156, 1
br i1 %157, label %158, label %161
158: ; preds = %155
%159 = load i8*, i8** %8
%160 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.8, i64 0, i64 0), i8* %159)
br label %161
161: ; preds = %158, %155
%162 = load i32, i32* %13
store i32 %162, i32* %12
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(i32* nocapture %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [255 x i8]
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%9 = tail call i32 @strlen(i8* %1)
%10 = tail call i32 @rewind(i32* %0)
br label %11
11: ; preds = %79, %6
%12 = phi i32 [ 0, %6 ], [ %80, %79 ]
%13 = phi i32 [ undef, %6 ], [ %81, %79 ]
%14 = call i32 @fgets(i8* %8, i32 255, i32* %0)
br label %15
15: ; preds = %15, %11
%16 = phi i64 [ %17, %15 ], [ 0, %11 ]
%17 = add nuw i64 %16, 1
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %16
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %1, i64 %16
%21 = load i8, i8* %20
%22 = icmp eq i8 %19, %21
br i1 %22, label %15, label %23
23: ; preds = %15
%24 = trunc i64 %16 to i32
%25 = trunc i64 %17 to i32
%26 = icmp sgt i32 %9, %24
br i1 %26, label %79, label %27
27: ; preds = %23
%28 = add nsw i32 %12, 1
switch i32 %3, label %72 [
i32 3, label %29
i32 4, label %33
i32 1, label %37
i32 2, label %41
i32 5, label %45
]
29: ; preds = %27
%30 = and i64 %17, 4294967295
%31 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %30
%32 = call i32 (i8*, i8*, ...) @sscanf(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %74
33: ; preds = %27
%34 = and i64 %17, 4294967295
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %34
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %74
37: ; preds = %27
%38 = and i64 %17, 4294967295
%39 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %38
%40 = call i32 (i8*, i8*, ...) @sscanf(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %74
41: ; preds = %27
%42 = and i64 %17, 4294967295
%43 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %42
%44 = call i32 (i8*, i8*, ...) @sscanf(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %74
45: ; preds = %27
%46 = and i64 %17, 4294967295
%47 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %46
%48 = call i32 @strspn(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%49 = add nsw i32 %48, %25
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %50
%52 = call i32 @strlen(i8* %51)
%53 = sext i32 %52 to i64
br label %54
54: ; preds = %54, %45
%55 = phi i64 [ %56, %54 ], [ %53, %45 ]
%56 = add i64 %55, -1
%57 = add nsw i64 %56, %50
%58 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = call i32 @isspace(i8 signext %59)
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %54
62: ; preds = %54
%63 = trunc i64 %55 to i32
%64 = call i32 @strlen(i8* %51)
%65 = icmp slt i32 %64, 2
br i1 %65, label %66, label %67
66: ; preds = %62
store i8 0, i8* %51
br label %67
67: ; preds = %62, %66
%68 = add i32 %49, %63
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 %69
store i8 0, i8* %70
%71 = call i32 @strcpy(i8* %2, i8* %51)
br label %79
72: ; preds = %27
%73 = call i32 (i8*, ...) @ShowErrorMessage(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %3)
br label %74
74: ; preds = %72, %41, %37, %33, %29
%75 = phi i32 [ %13, %72 ], [ %44, %41 ], [ %40, %37 ], [ %36, %33 ], [ %32, %29 ]
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = call i32 @ShowWarningMessage(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.6, i64 0, i64 0), i8* %1)
br label %79
79: ; preds = %67, %23, %77, %74
%80 = phi i32 [ %28, %74 ], [ %12, %77 ], [ %12, %23 ], [ %28, %67 ]
%81 = phi i32 [ %75, %74 ], [ 0, %77 ], [ %13, %23 ], [ 1, %67 ]
%82 = call i32 @feof(i32* %0)
%83 = icmp eq i32 %82, 0
br i1 %83, label %11, label %84
84: ; preds = %79
%85 = icmp eq i32 %80, 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 %80, 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
}