#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 getCart__HT(char *, float *);
int getCart__TAX(char *, float *);
scalar_t__ getCookie(char *);
char *getenv(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  printf("Content-Type: text/plain;charset=us-ascii\n\n");
  char cookie[128];
  memset(cookie, 0, 128);
  if (getCookie(cookie)) {
    printf("-\n");
    goto end;
  }
  char *cents = NULL, *ptr_cents = NULL;
  cents = getenv("CENTS");
  if (cents)
    ptr_cents = strstr(cents, "TRUE");
  int ret;
  float f_ht = 0, f_tax = 0, f_shipping = 0, f_total = 0;
  ret = getCart__HT(cookie, &f_ht);
  ret = getCart__TAX(cookie, &f_tax);
  if (f_ht < 0 || f_tax < 0) {
    printf("-\n");
    goto end;
  } else {
    f_total = f_ht + f_tax;
  }
  if (ptr_cents) {
    f_total *= 100;
    printf("%i", (int)f_total);
  } else {
    printf("%.2f", f_total);
  }
end:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
lea    -0x90(%rbp),%rdi
call   1070 <getCookie@plt>
cmp    $0x0,%rax
je     11d3 <main+0x63>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    132d <main+0x1bd>
movq   $0x0,-0x98(%rbp)
movq   $0x0,-0xa0(%rbp)
lea    0xe43(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
je     1224 <main+0xb4>
mov    -0x98(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1090 <strstr@plt>
mov    %rax,-0xa0(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xac(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0xb4(%rbp)
ff
lea    -0x90(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
call   1080 <getCart__HT@plt>
mov    %eax,-0xa4(%rbp)
lea    -0x90(%rbp),%rdi
lea    -0xac(%rbp),%rsi
call   1040 <getCart__TAX@plt>
mov    %eax,-0xa4(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0xa8(%rbp),%xmm0
ja     12a2 <main+0x132>
xorps  %xmm0,%xmm0
ucomiss -0xac(%rbp),%xmm0
jbe    12b5 <main+0x145>
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    132d <main+0x1bd>
movss  -0xa8(%rbp),%xmm0
ff
addss  -0xac(%rbp),%xmm0
ff
movss  %xmm0,-0xb4(%rbp)
ff
cmpq   $0x0,-0xa0(%rbp)
je     130e <main+0x19e>
movss  0xd1d(%rip),%xmm0
mulss  -0xb4(%rbp),%xmm0
ff
movss  %xmm0,-0xb4(%rbp)
ff
cvttss2si -0xb4(%rbp),%esi
ff
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1328 <main+0x1b8>
movss  -0xb4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xd20(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    132d <main+0x1bd>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x98,%rsp
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
call   1080 <getCookie@plt>
test   %rax,%rax
je     11d0 <main+0x50>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe2d(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11f5 <main+0x75>
lea    0xe22(%rip),%rsi
mov    %rax,%rdi
call   10a0 <strstr@plt>
mov    %rax,%r14
jmp    11f8 <main+0x78>
xor    %r14d,%r14d
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <getCart__HT@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <getCart__TAX@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm0,%xmm2
ja     11b7 <main+0x37>
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm2
ja     11b7 <main+0x37>
addss  %xmm1,%xmm0
test   %r14,%r14
je     126c <main+0xec>
mulss  0xdab(%rip),%xmm0
cvttss2si %xmm0,%esi
lea    0xdaf(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11c3 <main+0x43>
cvtss2sd %xmm0,%xmm0
lea    0xd9b(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    11c3 <main+0x43>

LLVM IR (-O0):
@.str = [44 x i8] c"Content-Type: text/plain;charset=us-ascii\0A\0A\00"
@.str.1 = [3 x i8] c"-\0A\00"
@.str.2 = [6 x i8] c"CENTS\00"
@.str.3 = [5 x i8] c"TRUE\00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [5 x i8] c"%.2f\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 128)
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%18 = call i64 @getCookie(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %59
22: ; preds = %2
store i8* null, i8** %7
store i8* null, i8** %8
%23 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* %23, i8** %7
%24 = load i8*, i8** %7
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i8*, i8** %7
%28 = call i8* @strstr(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i8* %28, i8** %8
br label %29
29: ; preds = %26, %22
store float 0.000000e+00, float* %10
store float 0.000000e+00, float* %11
store float 0.000000e+00, float* %12
store float 0.000000e+00, float* %13
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%31 = call i32 @getCart__HT(i8* %30, float* %10)
store i32 %31, i32* %9
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%33 = call i32 @getCart__TAX(i8* %32, float* %11)
store i32 %33, i32* %9
%34 = load float, float* %10
%35 = fcmp olt float %34, 0.000000e+00
br i1 %35, label %39, label %36
36: ; preds = %29
%37 = load float, float* %11
%38 = fcmp olt float %37, 0.000000e+00
br i1 %38, label %39, label %41
39: ; preds = %36, %29
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %59
41: ; preds = %36
%42 = load float, float* %10
%43 = load float, float* %11
%44 = fadd float %42, %43
store float %44, float* %13
br label %45
45: ; preds = %41
%46 = load i8*, i8** %8
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load float, float* %13
%50 = fmul float %49, 1.000000e+02
store float %50, float* %13
%51 = load float, float* %13
%52 = fptosi float %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %52)
br label %58
54: ; preds = %45
%55 = load float, float* %13
%56 = fpext float %55 to double
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), double %56)
br label %58
58: ; preds = %54, %48
br label %59
59: ; preds = %58, %39, %20
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [6 x i8] c"CENTS\00"
@.str.3 = [5 x i8] c"TRUE\00"
@.str.4 = [3 x i8] c"%i\00"
@.str.5 = [5 x i8] c"%.2f\00"
@str = [43 x i8] c"Content-Type: text/plain;charset=us-ascii\0A\00"
@str.7 = [2 x i8] c"-\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = alloca float
%5 = alloca float
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 128)
%9 = call i64 @getCookie(i8* %7)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
br label %39
13: ; preds = %2
%14 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i8* @strstr(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = phi i8* [ %17, %16 ], [ null, %13 ]
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
%20 = call i32 @getCart__HT(i8* %7, float* %4)
%21 = call i32 @getCart__TAX(i8* %7, float* %5)
%22 = load float, float* %4
%23 = fcmp olt float %22, 0.000000e+00
%24 = load float, float* %5
%25 = fcmp olt float %24, 0.000000e+00
%26 = select i1 %23, i1 true, i1 %25
br i1 %26, label %27, label %29
27: ; preds = %18
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
br label %39
29: ; preds = %18
%30 = fadd float %22, %24
%31 = icmp eq i8* %19, null
br i1 %31, label %36, label %32
32: ; preds = %29
%33 = fmul float %30, 1.000000e+02
%34 = fptosi float %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %34)
br label %39
36: ; preds = %29
%37 = fpext float %30 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), double %37)
br label %39
39: ; preds = %32, %36, %27, %11
ret i32 0
}