#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*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
void reading(double *_grd, int no_grd, int n_grd, FILE *fp) {
  int ix, j, i;
  double dx_l;
  double dx_r;
  double c;
  int n;
  int l_dir;
  double q;
  char buf[256];
  fgets(buf, 256, fp);
  fgets(buf, 256, fp);
  ix = 0;
  sscanf(buf, "%lf", &(_grd[ix]));
  ix++;
  for (j = 1; j <= no_grd; j++) {
    fgets(buf, 256, fp);
    sscanf(buf, "%lf", &dx_l);
    fgets(buf, 256, fp);
    sscanf(buf, "%lf", &dx_r);
    fgets(buf, 256, fp);
    sscanf(buf, "%lf", &c);
    fgets(buf, 256, fp);
    sscanf(buf, "%d", &n);
    n--;
    fgets(buf, 256, fp);
    fgets(buf, 256, fp);
    sscanf(buf, "%d", &l_dir);
    fgets(buf, 256, fp);
    fgets(buf, 256, fp);
    sscanf(buf, "%lf", &(_grd[ix + n - 1]));
    if (l_dir == 1) {
      q = dx_l;
      for (i = 1; i <= n - 1; i++) {
        _grd[ix] = _grd[ix - 1] + q;
        ix++;
        q = q * c;
      }
      ix++;
    } else {
      q = dx_r;
      ix = ix + n - 2;
      for (i = n - 1; i >= 1; i--) {
        _grd[ix] = _grd[ix + 1] - q;
        ix--;
        q = q * c;
      }
      ix = ix + n + 1;
    }
  }
}


