#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 */
double RAND_MAX;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  double tab[10][10], sum = 0;
  srand(time(NULL));
  for (int y = 0; y < 10; ++y) {
    for (int x = 0; x < 10; ++x) {
      printf("%lf ", *(*(tab + y) + x) = (double)rand() / RAND_MAX);
      if (y & 1)
        sum += *(*(tab + y) + x);
    }
    printf("\n");
  }
  printf("%lf\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x338(%rbp)
ff
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x33c(%rbp)
cmpl   $0xa,-0x33c(%rbp)
jge    125f <main+0x11f>
movl   $0x0,-0x340(%rbp)
cmpl   $0xa,-0x340(%rbp)
jge    123d <main+0xfd>
mov    $0x0,%al
call   1060 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e3a(%rip),%rax
divsd  (%rax),%xmm0
lea    -0x330(%rbp),%rax
movslq -0x33c(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x340(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
lea    0xe26(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x33c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1224 <main+0xe4>
lea    -0x330(%rbp),%rax
movslq -0x33c(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x340(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x338(%rbp),%xmm0
ff
movsd  %xmm0,-0x338(%rbp)
ff
jmp    1229 <main+0xe9>
mov    -0x340(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x340(%rbp)
jmp    118e <main+0x4e>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    1177 <main+0x37>
movsd  -0x338(%rbp),%xmm0
ff
lea    0xd97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x2e71(%rip),%r14
lea    0xe8a(%rip),%rbx
xor    %ebp,%ebp
jmp    11dd <main+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x8(%rsp),%xmm2
addsd  %xmm8,%xmm2
addsd  %xmm9,%xmm2
addsd  %xmm10,%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm4,%xmm2
addsd  %xmm5,%xmm2
addsd  %xmm6,%xmm2
addsd  %xmm7,%xmm2
addsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0xa,%ebp
je     141c <main+0x2cc>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x58(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x50(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x48(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x40(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x38(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x30(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x28(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x20(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    %rbx,%rdi
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xcb3(%rip),%xmm1
movapd %xmm1,%xmm8
test   $0x1,%bpl
jne    13a0 <main+0x250>
movapd %xmm1,%xmm9
jne    13ae <main+0x25e>
movapd %xmm1,%xmm10
jne    13bc <main+0x26c>
movapd %xmm1,%xmm3
jne    13c9 <main+0x279>
movapd %xmm1,%xmm4
jne    13d5 <main+0x285>
movapd %xmm1,%xmm5
jne    13e1 <main+0x291>
movapd %xmm1,%xmm6
jne    13ed <main+0x29d>
movapd %xmm1,%xmm7
jne    13f9 <main+0x2a9>
movapd %xmm1,%xmm0
jne    1405 <main+0x2b5>
je     1190 <main+0x40>
jmp    1411 <main+0x2c1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x58(%rsp),%xmm8
movapd %xmm1,%xmm9
je     135f <main+0x20f>
movsd  0x50(%rsp),%xmm9
movapd %xmm1,%xmm10
je     1366 <main+0x216>
movsd  0x48(%rsp),%xmm10
movapd %xmm1,%xmm3
je     136c <main+0x21c>
movsd  0x40(%rsp),%xmm3
movapd %xmm1,%xmm4
je     1372 <main+0x222>
movsd  0x38(%rsp),%xmm4
movapd %xmm1,%xmm5
je     1378 <main+0x228>
movsd  0x30(%rsp),%xmm5
movapd %xmm1,%xmm6
je     137e <main+0x22e>
movsd  0x28(%rsp),%xmm6
movapd %xmm1,%xmm7
je     1384 <main+0x234>
movsd  0x20(%rsp),%xmm7
movapd %xmm1,%xmm0
je     138a <main+0x23a>
movsd  0x18(%rsp),%xmm0
je     1190 <main+0x40>
movsd  0x10(%rsp),%xmm1
jmp    1190 <main+0x40>
lea    0xbea(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lf \00"
@RAND_MAX = global double 0.000000e+00
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %79, %3 ]
%5 = phi double [ 0.000000e+00, %0 ], [ %77, %3 ]
%6 = and i32 %4, 1
%7 = icmp eq i32 %6, 0
%8 = tail call i64 (...) @rand()
%9 = sitofp i64 %8 to double
%10 = load double, double* @RAND_MAX
%11 = fdiv double %9, %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %11)
%13 = select i1 %7, double -0.000000e+00, double %11
%14 = fadd double %5, %13
%15 = tail call i64 (...) @rand()
%16 = sitofp i64 %15 to double
%17 = load double, double* @RAND_MAX
%18 = fdiv double %16, %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %18)
%20 = select i1 %7, double -0.000000e+00, double %18
%21 = fadd double %14, %20
%22 = tail call i64 (...) @rand()
%23 = sitofp i64 %22 to double
%24 = load double, double* @RAND_MAX
%25 = fdiv double %23, %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %25)
%27 = select i1 %7, double -0.000000e+00, double %25
%28 = fadd double %21, %27
%29 = tail call i64 (...) @rand()
%30 = sitofp i64 %29 to double
%31 = load double, double* @RAND_MAX
%32 = fdiv double %30, %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %32)
%34 = select i1 %7, double -0.000000e+00, double %32
%35 = fadd double %28, %34
%36 = tail call i64 (...) @rand()
%37 = sitofp i64 %36 to double
%38 = load double, double* @RAND_MAX
%39 = fdiv double %37, %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %39)
%41 = select i1 %7, double -0.000000e+00, double %39
%42 = fadd double %35, %41
%43 = tail call i64 (...) @rand()
%44 = sitofp i64 %43 to double
%45 = load double, double* @RAND_MAX
%46 = fdiv double %44, %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %46)
%48 = select i1 %7, double -0.000000e+00, double %46
%49 = fadd double %42, %48
%50 = tail call i64 (...) @rand()
%51 = sitofp i64 %50 to double
%52 = load double, double* @RAND_MAX
%53 = fdiv double %51, %52
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %53)
%55 = select i1 %7, double -0.000000e+00, double %53
%56 = fadd double %49, %55
%57 = tail call i64 (...) @rand()
%58 = sitofp i64 %57 to double
%59 = load double, double* @RAND_MAX
%60 = fdiv double %58, %59
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %60)
%62 = select i1 %7, double -0.000000e+00, double %60
%63 = fadd double %56, %62
%64 = tail call i64 (...) @rand()
%65 = sitofp i64 %64 to double
%66 = load double, double* @RAND_MAX
%67 = fdiv double %65, %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %67)
%69 = select i1 %7, double -0.000000e+00, double %67
%70 = fadd double %63, %69
%71 = tail call i64 (...) @rand()
%72 = sitofp i64 %71 to double
%73 = load double, double* @RAND_MAX
%74 = fdiv double %72, %73
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %74)
%76 = select i1 %7, double -0.000000e+00, double %74
%77 = fadd double %70, %76
%78 = tail call i32 @putchar(i32 10)
%79 = add nuw nsw i32 %4, 1
%80 = icmp eq i32 %79, 10
br i1 %80, label %81, label %3
81: ; preds = %3
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %77)
ret i32 0
}