#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int scanf(char *, int *);
double sqrt(double);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int a, b, i, j;
  double r;
  if (argc < 3) {
    if (scanf("%d", &a) != 1) {
      fprintf(stderr, "Can't read first number\n");
      return 1;
    }
    if (scanf("%d", &b) != 1) {
      fprintf(stderr, "Can't read second number\n");
      return 1;
    }
  } else {
    if (sscanf(argv[1], "%d", &a) != 1) {
      fprintf(stderr, "Can't read first number\n");
      return 1;
    }
    if (sscanf(argv[2], "%d", &b) != 1) {
      fprintf(stderr, "Can't read second number\n");
      return 1;
    }
  }
  r = 0.0;
  for (i = 0; i < a; i++) {
    for (j = 0; j < b; j++) {
      r = sqrt(r + i + j);
    }
  }
  fprintf(stdout, "%lf\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11dd <main+0x9d>
lea    0xe99(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     119c <main+0x5c>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fd <main+0x1bd>
lea    0xe5d(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11d8 <main+0x98>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fd <main+0x1bd>
jmp    126a <main+0x12a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe14(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1221 <main+0xe1>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
lea    0xdf5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fd <main+0x1bd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdd0(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1265 <main+0x125>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12fd <main+0x1bd>
jmp    126a <main+0x12a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12da <main+0x19a>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12c7 <main+0x187>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    128c <main+0x14c>
jmp    12cc <main+0x18c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1279 <main+0x139>
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
movsd  -0x28(%rbp),%xmm0
lea    0xd47(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jg     1190 <main+0x50>
lea    0xeae(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    124c <main+0x10c>
lea    0xe94(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11cb <main+0x8b>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
jmp    125c <main+0x11c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe62(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    124c <main+0x10c>
mov    0x10(%rbx),%rdi
lea    0xe44(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    117b <main+0x3b>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    126a <main+0x12a>
xor    %ebx,%ebx
xorpd  %xmm2,%xmm2
mov    0x8(%rsp),%eax
xorpd  %xmm0,%xmm0
jmp    11fb <main+0xbb>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%ecx
add    $0x1,%ebx
cmp    %ecx,%ebx
jge    126e <main+0x12e>
test   %eax,%eax
jle    11f4 <main+0xb4>
xorps  %xmm3,%xmm3
cvtsi2sd %ebx,%xmm3
xor    %ebp,%ebp
movsd  %xmm3,0x10(%rsp)
jmp    122e <main+0xee>
movapd %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  0x10(%rsp),%xmm3
xorpd  %xmm2,%xmm2
add    $0x1,%ebp
mov    0x8(%rsp),%eax
cmp    %eax,%ebp
jge    11f0 <main+0xb0>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
addsd  %xmm3,%xmm0
addsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jb     1210 <main+0xd0>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1223 <main+0xe3>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xda7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%eax
jmp    1287 <main+0x147>
xorpd  %xmm0,%xmm0
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Can't read first number\0A\00"
@.str.2 = [26 x i8] c"Can't read second number\0A\00"
@stdout = global i32 0
@.str.3 = [5 x i8] c"%lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %20
8: ; preds = %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = icmp eq i32 %9, 1
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %71
14: ; preds = %8
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = icmp eq i32 %15, 1
br i1 %16, label %36, label %17
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %71
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%24 = icmp eq i32 %23, 1
br i1 %24, label %28, label %25
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %71
28: ; preds = %20
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @sscanf(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%32 = icmp eq i32 %31, 1
br i1 %32, label %36, label %33
33: ; preds = %28
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %71
36: ; preds = %28, %14
%37 = load i32, i32* %3
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %67
39: ; preds = %36
%40 = load i32, i32* %4
br label %41
41: ; preds = %39, %61
%42 = phi i32 [ %62, %61 ], [ %37, %39 ]
%43 = phi i32 [ %63, %61 ], [ %40, %39 ]
%44 = phi double [ %64, %61 ], [ 0.000000e+00, %39 ]
%45 = phi i32 [ %65, %61 ], [ 0, %39 ]
%46 = icmp sgt i32 %43, 0
br i1 %46, label %47, label %61
47: ; preds = %41
%48 = sitofp i32 %45 to double
br label %49
49: ; preds = %47, %49
%50 = phi double [ %44, %47 ], [ %55, %49 ]
%51 = phi i32 [ 0, %47 ], [ %56, %49 ]
%52 = fadd double %50, %48
%53 = sitofp i32 %51 to double
%54 = fadd double %52, %53
%55 = call double @sqrt(double %54)
%56 = add nuw nsw i32 %51, 1
%57 = load i32, i32* %4
%58 = icmp slt i32 %56, %57
br i1 %58, label %49, label %59
59: ; preds = %49
%60 = load i32, i32* %3
br label %61
61: ; preds = %59, %41
%62 = phi i32 [ %42, %41 ], [ %60, %59 ]
%63 = phi i32 [ %43, %41 ], [ %57, %59 ]
%64 = phi double [ %44, %41 ], [ %55, %59 ]
%65 = add nuw nsw i32 %45, 1
%66 = icmp slt i32 %65, %62
br i1 %66, label %41, label %67
67: ; preds = %61, %36
%68 = phi double [ 0.000000e+00, %36 ], [ %64, %61 ]
%69 = load i32, i32* @stdout
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %68)
br label %71
71: ; preds = %67, %33, %25, %17, %11
%72 = phi i32 [ 1, %11 ], [ 1, %17 ], [ 0, %67 ], [ 1, %25 ], [ 1, %33 ]
ret i32 %72
}