#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 sqrt(int);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Usage: ./pythorag <val1> <val2>\n");
    return 1;
  }
  printf("%f\n", sqrt((strtol(argv[1], NULL, 10) * strtol(argv[1], NULL, 10)) +
                      (strtol(argv[2], NULL, 10) * strtol(argv[2], NULL, 10))));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1050 <sqrt@plt>
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    11b8 <main+0x78>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %r14d,%r14d
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%r15d
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
imul   %eax,%r15d
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
imul   %eax,%ebp
add    %r15d,%ebp
mov    %ebp,%edi
call   1060 <sqrt@plt>
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11ca <main+0x8a>
lea    0xe45(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Usage: ./pythorag <val1> <val2>\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %32
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strtol(i8* %13, i32* null, i32 10)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strtol(i8* %17, i32* null, i32 10)
%19 = mul nsw i32 %14, %18
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @strtol(i8* %22, i32* null, i32 10)
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @strtol(i8* %26, i32* null, i32 10)
%28 = mul nsw i32 %23, %27
%29 = add nsw i32 %19, %28
%30 = call double @sqrt(i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %30)
br label %32
32: ; preds = %10, %8
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%f\0A\00"
@str = [32 x i8] c"Usage: ./pythorag <val1> <val2>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %22
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strtol(i8* nocapture %8, i32* null, i32 10)
%10 = load i8*, i8** %7
%11 = tail call i32 @strtol(i8* nocapture %10, i32* null, i32 10)
%12 = mul nsw i32 %11, %9
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @strtol(i8* nocapture %14, i32* null, i32 10)
%16 = load i8*, i8** %13
%17 = tail call i32 @strtol(i8* nocapture %16, i32* null, i32 10)
%18 = mul nsw i32 %17, %15
%19 = add nsw i32 %18, %12
%20 = tail call double @sqrt(i32 %19)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %20)
br label %22
22: ; preds = %6, %4
%23 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %23
}