#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 atof(int /*<<< orphan*/);
int /*<<< orphan*/ dump_hdf5_d(char *, double, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int c;
  double x, y, z;
  while ((c = getopt(argc, argv, "x:y:")) != -1)
    switch (c) {
    case 'x':
      x = atof(optarg);
      break;
    case 'y':
      y = atof(optarg);
      break;
    default:
      printf("Usage: %s -x val -y val\n", argv[0]);
      return (1);
    }
  z = 100.0 * (y - x * x) * (y - x * x) + (1.0 - x) * (1.0 - x);
  dump_hdf5_d("z", z, "f(x,y)");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11ee <main+0xae>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x78,%eax
je     119a <main+0x5a>
jmp    1189 <main+0x49>
mov    -0x34(%rbp),%eax
sub    $0x79,%eax
je     11b2 <main+0x72>
jmp    11ca <main+0x8a>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    11e9 <main+0xa9>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    11e9 <main+0xa9>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe3d(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12a0 <main+0x160>
jmp    1156 <main+0x16>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xde4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  0xda2(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  0xd95(%rip),%xmm3
subsd  -0x20(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xda1(%rip),%rdi
lea    0xd9c(%rip),%rsi
call   1050 <dump_hdf5_d@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeba(%rip),%r14
mov    0x2e9b(%rip),%r15
jmp    116e <main+0x2e>
nop
mov    (%r15),%edi
call   1030 <atof@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
cmp    $0x79,%eax
je     1160 <main+0x20>
cmp    $0xffffffff,%eax
je     119a <main+0x5a>
cmp    $0x78,%eax
jne    11ed <main+0xad>
mov    (%r15),%edi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
jmp    116e <main+0x2e>
movsd  0x8(%rsp),%xmm3
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0xe46(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xe42(%rip),%xmm1
subsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xe51(%rip),%rdi
lea    0xe4c(%rip),%rsi
call   1050 <dump_hdf5_d@plt>
xor    %eax,%eax
jmp    1201 <main+0xc1>
mov    (%rbx),%rsi
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"x:y:\00"
@optarg = global i32 0
@.str.1 = [25 x i8] c"Usage: %s -x val -y val\0A\00"
@.str.2 = [2 x i8] c"z\00"
@.str.3 = [7 x i8] c"f(x,y)\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %28, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %29
15: ; preds = %10
%16 = load i32, i32* %6
switch i32 %16, label %23 [
i32 120, label %17
i32 121, label %20
]
17: ; preds = %15
%18 = load i32, i32* @optarg
%19 = call double @atof(i32 %18)
store double %19, double* %7
br label %28
20: ; preds = %15
%21 = load i32, i32* @optarg
%22 = call double @atof(i32 %21)
store double %22, double* %8
br label %28
23: ; preds = %15
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %26)
store i32 1, i32* %3
br label %49
28: ; preds = %20, %17
br label %10
29: ; preds = %10
%30 = load double, double* %8
%31 = load double, double* %7
%32 = load double, double* %7
%33 = fneg double %31
%34 = call double @llvm.fmuladd.f64(double %33, double %32, double %30)
%35 = fmul double 1.000000e+02, %34
%36 = load double, double* %8
%37 = load double, double* %7
%38 = load double, double* %7
%39 = fneg double %37
%40 = call double @llvm.fmuladd.f64(double %39, double %38, double %36)
%41 = load double, double* %7
%42 = fsub double 1.000000e+00, %41
%43 = load double, double* %7
%44 = fsub double 1.000000e+00, %43
%45 = fmul double %42, %44
%46 = call double @llvm.fmuladd.f64(double %35, double %40, double %45)
store double %46, double* %9
%47 = load double, double* %9
%48 = call i32 @dump_hdf5_d(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), double %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %49
49: ; preds = %29, %23
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [5 x i8] c"x:y:\00"
@optarg = global i32 0
@.str.1 = [25 x i8] c"Usage: %s -x val -y val\0A\00"
@.str.2 = [2 x i8] c"z\00"
@.str.3 = [7 x i8] c"f(x,y)\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %9, %2
%4 = phi double [ %11, %9 ], [ undef, %2 ]
%5 = phi double [ %7, %9 ], [ undef, %2 ]
br label %6
6: ; preds = %3, %12
%7 = phi double [ %14, %12 ], [ %5, %3 ]
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %8, label %15 [
i32 -1, label %18
i32 120, label %9
i32 121, label %12
]
9: ; preds = %6
%10 = load i32, i32* @optarg
%11 = tail call double @atof(i32 %10)
br label %3
12: ; preds = %6
%13 = load i32, i32* @optarg
%14 = tail call double @atof(i32 %13)
br label %6
15: ; preds = %6
%16 = load i8*, i8** %1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %26
18: ; preds = %6
%19 = fneg double %4
%20 = tail call double @llvm.fmuladd.f64(double %19, double %4, double %7)
%21 = fmul double %20, 1.000000e+02
%22 = fsub double 1.000000e+00, %4
%23 = fmul double %22, %22
%24 = tail call double @llvm.fmuladd.f64(double %21, double %20, double %23)
%25 = tail call i32 @dump_hdf5_d(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), double %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %18, %15
%27 = phi i32 [ 1, %15 ], [ 0, %18 ]
ret i32 %27
}