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

/* Variables and functions */
int /*<<< orphan*/ AskDouble(char *, double *);
int /*<<< orphan*/ AskInt(char *, int *);
int /*<<< orphan*/ AskString(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void GetInf(char *InFile, char *OutFil, double *sLengt, double *sFinal,
            int *NumItr, int MaxItr, int *mForm, int *LakeForm) {
  InFile[0] = (char)0;
  AskString("What is the input data file name? <Quit>", InFile);
  if (!InFile[0])
    return;
  do
    AskString("What is the output data file?", OutFil);
  while (!strcmp(InFile, OutFil));
  AskDouble("What is the slit length (x-axis units)?", sLengt);
  printf("Extrapolation forms to avoid truncation-error.\n"
         "   1 = flat background, I(q) = B\n"
         "   2 = linear, I(q) = b + q * m\n"
         "   3 = power law, I(q) = b * q^m\n"
         "   4 = Porod law, I(q) = Cp + Bkg / q^4\n");
  AskInt("Which form?", mForm);
  AskDouble("What X to begin evaluating extrapolation (x-axis units)?", sFinal);
  AskInt("How many iteration(s)? (10000 = infinite)", NumItr);
  printf(" Weighting methods for iterative corrections:\n"
         " Correction = weight * (MeasuredI - SmearedI)\n"
         "   #1) weight = 1.0\n"
         "   #2) weight = CorrectedI / SmearedI\n"
         "   #3) weight = 2*SQRT(ChiSqr(0) / ChiSqr(i))\n");
  AskInt("Which method?", LakeForm);
}


x86 assembly (clang, -O0):
<GetInf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1060 <AskString@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11a1 <GetInf+0x51>
jmp    123b <GetInf+0xeb>
jmp    11a6 <GetInf+0x56>
mov    -0x10(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1060 <AskString@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a6 <GetInf+0x56>
mov    -0x18(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1050 <AskDouble@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    0x10(%rbp),%rsi
lea    0xf2f(%rip),%rdi
call   1030 <AskInt@plt>
mov    -0x20(%rbp),%rsi
lea    0xf2b(%rip),%rdi
call   1050 <AskDouble@plt>
mov    -0x28(%rbp),%rsi
lea    0xf54(%rip),%rdi
call   1030 <AskInt@plt>
lea    0xf72(%rip),%rdi
call   1040 <printf@plt>
mov    0x18(%rbp),%rsi
lea    0x1027(%rip),%rdi
call   1030 <AskInt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetInf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r15
mov    %rcx,0x10(%rsp)
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%r14
mov    0x58(%rsp),%rbx
mov    0x50(%rsp),%r13
movb   $0x0,(%rdi)
lea    0xe7d(%rip),%rdi
mov    %r14,%rsi
call   1060 <AskString@plt>
cmpb   $0x0,(%r14)
je     1240 <GetInf+0xf0>
mov    %r15,(%rsp)
mov    %rbx,0x8(%rsp)
lea    0xe84(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %rbp,%rsi
call   1060 <AskString@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11b0 <GetInf+0x60>
lea    0xe76(%rip),%rdi
mov    %r12,%rsi
call   1050 <AskDouble@plt>
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe83(%rip),%rdi
mov    %r13,%rsi
call   1040 <AskInt@plt>
lea    0xe80(%rip),%rdi
mov    0x10(%rsp),%rsi
call   1050 <AskDouble@plt>
lea    0xea8(%rip),%rdi
mov    (%rsp),%rsi
call   1040 <AskInt@plt>
lea    0xf89(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
mov    0x8(%rsp),%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <AskInt@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"What is the input data file name? <Quit>\00"
@.str.1 = [30 x i8] c"What is the output data file?\00"
@.str.2 = [40 x i8] c"What is the slit length (x-axis units)?\00"
@.str.3 = [186 x i8] c"Extrapolation forms to avoid truncation-error.\0A 1 = flat background, I(q) = B\0A 2 = linear, I(q) = b + q * m\0A 3 = power law, I(q) = b * q^m\0A 4 = Porod law, I(q) = Cp + Bkg / q^4\0A\00"
@.str.4 = [12 x i8] c"Which form?\00"
@.str.5 = [57 x i8] c"What X to begin evaluating extrapolation (x-axis units)?\00"
@.str.6 = [42 x i8] c"How many iteration(s)? (10000 = infinite)\00"
@.str.7 = [197 x i8] c" Weighting methods for iterative corrections:\0A Correction = weight * (MeasuredI - SmearedI)\0A) weight = 1.0\0A) weight = CorrectedI / SmearedI\0A) weight = 2*SQRT(ChiSqr(0) / ChiSqr(i))\0A\00"
@.str.8 = [14 x i8] c"Which method?\00"
define void @GetInf(i8* %0, i8* %1, double* %2, double* %3, i32* %4, i32 %5, i32* %6, i32* %7) {
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32*
%16 = alloca i32*
store i8* %0, i8** %9
store i8* %1, i8** %10
store double* %2, double** %11
store double* %3, double** %12
store i32* %4, i32** %13
store i32 %5, i32* %14
store i32* %6, i32** %15
store i32* %7, i32** %16
%17 = load i8*, i8** %9
%18 = getelementptr inbounds i8, i8* %17, i64 0
store i8 0, i8* %18
%19 = load i8*, i8** %9
%20 = call i32 @AskString(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %9
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %8
br label %49
26: ; preds = %8
br label %27
27: ; preds = %30, %26
%28 = load i8*, i8** %10
%29 = call i32 @AskString(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %27
%31 = load i8*, i8** %9
%32 = load i8*, i8** %10
%33 = call i32 @strcmp(i8* %31, i8* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %27, label %36
36: ; preds = %30
%37 = load double*, double** %11
%38 = call i32 @AskDouble(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double* %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([186 x i8], [186 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32*, i32** %15
%41 = call i32 @AskInt(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %40)
%42 = load double*, double** %12
%43 = call i32 @AskDouble(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), double* %42)
%44 = load i32*, i32** %13
%45 = call i32 @AskInt(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32* %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.7, i64 0, i64 0))
%47 = load i32*, i32** %16
%48 = call i32 @AskInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32* %47)
br label %49
49: ; preds = %36, %25
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"What is the input data file name? <Quit>\00"
@.str.1 = [30 x i8] c"What is the output data file?\00"
@.str.2 = [40 x i8] c"What is the slit length (x-axis units)?\00"
@.str.4 = [12 x i8] c"Which form?\00"
@.str.5 = [57 x i8] c"What X to begin evaluating extrapolation (x-axis units)?\00"
@.str.6 = [42 x i8] c"How many iteration(s)? (10000 = infinite)\00"
@.str.8 = [14 x i8] c"Which method?\00"
@str = [185 x i8] c"Extrapolation forms to avoid truncation-error.\0A 1 = flat background, I(q) = B\0A 2 = linear, I(q) = b + q * m\0A 3 = power law, I(q) = b * q^m\0A 4 = Porod law, I(q) = Cp + Bkg / q^4\00"
@str.9 = [196 x i8] c" Weighting methods for iterative corrections:\0A Correction = weight * (MeasuredI - SmearedI)\0A) weight = 1.0\0A) weight = CorrectedI / SmearedI\0A) weight = 2*SQRT(ChiSqr(0) / ChiSqr(i))\00"
define void @GetInf(i8* %0, i8* %1, double* %2, double* %3, i32* %4, i32 %5, i32* %6, i32* %7) {
store i8 0, i8* %0
%9 = tail call i32 @AskString(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
%10 = load i8, i8* %0
%11 = icmp eq i8 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %8, %12
%13 = tail call i32 @AskString(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%14 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(1) %1)
%15 = icmp eq i32 %14, 0
br i1 %15, label %12, label %16
16: ; preds = %12
%17 = tail call i32 @AskDouble(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double* %2)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([185 x i8], [185 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @AskInt(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%20 = tail call i32 @AskDouble(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), double* %3)
%21 = tail call i32 @AskInt(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32* %4)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([196 x i8], [196 x i8]* @str.9, i64 0, i64 0))
%23 = tail call i32 @AskInt(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32* %7)
br label %24
24: ; preds = %8, %16
ret void
}