x86 assembly (clang, -O0):
<reading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
movl   $0x0,-0x1c(%rbp)
lea    -0x150(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1419 <reading+0x2f9>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
lea    0xe33(%rip),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
lea    0xe05(%rip),%rsi
lea    -0x38(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
lea    0xdd7(%rip),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
lea    0xdad(%rip),%rsi
lea    -0x44(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
lea    0xd61(%rip),%rsi
lea    -0x48(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1030 <fgets@plt>
lea    -0x150(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x1c(%rbp),%eax
add    -0x44(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
lea    0xd04(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
cmpl   $0x1,-0x48(%rbp)
jne    1387 <reading+0x267>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1379 <reading+0x259>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    131e <reading+0x1fe>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1406 <reading+0x2e6>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x44(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jl     13fa <reading+0x2da>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    13a6 <reading+0x286>
mov    -0x1c(%rbp),%eax
add    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    140b <reading+0x2eb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119e <reading+0x7e>
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reading>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rcx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0x40(%rsp),%r15
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rcx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
lea    0xe9a(%rip),%rsi
mov    %r15,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r14d,0x18(%rsp)
test   %r14d,%r14d
jle    140d <reading+0x2ed>
lea    0x8(%rbp),%rax
mov    %rax,0x28(%rsp)
mov    $0x1,%eax
lea    0x40(%rsp),%r15
mov    $0x1,%r13d
jmp    11b9 <reading+0x99>
nopl   0x0(%rax)
mov    0x10(%rsp),%rsi
add    %ecx,%r13d
add    $0x1,%r13d
lea    0x1(%rsi),%eax
cmp    0x18(%rsp),%esi
je     140d <reading+0x2ed>
mov    %rax,0x10(%rsp)
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
lea    0xe28(%rip),%r14
mov    %r14,%rsi
lea    0x38(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
mov    %r14,%rsi
lea    0x30(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
mov    %r14,%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
lea    0xdbf(%rip),%r12
mov    %r12,%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
addl   $0xffffffff,0xc(%rsp)
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
mov    %r12,%rsi
lea    0x1c(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r15,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    0xc(%rsp),%eax
add    %r13d,%eax
add    $0xffffffff,%eax
cltq
lea    0x0(,%rax,8),%rdx
add    %rbp,%rdx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <sscanf@plt>
cmpl   $0x1,0x1c(%rsp)
mov    0xc(%rsp),%ecx
jne    1320 <reading+0x200>
cmp    $0x2,%ecx
jl     1380 <reading+0x260>
movsd  0x38(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movslq %r13d,%r13
movsd  -0x8(%rbp,%r13,8),%xmm2
lea    -0x1(%rcx),%edx
add    $0xfffffffe,%ecx
mov    %edx,%eax
and    $0x3,%eax
cmp    $0x3,%ecx
jae    138a <reading+0x26a>
mov    0x10(%rsp),%rsi
jmp    13e5 <reading+0x2c5>
nopw   0x0(%rax,%rax,1)
add    %ecx,%r13d
add    $0xfffffffe,%r13d
cmp    $0x2,%ecx
jl     11a0 <reading+0x80>
movsd  0x30(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
movslq %r13d,%rax
mov    0x28(%rsp),%rdx
lea    (%rdx,%rax,8),%rax
lea    0x1(%rcx),%edx
mov    0x10(%rsp),%rsi
movsd  (%rax),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,-0x8(%rax)
add    $0xfffffffffffffff8,%rax
mulsd  %xmm1,%xmm0
add    $0xffffffff,%r13d
add    $0xffffffff,%edx
cmp    $0x2,%edx
ja     1350 <reading+0x230>
jmp    11a5 <reading+0x85>
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%rsi
jmp    11a8 <reading+0x88>
and    $0xfffffffc,%edx
mov    0x10(%rsp),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
addsd  %xmm0,%xmm2
movsd  %xmm2,0x0(%rbp,%r13,8)
mulsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rbp,%r13,8)
mulsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rbp,%r13,8)
mulsd  %xmm1,%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%rbp,%r13,8)
add    $0x4,%r13
mulsd  %xmm1,%xmm0
add    $0xfffffffc,%edx
jne    13a0 <reading+0x280>
test   %eax,%eax
je     11a8 <reading+0x88>
nopl   (%rax)
addsd  %xmm0,%xmm2
movsd  %xmm2,0x0(%rbp,%r13,8)
add    $0x1,%r13
mulsd  %xmm1,%xmm0
add    $0xffffffff,%eax
jne    13f0 <reading+0x2d0>
jmp    11a8 <reading+0x88>
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [3 x i8] c"%d\00"
define void @reading(double* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca [256 x i8]
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%20 = load i32*, i32** %8
%21 = call i32 @fgets(i8* %19, i32 256, i32* %20)
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%23 = load i32*, i32** %8
%24 = call i32 @fgets(i8* %22, i32 256, i32* %23)
store i32 0, i32* %9
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%26 = load double*, double** %5
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = call i32 (i8*, i8*, ...) @sscanf(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %29)
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
store i32 1, i32* %10
br label %33
33: ; preds = %154, %4
%34 = load i32, i32* %10
%35 = load i32, i32* %6
%36 = icmp sle i32 %34, %35
br i1 %36, label %37, label %157
37: ; preds = %33
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%39 = load i32*, i32** %8
%40 = call i32 @fgets(i8* %38, i32 256, i32* %39)
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%42 = call i32 (i8*, i8*, ...) @sscanf(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %12)
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%44 = load i32*, i32** %8
%45 = call i32 @fgets(i8* %43, i32 256, i32* %44)
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%47 = call i32 (i8*, i8*, ...) @sscanf(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %13)
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%49 = load i32*, i32** %8
%50 = call i32 @fgets(i8* %48, i32 256, i32* %49)
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%52 = call i32 (i8*, i8*, ...) @sscanf(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %14)
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%54 = load i32*, i32** %8
%55 = call i32 @fgets(i8* %53, i32 256, i32* %54)
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%57 = call i32 (i8*, i8*, ...) @sscanf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%58 = load i32, i32* %15
%59 = add nsw i32 %58, -1
store i32 %59, i32* %15
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%61 = load i32*, i32** %8
%62 = call i32 @fgets(i8* %60, i32 256, i32* %61)
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%64 = load i32*, i32** %8
%65 = call i32 @fgets(i8* %63, i32 256, i32* %64)
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%67 = call i32 (i8*, i8*, ...) @sscanf(i8* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%69 = load i32*, i32** %8
%70 = call i32 @fgets(i8* %68, i32 256, i32* %69)
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%72 = load i32*, i32** %8
%73 = call i32 @fgets(i8* %71, i32 256, i32* %72)
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%75 = load double*, double** %5
%76 = load i32, i32* %9
%77 = load i32, i32* %15
%78 = add nsw i32 %76, %77
%79 = sub nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %75, i64 %80
%82 = call i32 (i8*, i8*, ...) @sscanf(i8* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %81)
%83 = load i32, i32* %16
%84 = icmp eq i32 %83, 1
br i1 %84, label %85, label %116
85: ; preds = %37
%86 = load double, double* %12
store double %86, double* %17
store i32 1, i32* %11
br label %87
87: ; preds = %110, %85
%88 = load i32, i32* %11
%89 = load i32, i32* %15
%90 = sub nsw i32 %89, 1
%91 = icmp sle i32 %88, %90
br i1 %91, label %92, label %113
92: ; preds = %87
%93 = load double*, double** %5
%94 = load i32, i32* %9
%95 = sub nsw i32 %94, 1
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %93, i64 %96
%98 = load double, double* %97
%99 = load double, double* %17
%100 = fadd double %98, %99
%101 = load double*, double** %5
%102 = load i32, i32* %9
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %101, i64 %103
store double %100, double* %104
%105 = load i32, i32* %9
%106 = add nsw i32 %105, 1
store i32 %106, i32* %9
%107 = load double, double* %17
%108 = load double, double* %14
%109 = fmul double %107, %108
store double %109, double* %17
br label %110
110: ; preds = %92
%111 = load i32, i32* %11
%112 = add nsw i32 %111, 1
store i32 %112, i32* %11
br label %87
113: ; preds = %87
%114 = load i32, i32* %9
%115 = add nsw i32 %114, 1
store i32 %115, i32* %9
br label %153
116: ; preds = %37
%117 = load double, double* %13
store double %117, double* %17
%118 = load i32, i32* %9
%119 = load i32, i32* %15
%120 = add nsw i32 %118, %119
%121 = sub nsw i32 %120, 2
store i32 %121, i32* %9
%122 = load i32, i32* %15
%123 = sub nsw i32 %122, 1
store i32 %123, i32* %11
br label %124
124: ; preds = %145, %116
%125 = load i32, i32* %11
%126 = icmp sge i32 %125, 1
br i1 %126, label %127, label %148
127: ; preds = %124
%128 = load double*, double** %5
%129 = load i32, i32* %9
%130 = add nsw i32 %129, 1
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %128, i64 %131
%133 = load double, double* %132
%134 = load double, double* %17
%135 = fsub double %133, %134
%136 = load double*, double** %5
%137 = load i32, i32* %9
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
store double %135, double* %139
%140 = load i32, i32* %9
%141 = add nsw i32 %140, -1
store i32 %141, i32* %9
%142 = load double, double* %17
%143 = load double, double* %14
%144 = fmul double %142, %143
store double %144, double* %17
br label %145
145: ; preds = %127
%146 = load i32, i32* %11
%147 = add nsw i32 %146, -1
store i32 %147, i32* %11
br label %124
148: ; preds = %124
%149 = load i32, i32* %9
%150 = load i32, i32* %15
%151 = add nsw i32 %149, %150
%152 = add nsw i32 %151, 1
store i32 %152, i32* %9
br label %153
153: ; preds = %148, %113
br label %154
154: ; preds = %153
%155 = load i32, i32* %10
%156 = add nsw i32 %155, 1
store i32 %156, i32* %10
br label %33
157: ; preds = %33
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [3 x i8] c"%d\00"
define void @reading(double* %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca [256 x i8]
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = bitcast i32* %9 to i8*
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%17 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%18 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%19 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %0)
%20 = icmp slt i32 %1, 1
br i1 %20, label %138, label %21
21: ; preds = %4
%22 = getelementptr double, double* %0, i64 -1
br label %23
23: ; preds = %21, %133
%24 = phi i32 [ %136, %133 ], [ 1, %21 ]
%25 = phi i32 [ %135, %133 ], [ 1, %21 ]
%26 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%27 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %5)
%28 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%29 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %6)
%30 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%32 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%33 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%34 = load i32, i32* %8
%35 = add nsw i32 %34, -1
store i32 %35, i32* %8
%36 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%37 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%38 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%39 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%40 = call i32 @fgets(i8* %16, i32 256, i32* %3)
%41 = load i32, i32* %8
%42 = add i32 %25, -1
%43 = add i32 %42, %41
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %0, i64 %44
%46 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %45)
%47 = load i32, i32* %9
%48 = icmp eq i32 %47, 1
%49 = load i32, i32* %8
br i1 %48, label %50, label %87
50: ; preds = %23
%51 = icmp sgt i32 %49, 1
br i1 %51, label %52, label %133
52: ; preds = %50
%53 = load double, double* %5
%54 = load double, double* %7
%55 = sext i32 %25 to i64
%56 = getelementptr double, double* %22, i64 %55
%57 = load double, double* %56
%58 = add i32 %49, -1
%59 = add i32 %49, -2
%60 = and i32 %58, 3
%61 = icmp ult i32 %59, 3
br i1 %61, label %113, label %62
62: ; preds = %52
%63 = and i32 %58, -4
br label %64
64: ; preds = %64, %62
%65 = phi double [ %57, %62 ], [ %81, %64 ]
%66 = phi i64 [ %55, %62 ], [ %83, %64 ]
%67 = phi double [ %53, %62 ], [ %84, %64 ]
%68 = phi i32 [ 0, %62 ], [ %85, %64 ]
%69 = fadd double %67, %65
%70 = getelementptr inbounds double, double* %0, i64 %66
store double %69, double* %70
%71 = add nsw i64 %66, 1
%72 = fmul double %67, %54
%73 = fadd double %72, %69
%74 = getelementptr inbounds double, double* %0, i64 %71
store double %73, double* %74
%75 = add nsw i64 %66, 2
%76 = fmul double %72, %54
%77 = fadd double %76, %73
%78 = getelementptr inbounds double, double* %0, i64 %75
store double %77, double* %78
%79 = add nsw i64 %66, 3
%80 = fmul double %76, %54
%81 = fadd double %80, %77
%82 = getelementptr inbounds double, double* %0, i64 %79
store double %81, double* %82
%83 = add nsw i64 %66, 4
%84 = fmul double %80, %54
%85 = add i32 %68, 4
%86 = icmp eq i32 %85, %63
br i1 %86, label %113, label %64
87: ; preds = %23
%88 = add i32 %25, -2
%89 = add i32 %88, %49
%90 = icmp sgt i32 %49, 1
br i1 %90, label %91, label %110
91: ; preds = %87
%92 = load double, double* %6
%93 = load double, double* %7
%94 = sext i32 %89 to i64
br label %95
95: ; preds = %91, %95
%96 = phi i64 [ %94, %91 ], [ %105, %95 ]
%97 = phi double [ %92, %91 ], [ %106, %95 ]
%98 = phi i32 [ %49, %91 ], [ %99, %95 ]
%99 = add nsw i32 %98, -1
%100 = add nsw i64 %96, 1
%101 = getelementptr inbounds double, double* %0, i64 %100
%102 = load double, double* %101
%103 = fsub double %102, %97
%104 = getelementptr inbounds double, double* %0, i64 %96
store double %103, double* %104
%105 = add nsw i64 %96, -1
%106 = fmul double %97, %93
%107 = icmp ugt i32 %98, 2
br i1 %107, label %95, label %108
108: ; preds = %95
%109 = trunc i64 %105 to i32
br label %110
110: ; preds = %108, %87
%111 = phi i32 [ %89, %87 ], [ %109, %108 ]
%112 = add nsw i32 %111, %49
br label %133
113: ; preds = %64, %52
%114 = phi i64 [ undef, %52 ], [ %83, %64 ]
%115 = phi double [ %57, %52 ], [ %81, %64 ]
%116 = phi i64 [ %55, %52 ], [ %83, %64 ]
%117 = phi double [ %53, %52 ], [ %84, %64 ]
%118 = icmp eq i32 %60, 0
br i1 %118, label %130, label %119
119: ; preds = %113, %119
%120 = phi double [ %124, %119 ], [ %115, %113 ]
%121 = phi i64 [ %126, %119 ], [ %116, %113 ]
%122 = phi double [ %127, %119 ], [ %117, %113 ]
%123 = phi i32 [ %128, %119 ], [ 0, %113 ]
%124 = fadd double %122, %120
%125 = getelementptr inbounds double, double* %0, i64 %121
store double %124, double* %125
%126 = add nsw i64 %121, 1
%127 = fmul double %122, %54
%128 = add i32 %123, 1
%129 = icmp eq i32 %128, %60
br i1 %129, label %130, label %119
130: ; preds = %119, %113
%131 = phi i64 [ %114, %113 ], [ %126, %119 ]
%132 = trunc i64 %131 to i32
br label %133
133: ; preds = %130, %50, %110
%134 = phi i32 [ %112, %110 ], [ %25, %50 ], [ %132, %130 ]
%135 = add nsw i32 %134, 1
%136 = add nuw i32 %24, 1
%137 = icmp eq i32 %24, %1
br i1 %137, label %138, label %23
138: ; preds = %133, %4
ret void
}