#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 */
float M_PI;
float atof(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  float dia1, dia2;
  float price1, price2;
  float surface1, surface2;
  float ratio1, ratio2;
  if (argc > 1) {
    if (argc == 5) {
      dia1 = atof(argv[0]);
      price1 = atof(argv[1]);
      dia2 = atof(argv[2]);
      price2 = atof(argv[3]);
      surface1 = M_PI * ((dia1 / 2) * (dia1 / 2));
      surface2 = M_PI * ((dia2 / 2) * (dia2 / 2));
      ratio1 = surface1 / price1;
      ratio2 = surface2 / price2;
      if (ratio1 < ratio2) {
        printf("Choose pizza 2!\n");
      } else if (ratio1 > ratio2) {
        printf("Choose pizza 1!\n");
      } else {
        printf("Choose one of them. It doesn't matter.\n");
      }
    } else {
      printf("[error] Please provide sufficent arguments.\n");
    }
  } else {
    printf("---------------------------------------\n");
    printf("Usage: ./pizza $1 $2 $3 $4\n");
    printf("$1: Diameter of pizza 1\n");
    printf("$2: Price of pizza 1\n");
    printf("$3: Diameter of pizza 2\n");
    printf("$4: Price of pizza 2\n");
    printf("---------------------------------------\n");
  }
  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   $0x1,-0x8(%rbp)
jle    128e <main+0x16e>
cmpl   $0x5,-0x8(%rbp)
jne    127d <main+0x15d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x20(%rbp)
mov    0x2e50(%rip),%rax
movss  (%rax),%xmm0
movss  -0x14(%rbp),%xmm1
movss  0xe57(%rip),%xmm2
divss  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
movss  0xe46(%rip),%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    0x2e16(%rip),%rax
movss  (%rax),%xmm0
movss  -0x18(%rbp),%xmm1
movss  0xe1d(%rip),%xmm2
divss  %xmm2,%xmm1
movss  -0x18(%rbp),%xmm2
movss  0xe0c(%rip),%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
divss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm1
movss  -0x30(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1247 <main+0x127>
lea    0xdc7(%rip),%rdi
call   1040 <printf@plt>
jmp    1278 <main+0x158>
movss  -0x2c(%rbp),%xmm0
ucomiss -0x30(%rbp),%xmm0
jbe    1267 <main+0x147>
lea    0xdb8(%rip),%rdi
call   1040 <printf@plt>
jmp    1273 <main+0x153>
lea    0xdb8(%rip),%rdi
call   1040 <printf@plt>
jmp    1278 <main+0x158>
jmp    1289 <main+0x169>
lea    0xdca(%rip),%rdi
call   1040 <printf@plt>
jmp    12e2 <main+0x1c2>
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
lea    0xe03(%rip),%rdi
call   1040 <printf@plt>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
lea    0xd9e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
cmp    $0x2,%edi
jl     11b3 <main+0x93>
cmp    $0x5,%edi
jne    1200 <main+0xe0>
mov    %rsi,%rbx
mov    (%rsi),%rdi
call   1040 <atof@plt>
movaps %xmm0,0x10(%rsp)
mov    0x8(%rbx),%rdi
call   1040 <atof@plt>
movaps %xmm0,0x20(%rsp)
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
movaps %xmm0,(%rsp)
mov    0x18(%rbx),%rdi
call   1040 <atof@plt>
mov    0x2e76(%rip),%rax
movaps 0x10(%rsp),%xmm1
unpcklps (%rsp),%xmm1
mulps  0xe7e(%rip),%xmm1
mulps  %xmm1,%xmm1
movaps %xmm1,%xmm2
movss  (%rax),%xmm1
shufps $0x0,%xmm1,%xmm1
mulps  %xmm2,%xmm1
movaps 0x20(%rsp),%xmm2
unpcklps %xmm0,%xmm2
divps  %xmm2,%xmm1
movaps %xmm1,%xmm0
shufps $0x55,%xmm1,%xmm0
ucomiss %xmm1,%xmm0
jbe    1209 <main+0xe9>
lea    0xf5f(%rip),%rbx
jmp    121e <main+0xfe>
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe47(%rip),%rdi
call   1030 <puts@plt>
lea    0xe56(%rip),%rdi
call   1030 <puts@plt>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
jmp    121e <main+0xfe>
lea    0xea6(%rip),%rbx
jmp    121e <main+0xfe>
ucomiss %xmm0,%xmm1
lea    0xeed(%rip),%rax
lea    0xebf(%rip),%rbx
cmova  %rax,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
@.str = [17 x i8] c"Choose pizza 2!\0A\00"
@.str.1 = [17 x i8] c"Choose pizza 1!\0A\00"
@.str.2 = [40 x i8] c"Choose one of them. It doesn't matter.\0A\00"
@.str.3 = [45 x i8] c"[error] Please provide sufficent arguments.\0A\00"
@.str.4 = [41 x i8] c"---------------------------------------\0A\00"
@.str.5 = [28 x i8] c"Usage: ./pizza $1 $2 $3 $4\0A\00"
@.str.6 = [25 x i8] c"$1: Diameter of pizza 1\0A\00"
@.str.7 = [22 x i8] c"$2: Price of pizza 1\0A\00"
@.str.8 = [25 x i8] c"$3: Diameter of pizza 2\0A\00"
@.str.9 = [22 x i8] c"$4: Price of pizza 2\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %74
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 5
br i1 %18, label %19, label %71
19: ; preds = %16
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call float @atof(i8* %22)
store float %23, float* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call float @atof(i8* %26)
store float %27, float* %8
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call float @atof(i8* %30)
store float %31, float* %7
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call float @atof(i8* %34)
store float %35, float* %9
%36 = load float, float* @M_PI
%37 = load float, float* %6
%38 = fdiv float %37, 2.000000e+00
%39 = load float, float* %6
%40 = fdiv float %39, 2.000000e+00
%41 = fmul float %38, %40
%42 = fmul float %36, %41
store float %42, float* %10
%43 = load float, float* @M_PI
%44 = load float, float* %7
%45 = fdiv float %44, 2.000000e+00
%46 = load float, float* %7
%47 = fdiv float %46, 2.000000e+00
%48 = fmul float %45, %47
%49 = fmul float %43, %48
store float %49, float* %11
%50 = load float, float* %10
%51 = load float, float* %8
%52 = fdiv float %50, %51
store float %52, float* %12
%53 = load float, float* %11
%54 = load float, float* %9
%55 = fdiv float %53, %54
store float %55, float* %13
%56 = load float, float* %12
%57 = load float, float* %13
%58 = fcmp olt float %56, %57
br i1 %58, label %59, label %61
59: ; preds = %19
%60 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %70
61: ; preds = %19
%62 = load float, float* %12
%63 = load float, float* %13
%64 = fcmp ogt float %62, %63
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %69
67: ; preds = %61
%68 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
br label %69
69: ; preds = %67, %65
br label %70
70: ; preds = %69, %59
br label %73
71: ; preds = %16
%72 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %73
73: ; preds = %71, %70
br label %82
74: ; preds = %2
%75 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%76 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%77 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%78 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%79 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%80 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%81 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
br label %82
82: ; preds = %74, %73
ret i32 0
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
@str.10 = [27 x i8] c"Usage: ./pizza $1 $2 $3 $4\00"
@str.11 = [24 x i8] c"$1: Diameter of pizza 1\00"
@str.12 = [21 x i8] c"$2: Price of pizza 1\00"
@str.13 = [24 x i8] c"$3: Diameter of pizza 2\00"
@str.14 = [21 x i8] c"$4: Price of pizza 2\00"
@str.15 = [40 x i8] c"---------------------------------------\00"
@str.16 = [44 x i8] c"[error] Please provide sufficent arguments.\00"
@str.17 = [39 x i8] c"Choose one of them. It doesn't matter.\00"
@str.18 = [16 x i8] c"Choose pizza 1!\00"
@str.19 = [16 x i8] c"Choose pizza 2!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %35
4: ; preds = %2
%5 = icmp eq i32 %0, 5
br i1 %5, label %6, label %42
6: ; preds = %4
%7 = load i8*, i8** %1
%8 = tail call float @atof(i8* %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call float @atof(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call float @atof(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call float @atof(i8* %16)
%18 = load float, float* @M_PI
%19 = insertelement <2 x float> poison, float %8, i64 0
%20 = insertelement <2 x float> %19, float %14, i64 1
%21 = fmul <2 x float> %20, <float 5.000000e-01, float 5.000000e-01>
%22 = fmul <2 x float> %21, %21
%23 = insertelement <2 x float> poison, float %18, i64 0
%24 = shufflevector <2 x float> %23, <2 x float> poison, <2 x i32> zeroinitializer
%25 = fmul <2 x float> %22, %24
%26 = insertelement <2 x float> poison, float %11, i64 0
%27 = insertelement <2 x float> %26, float %17, i64 1
%28 = fdiv <2 x float> %25, %27
%29 = extractelement <2 x float> %28, i64 0
%30 = extractelement <2 x float> %28, i64 1
%31 = fcmp olt float %29, %30
br i1 %31, label %42, label %32
32: ; preds = %6
%33 = fcmp ogt float %29, %30
%34 = select i1 %33, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.18, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @str.17, i64 0, i64 0)
br label %42
35: ; preds = %2
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0))
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.11, i64 0, i64 0))
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.12, i64 0, i64 0))
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.13, i64 0, i64 0))
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.14, i64 0, i64 0))
br label %42
42: ; preds = %4, %32, %6, %35
%43 = phi i8* [ getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0), %35 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.19, i64 0, i64 0), %6 ], [ %34, %32 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @str.16, i64 0, i64 0), %4 ]
%44 = tail call i32 @puts(i8* dereferenceable(1) %43)
ret i32 0
}