#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 EOF;
char fgetc(int /*<<< orphan*/ *);
int fscanf(int /*<<< orphan*/ *, char *, double *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ skipWord(int /*<<< orphan*/ *);
double row(FILE *stream, int *tab) {
  double somme = 0., number;
  int test, line = 1, i = 0;
  while ((test = fscanf(stream, "%lf", &number)) != EOF) {
    if (!test)
      skipWord(stream);
    if (!tab) {
      if (fgetc(stream) == '\n') {
        somme += number;
        printf("%lf \n", somme);
        somme = 0.;
        number = 0.;
      }
      somme += number;
    } else {
      if (line == tab[i]) {
        somme += number;
      }
      if (fgetc(stream) == '\n') {
        if (line == tab[i]) {
          i++;
          printf("%lf \n", somme);
        }
        line++;
        somme = 0.;
        number = 0.;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%eax
je     128c <row+0x14c>
cmpl   $0x0,-0x24(%rbp)
jne    119f <row+0x5f>
mov    -0x8(%rbp),%rdi
call   1060 <skipWord@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1203 <row+0xc3>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    11ef <row+0xaf>
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1287 <row+0x147>
mov    -0x28(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1226 <row+0xe6>
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    1282 <row+0x142>
mov    -0x28(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1269 <row+0x129>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xda0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1287 <row+0x147>
jmp    1166 <row+0x26>
xorps  %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<row>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xead(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1040 <fscanf@plt>
mov    0x2e7c(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    1184 <row+0x44>
xorpd  %xmm0,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xorpd  %xmm1,%xmm1
mov    $0x1,%r15d
xor    %r12d,%r12d
jmp    11d6 <row+0x96>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15d
movq   $0x0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
lea    0xe47(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1040 <fscanf@plt>
cmp    0x0(%rbp),%eax
movsd  0x8(%rsp),%xmm1
je     1171 <row+0x31>
test   %eax,%eax
je     1200 <row+0xc0>
test   %r14,%r14
je     1219 <row+0xd9>
movslq %r12d,%r13
cmp    (%r14,%r13,4),%r15d
je     1250 <row+0x110>
movsd  0xe10(%rip),%xmm0
jmp    1256 <row+0x116>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
movsd  %xmm1,0x8(%rsp)
call   1060 <skipWord@plt>
movsd  0x8(%rsp),%xmm1
test   %r14,%r14
jne    11df <row+0x9f>
mov    %rbx,%rdi
movsd  %xmm1,0x8(%rsp)
call   1050 <fgetc@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
cmp    $0xa,%al
jne    11b1 <row+0x71>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
jmp    11a4 <row+0x64>
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    $0xa,%al
jne    11b7 <row+0x77>
cmp    (%r14,%r13,4),%r15d
jne    11a0 <row+0x60>
add    $0x1,%r12d
lea    0xd87(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
jmp    11a0 <row+0x60>

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@EOF = global i32 0
@.str.1 = [6 x i8] c"%lf \0A\00"
define double @row(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store double 0.000000e+00, double* %5
store i32 1, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %73, %2
%11 = load i32*, i32** %3
%12 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %6)
store i32 %12, i32* %7
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %74
15: ; preds = %10
%16 = load i32, i32* %7
%17 = icmp ne i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32*, i32** %3
%20 = call i32 @skipWord(i32* %19)
br label %21
21: ; preds = %18, %15
%22 = load i32*, i32** %4
%23 = icmp ne i32* %22, null
br i1 %23, label %39, label %24
24: ; preds = %21
%25 = load i32*, i32** %3
%26 = call signext i8 @fgetc(i32* %25)
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %35
29: ; preds = %24
%30 = load double, double* %6
%31 = load double, double* %5
%32 = fadd double %31, %30
store double %32, double* %5
%33 = load double, double* %5
%34 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %33)
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
br label %35
35: ; preds = %29, %24
%36 = load double, double* %6
%37 = load double, double* %5
%38 = fadd double %37, %36
store double %38, double* %5
br label %73
39: ; preds = %21
%40 = load i32, i32* %8
%41 = load i32*, i32** %4
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
%46 = icmp eq i32 %40, %45
br i1 %46, label %47, label %51
47: ; preds = %39
%48 = load double, double* %6
%49 = load double, double* %5
%50 = fadd double %49, %48
store double %50, double* %5
br label %51
51: ; preds = %47, %39
%52 = load i32*, i32** %3
%53 = call signext i8 @fgetc(i32* %52)
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 10
br i1 %55, label %56, label %72
56: ; preds = %51
%57 = load i32, i32* %8
%58 = load i32*, i32** %4
%59 = load i32, i32* %9
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
%62 = load i32, i32* %61
%63 = icmp eq i32 %57, %62
br i1 %63, label %64, label %69
64: ; preds = %56
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
%67 = load double, double* %5
%68 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %67)
br label %69
69: ; preds = %64, %56
%70 = load i32, i32* %8
%71 = add nsw i32 %70, 1
store i32 %71, i32* %8
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
br label %72
72: ; preds = %69, %51
br label %73
73: ; preds = %72, %35
br label %10
74: ; preds = %10
ret double 0.000000e+00
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@EOF = global i32 0
@.str.1 = [6 x i8] c"%lf \0A\00"
define double @row(i32* %0, i32* %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %52, label %8
8: ; preds = %2
%9 = icmp eq i32* %1, null
br label %10
10: ; preds = %8, %45
%11 = phi i32 [ %5, %8 ], [ %49, %45 ]
%12 = phi i32 [ 0, %8 ], [ %48, %45 ]
%13 = phi i32 [ 1, %8 ], [ %47, %45 ]
%14 = phi double [ 0.000000e+00, %8 ], [ %46, %45 ]
%15 = icmp eq i32 %11, 0
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @skipWord(i32* %0)
br label %18
18: ; preds = %16, %10
br i1 %9, label %19, label %26
19: ; preds = %18
%20 = call signext i8 @fgetc(i32* %0)
%21 = icmp eq i8 %20, 10
%22 = load double, double* %3
%23 = fadd double %14, %22
br i1 %21, label %24, label %45
24: ; preds = %19
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %23)
store double 0.000000e+00, double* %3
br label %45
26: ; preds = %18
%27 = sext i32 %12 to i64
%28 = getelementptr inbounds i32, i32* %1, i64 %27
%29 = load i32, i32* %28
%30 = icmp eq i32 %13, %29
%31 = load double, double* %3
%32 = select i1 %30, double %31, double -0.000000e+00
%33 = fadd double %14, %32
%34 = call signext i8 @fgetc(i32* %0)
%35 = icmp eq i8 %34, 10
br i1 %35, label %36, label %45
36: ; preds = %26
%37 = load i32, i32* %28
%38 = icmp eq i32 %13, %37
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = add nsw i32 %12, 1
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %33)
br label %42
42: ; preds = %39, %36
%43 = phi i32 [ %40, %39 ], [ %12, %36 ]
%44 = add nsw i32 %13, 1
store double 0.000000e+00, double* %3
br label %45
45: ; preds = %19, %24, %26, %42
%46 = phi double [ 0.000000e+00, %42 ], [ %33, %26 ], [ 0.000000e+00, %24 ], [ %23, %19 ]
%47 = phi i32 [ %44, %42 ], [ %13, %26 ], [ %13, %24 ], [ %13, %19 ]
%48 = phi i32 [ %43, %42 ], [ %12, %26 ], [ %12, %24 ], [ %12, %19 ]
%49 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%50 = load i32, i32* @EOF
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %10
52: ; preds = %45, %2
ret double 0.000000e+00
}