#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 */
scalar_t__ EOF;
scalar_t__ calloc(int, int);
int /*<<< orphan*/ error_print(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ realloc(double *, int);
scalar_t__ scanf(char *, double *);
scalar_t__ sqrt(double);
int /*<<< orphan*/ sscanf(char *, char *, double *);
int /*<<< orphan*/ stderr;
void main(int argc, char *argv[]) {
  double *x, dum, koeff;
  int i, nn, j;
  long ik;
  if (argc < 2 || argc > 2) {
    error_print(argv[0]);
    exit(1);
  }
  sscanf(argv[1], "%le", &koeff);
  x = (double *)calloc(1, sizeof(double));
  ik = 0;
  while ((scanf("%le", &dum)) != EOF) {
    x = (double *)realloc(x, sizeof(double) * (ik + 1));
    if (x == NULL) {
      fprintf(stderr, "negate: Allocation error while reading, exiting\n");
      exit(1);
    }
    x[ik] = dum;
    ik++;
  }
  nn = (int)sqrt((double)ik);
  for (i = 1; i <= nn; i++) {
    for (j = 1; j <= nn; j++) {
      ik = (i - 1) * nn + j - 1;
      printf("%e \n", x[ik] * koeff);
    }
    printf("\n");
  }
  free(x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     11c3 <main+0x23>
cmpl   $0x2,-0x4(%rbp)
jle    11d9 <main+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <error_print@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe18(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1070 <sscanf@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x40(%rbp)
lea    0xded(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   10a0 <scanf@plt>
mov    0x2dc5(%rip),%rcx
cmp    (%rcx),%rax
je     1294 <main+0xf4>
mov    -0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
add    $0x1,%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1090 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1271 <main+0xd1>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
lea    0xda2(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    120c <main+0x6c>
cvtsi2sdq -0x40(%rbp),%xmm0
call   10b0 <sqrt@plt>
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     1328 <main+0x188>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     130c <main+0x16c>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
imul   -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x28(%rbp),%xmm0
lea    0xd3e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12bc <main+0x11c>
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12a9 <main+0x109>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x2,%edi
jne    1337 <main+0x187>
mov    0x8(%rsi),%rdi
lea    0xe2e(%rip),%r14
lea    0x20(%rsp),%rdx
mov    %r14,%rsi
call   1080 <sscanf@plt>
mov    $0x8,%r13d
mov    $0x1,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   10b0 <scanf@plt>
mov    0x2ddd(%rip),%r12
cmp    (%r12),%rax
jne    1217 <main+0x67>
xorpd  %xmm0,%xmm0
jmp    1273 <main+0xc3>
xor    %ebp,%ebp
lea    0xde0(%rip),%r14
lea    0x10(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r13d,%esi
call   10a0 <realloc@plt>
test   %rax,%rax
je     1318 <main+0x168>
mov    %rax,%rbx
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rax,%rbp,8)
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <scanf@plt>
add    $0x8,%r13d
add    $0x1,%rbp
cmp    (%r12),%rax
jne    1230 <main+0x80>
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
call   10c0 <sqrt@plt>
mov    %rax,0x8(%rsp)
test   %eax,%eax
jle    1301 <main+0x151>
mov    0x8(%rsp),%rax
add    $0x1,%eax
add    $0xffffffffffffffff,%rax
mov    %rax,0x18(%rsp)
mov    $0x1,%r13d
xor    %r12d,%r12d
lea    0xd8f(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
mov    0x18(%rsp),%r15
mov    %r12d,%r14d
nopl   0x0(%rax,%rax,1)
movslq %r14d,%r14
movsd  (%rbx,%r14,8),%xmm0
mulsd  0x20(%rsp),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r14d
add    $0xffffffffffffffff,%r15
jne    12c0 <main+0x110>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0x1(%r13),%eax
mov    0x8(%rsp),%rcx
add    %ecx,%r12d
cmp    %ecx,%r13d
mov    %eax,%r13d
jne    12b0 <main+0x100>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
lea    0xcdc(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    (%rsi),%rdi
call   1090 <error_print@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%le\00"
@EOF = global i64 0
@stderr = global i32 0
@.str.1 = [49 x i8] c"negate: Allocation error while reading, exiting\0A\00"
@.str.2 = [5 x i8] c"%e \0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 2
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 2
br i1 %16, label %17, label %23
17: ; preds = %14, %2
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @error_print(i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %14
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %7)
%28 = call i64 @calloc(i32 1, i32 8)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %5
store i64 0, i64* %11
br label %30
30: ; preds = %48, %23
%31 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %6)
%32 = load i64, i64* @EOF
%33 = icmp ne i64 %31, %32
br i1 %33, label %34, label %55
34: ; preds = %30
%35 = load double*, double** %5
%36 = load i64, i64* %11
%37 = add nsw i64 %36, 1
%38 = mul i64 8, %37
%39 = trunc i64 %38 to i32
%40 = call i64 @realloc(double* %35, i32 %39)
%41 = inttoptr i64 %40 to double*
store double* %41, double** %5
%42 = load double*, double** %5
%43 = icmp eq double* %42, null
br i1 %43, label %44, label %48
44: ; preds = %34
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %34
%49 = load double, double* %6
%50 = load double*, double** %5
%51 = load i64, i64* %11
%52 = getelementptr inbounds double, double* %50, i64 %51
store double %49, double* %52
%53 = load i64, i64* %11
%54 = add nsw i64 %53, 1
store i64 %54, i64* %11
br label %30
55: ; preds = %30
%56 = load i64, i64* %11
%57 = sitofp i64 %56 to double
%58 = call i64 @sqrt(double %57)
%59 = trunc i64 %58 to i32
store i32 %59, i32* %9
store i32 1, i32* %8
br label %60
60: ; preds = %90, %55
%61 = load i32, i32* %8
%62 = load i32, i32* %9
%63 = icmp sle i32 %61, %62
br i1 %63, label %64, label %93
64: ; preds = %60
store i32 1, i32* %10
br label %65
65: ; preds = %85, %64
%66 = load i32, i32* %10
%67 = load i32, i32* %9
%68 = icmp sle i32 %66, %67
br i1 %68, label %69, label %88
69: ; preds = %65
%70 = load i32, i32* %8
%71 = sub nsw i32 %70, 1
%72 = load i32, i32* %9
%73 = mul nsw i32 %71, %72
%74 = load i32, i32* %10
%75 = add nsw i32 %73, %74
%76 = sub nsw i32 %75, 1
%77 = sext i32 %76 to i64
store i64 %77, i64* %11
%78 = load double*, double** %5
%79 = load i64, i64* %11
%80 = getelementptr inbounds double, double* %78, i64 %79
%81 = load double, double* %80
%82 = load double, double* %7
%83 = fmul double %81, %82
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %83)
br label %85
85: ; preds = %69
%86 = load i32, i32* %10
%87 = add nsw i32 %86, 1
store i32 %87, i32* %10
br label %65
88: ; preds = %65
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %90
90: ; preds = %88
%91 = load i32, i32* %8
%92 = add nsw i32 %91, 1
store i32 %92, i32* %8
br label %60
93: ; preds = %60
%94 = load double*, double** %5
%95 = call i32 @free(double* %94)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%le\00"
@EOF = global i64 0
@stderr = global i32 0
@.str.1 = [49 x i8] c"negate: Allocation error while reading, exiting\0A\00"
@.str.2 = [5 x i8] c"%e \0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %3 to i8*
%6 = bitcast double* %4 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @error_print(i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %4)
%16 = call i64 @calloc(i32 1, i32 8)
%17 = inttoptr i64 %16 to double*
%18 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %43, label %21
21: ; preds = %12, %34
%22 = phi i64 [ %24, %34 ], [ 0, %12 ]
%23 = phi double* [ %28, %34 ], [ %17, %12 ]
%24 = add nuw nsw i64 %22, 1
%25 = trunc i64 %24 to i32
%26 = shl i32 %25, 3
%27 = call i64 @realloc(double* %23, i32 %26)
%28 = inttoptr i64 %27 to double*
%29 = icmp eq i64 %27, 0
br i1 %29, label %30, label %34
30: ; preds = %21
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %21
%35 = load double, double* %3
%36 = getelementptr inbounds double, double* %28, i64 %22
store double %35, double* %36
%37 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%38 = load i64, i64* @EOF
%39 = icmp eq i64 %37, %38
br i1 %39, label %40, label %21
40: ; preds = %34
%41 = inttoptr i64 %27 to double*
%42 = sitofp i64 %24 to double
br label %43
43: ; preds = %40, %12
%44 = phi double* [ %41, %40 ], [ %17, %12 ]
%45 = phi double [ %42, %40 ], [ 0.000000e+00, %12 ]
%46 = call i64 @sqrt(double %45)
%47 = trunc i64 %46 to i32
%48 = icmp slt i32 %47, 1
br i1 %48, label %73, label %49
49: ; preds = %43
%50 = add i64 %46, 1
%51 = and i64 %50, 4294967295
br label %52
52: ; preds = %69, %49
%53 = phi i32 [ 1, %49 ], [ %71, %69 ]
%54 = add nsw i32 %53, -1
%55 = mul nsw i32 %54, %47
%56 = add i32 %55, -1
br label %57
57: ; preds = %52, %57
%58 = phi i64 [ 1, %52 ], [ %67, %57 ]
%59 = trunc i64 %58 to i32
%60 = add i32 %56, %59
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %44, i64 %61
%63 = load double, double* %62
%64 = load double, double* %4
%65 = fmul double %63, %64
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %65)
%67 = add nuw nsw i64 %58, 1
%68 = icmp eq i64 %67, %51
br i1 %68, label %69, label %57
69: ; preds = %57
%70 = call i32 @putchar(i32 10)
%71 = add nuw i32 %53, 1
%72 = icmp eq i32 %53, %47
br i1 %72, label %73, label %52
73: ; preds = %69, %43
%74 = call i32 @free(double* %44)
ret void
}