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


x86 assembly (clang, -O0):
<getintpar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%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,-0x800(%rbp)
movsbl -0x7f0(%rbp),%eax
cmp    $0x2a,%eax
je     11bb <getintpar+0x6b>
movsbl -0x7f0(%rbp),%eax
cmp    $0x20,%eax
je     11bb <getintpar+0x6b>
movsbl -0x7f0(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x835(%rbp)
jne    11cc <getintpar+0x7c>
cmpq   $0x0,-0x800(%rbp)
setne  %al
mov    %al,-0x835(%rbp)
mov    -0x835(%rbp),%al
test   $0x1,%al
jne    1167 <getintpar+0x17>
mov    -0x10(%rbp),%rdx
lea    0xe1b(%rip),%rsi
lea    -0x830(%rbp),%rdi
mov    %rdi,-0x840(%rbp)
call   1060 <sprintf@plt>
mov    -0x840(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x7f0(%rbp),%rdi
lea    -0x7f4(%rbp),%rcx
lea    -0x7f8(%rbp),%r8
call   1050 <sscanf@plt>
mov    %eax,-0x834(%rbp)
mov    -0x834(%rbp),%eax
sub    $0x1,%eax
jne    123c <getintpar+0xec>
jmp    1237 <getintpar+0xe7>
jmp    1261 <getintpar+0x111>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdc0(%rip),%rsi
call   1040 <fprintf@plt>
lea    0xdbe(%rip),%rdi
call   1070 <error1@plt>
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getintpar>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x818,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x40(%rsp),%r12
nopl   0x0(%rax)
mov    %r12,%rdi
mov    $0x7d0,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
movzbl 0x40(%rsp),%edx
cmp    $0x20,%dl
sete   %cl
and    $0xdf,%dl
cmp    $0xa,%dl
sete   %dl
test   %rax,%rax
je     119d <getintpar+0x4d>
or     %dl,%cl
jne    1170 <getintpar+0x20>
lea    0xe5c(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rdx
call   1060 <sprintf@plt>
lea    0x40(%rsp),%rdi
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     11f7 <getintpar+0xa7>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
mov    %r15,%rdx
call   1040 <fprintf@plt>
lea    0xe28(%rip),%rdi
call   1070 <error1@plt>
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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