#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*/ error1(char *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int sscanf(char *, char *, char *);
int /*<<< orphan*/ stderr;
void getcharpar(FILE *parfile, char *string, char *var) {
  char inlinetit[2000];
  char *succ;
  char template[100];
  int no_of_vars;
  do
    succ = fgets(inlinetit, 2000, parfile);
  while ((inlinetit[0] == '*' || inlinetit[0] == ' ' || inlinetit[0] == '\n') &&
         succ != NULL);
  sprintf(template, "%s: %%s", string);
  no_of_vars = sscanf(inlinetit, template, var);
  switch (no_of_vars) {
  case 1:
    break;
  default:
    fprintf(stderr, "Line: %s\n", string);
    error1("ReadParams: Parameters wrong");
    break;
  }
}


x86 assembly (clang, -O0):
<getcharpar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x7f0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x7d0,%esi
call   1030 <fgets@plt>
mov    %rax,-0x7f8(%rbp)
movsbl -0x7f0(%rbp),%eax
cmp    $0x2a,%eax
je     11bb <getcharpar+0x6b>
movsbl -0x7f0(%rbp),%eax
cmp    $0x20,%eax
je     11bb <getcharpar+0x6b>
movsbl -0x7f0(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x865(%rbp)
jne    11cc <getcharpar+0x7c>
cmpq   $0x0,-0x7f8(%rbp)
setne  %al
mov    %al,-0x865(%rbp)
mov    -0x865(%rbp),%al
test   $0x1,%al
jne    1167 <getcharpar+0x17>
mov    -0x10(%rbp),%rdx
lea    0xe1b(%rip),%rsi
lea    -0x860(%rbp),%rdi
mov    %rdi,-0x870(%rbp)
call   1060 <sprintf@plt>
mov    -0x870(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x7f0(%rbp),%rdi
call   1050 <sscanf@plt>
mov    %eax,-0x864(%rbp)
mov    -0x864(%rbp),%eax
sub    $0x1,%eax
jne    122e <getcharpar+0xde>
jmp    1229 <getcharpar+0xd9>
jmp    1253 <getcharpar+0x103>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdc6(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xdc4(%rip),%rdi
call   1070 <error1@plt>
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcharpar>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x848,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x70(%rsp),%r12
nopl   0x0(%rax)
mov    %r12,%rdi
mov    $0x7d0,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
movzbl 0x70(%rsp),%edx
cmp    $0x20,%dl
sete   %cl
and    $0xdf,%dl
cmp    $0xa,%dl
sete   %dl
test   %rax,%rax
je     119d <getcharpar+0x4d>
or     %dl,%cl
jne    1170 <getcharpar+0x20>
lea    0xe5c(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
call   1060 <sprintf@plt>
lea    0x70(%rsp),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     11eb <getcharpar+0x9b>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
mov    %r15,%rdx
call   1040 <fprintf@plt>
lea    0xe2c(%rip),%rdi
call   1070 <error1@plt>
add    $0x848,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %%s\00"
@stderr = global i32 0
@.str.1 = [10 x i8] c"Line: %s\0A\00"
@.str.2 = [29 x i8] c"ReadParams: Parameters wrong\00"
define void @getcharpar(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [2000 x i8]
%8 = alloca i8*
%9 = alloca [100 x i8]
%10 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
br label %11
11: ; preds = %33, %3
%12 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%13 = load i32*, i32** %4
%14 = call i8* @fgets(i8* %12, i32 2000, i32* %13)
store i8* %14, i8** %8
br label %15
15: ; preds = %11
%16 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 42
br i1 %19, label %30, label %20
20: ; preds = %15
%21 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %33
30: ; preds = %25, %20, %15
%31 = load i8*, i8** %8
%32 = icmp ne i8* %31, null
br label %33
33: ; preds = %30, %25
%34 = phi i1 [ false, %25 ], [ %32, %30 ]
br i1 %34, label %11, label %35
35: ; preds = %33
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%37 = load i8*, i8** %5
%38 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [2000 x i8], [2000 x i8]* %7, i64 0, i64 0
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%41 = load i8*, i8** %6
%42 = call i32 @sscanf(i8* %39, i8* %40, i8* %41)
store i32 %42, i32* %10
%43 = load i32, i32* %10
switch i32 %43, label %45 [
i32 1, label %44
]
44: ; preds = %35
br label %50
45: ; preds = %35
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %5
%48 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %47)
%49 = call i32 @error1(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %50
50: ; preds = %45, %44
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %%s\00"
@stderr = global i32 0
@.str.1 = [10 x i8] c"Line: %s\0A\00"
@.str.2 = [29 x i8] c"ReadParams: Parameters wrong\00"
define void @getcharpar(i32* nocapture %0, i8* %1, i8* %2) {
%4 = alloca [2000 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
br label %8
8: ; preds = %8, %3
%9 = call i8* @fgets(i8* %6, i32 2000, i32* %0)
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 32
%12 = and i8 %10, -33
%13 = icmp eq i8 %12, 10
%14 = or i1 %11, %13
%15 = icmp ne i8* %9, null
%16 = and i1 %15, %14
br i1 %16, label %8, label %17
17: ; preds = %8
%18 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %1)
%19 = call i32 @sscanf(i8* %6, i8* %7, i8* %2)
%20 = icmp eq i32 %19, 1
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%24 = call i32 @error1(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %17, %21
ret void
}