#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*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *);
double sqrt(double);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(int argc, char **argv) {
  int a, b, i, j;
  double r;
  if (argc < 3) {
    scanf("%d", &a);
    scanf("%d", &b);
  } else {
    sscanf(argv[1], "%d", &a);
    sscanf(argv[2], "%d", &b);
  }
  r = 0.0;
  for (i = 0; i < a; i++) {
    for (j = 0; j < b; j++) {
      r = sqrt(r + i + j);
    }
  }
  printf("%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    1185 <main+0x45>
lea    0xe99(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe89(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
jmp    11b5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6c(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe54(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1225 <main+0xe5>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1212 <main+0xd2>
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    11d7 <main+0x97>
jmp    1217 <main+0xd7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c4 <main+0x84>
movsd  -0x28(%rbp),%xmm0
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jg     116e <main+0x2e>
lea    0xeac(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
jmp    1198 <main+0x58>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe84(%rip),%r14
lea    0x4(%rsp),%rdx
mov    %r14,%rsi
call   1040 <sscanf@plt>
mov    0x10(%rbx),%rdi
mov    %rsp,%rdx
mov    %r14,%rsi
call   1040 <sscanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    120b <main+0xcb>
xor    %ebx,%ebx
xorpd  %xmm2,%xmm2
mov    (%rsp),%eax
xorpd  %xmm0,%xmm0
jmp    11bb <main+0x7b>
nop
mov    0x4(%rsp),%ecx
add    $0x1,%ebx
cmp    %ecx,%ebx
jge    120f <main+0xcf>
test   %eax,%eax
jle    11b4 <main+0x74>
xorps  %xmm3,%xmm3
cvtsi2sd %ebx,%xmm3
xor    %ebp,%ebp
movsd  %xmm3,0x8(%rsp)
jmp    11ed <main+0xad>
movapd %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
xorpd  %xmm2,%xmm2
add    $0x1,%ebp
mov    (%rsp),%eax
cmp    %eax,%ebp
jge    11b0 <main+0x70>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
addsd  %xmm3,%xmm0
addsd  %xmm0,%xmm1
ucomisd %xmm2,%xmm1
jb     11d0 <main+0x90>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11e3 <main+0xa3>
xorpd  %xmm0,%xmm0
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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 %16
13: ; preds = %2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %25
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %25
25: ; preds = %16, %13
store double 0.000000e+00, double* %10
store i32 0, i32* %8
br label %26
26: ; preds = %48, %25
%27 = load i32, i32* %8
%28 = load i32, i32* %6
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %51
30: ; preds = %26
store i32 0, i32* %9
br label %31
31: ; preds = %44, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %7
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %47
35: ; preds = %31
%36 = load double, double* %10
%37 = load i32, i32* %8
%38 = sitofp i32 %37 to double
%39 = fadd double %36, %38
%40 = load i32, i32* %9
%41 = sitofp i32 %40 to double
%42 = fadd double %39, %41
%43 = call double @sqrt(double %42)
store double %43, double* %10
br label %44
44: ; preds = %35
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %31
47: ; preds = %31
br label %48
48: ; preds = %47
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 1
store i32 %50, i32* %8
br label %26
51: ; preds = %26
%52 = load double, double* %10
%53 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %52)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [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 %11
8: ; preds = %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %18
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
br label %18
18: ; preds = %11, %8
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %49
21: ; preds = %18
%22 = load i32, i32* %4
br label %23
23: ; preds = %21, %43
%24 = phi i32 [ %44, %43 ], [ %19, %21 ]
%25 = phi i32 [ %45, %43 ], [ %22, %21 ]
%26 = phi double [ %46, %43 ], [ 0.000000e+00, %21 ]
%27 = phi i32 [ %47, %43 ], [ 0, %21 ]
%28 = icmp sgt i32 %25, 0
br i1 %28, label %29, label %43
29: ; preds = %23
%30 = sitofp i32 %27 to double
br label %31
31: ; preds = %29, %31
%32 = phi double [ %26, %29 ], [ %37, %31 ]
%33 = phi i32 [ 0, %29 ], [ %38, %31 ]
%34 = fadd double %32, %30
%35 = sitofp i32 %33 to double
%36 = fadd double %34, %35
%37 = call double @sqrt(double %36)
%38 = add nuw nsw i32 %33, 1
%39 = load i32, i32* %4
%40 = icmp slt i32 %38, %39
br i1 %40, label %31, label %41
41: ; preds = %31
%42 = load i32, i32* %3
br label %43
43: ; preds = %41, %23
%44 = phi i32 [ %24, %23 ], [ %42, %41 ]
%45 = phi i32 [ %25, %23 ], [ %39, %41 ]
%46 = phi double [ %26, %23 ], [ %37, %41 ]
%47 = add nuw nsw i32 %27, 1
%48 = icmp slt i32 %47, %44
br i1 %48, label %23, label %49
49: ; preds = %43, %18
%50 = phi double [ 0.000000e+00, %18 ], [ %46, %43 ]
%51 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %50)
ret i32 0
}