#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
char *string_commas_dollar(double);
void latex_invoice_education_invoice_footer(FILE *output_stream,
                                            double extended_price_total,
                                            double total_payment) {
  if (total_payment) {
    fprintf(output_stream, "Payment (Thank you) & -%s \\\\\n",
            string_commas_dollar(total_payment));
  }
  fprintf(output_stream, "\\bf Amount Due &");
  fprintf(output_stream, "\\bf \\$%s \\\\\n",
          string_commas_dollar(extended_price_total - total_payment));
}


x86 assembly (clang, -O0):
<latex_invoice_education_invoice_footer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1153 <latex_invoice_education_invoice_footer+0x33>
jp     1153 <latex_invoice_education_invoice_footer+0x33>
jmp    117a <latex_invoice_education_invoice_footer+0x5a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <string_commas_dollar@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1030 <string_commas_dollar@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rdx
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<latex_invoice_education_invoice_footer>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
xorpd  %xmm0,%xmm0
movsd  %xmm1,(%rsp)
ucomisd %xmm0,%xmm1
jne    114f <latex_invoice_education_invoice_footer+0x1f>
jnp    116d <latex_invoice_education_invoice_footer+0x3d>
movsd  (%rsp),%xmm0
call   1030 <string_commas_dollar@plt>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x10,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
movsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
call   1030 <string_commas_dollar@plt>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Payment (Thank you) & -%s \\\\\0A\00"
@.str.1 = [17 x i8] c"\\bf Amount Due &\00"
@.str.2 = [13 x i8] c"\\bf \\$%s \\\\\0A\00"
define void @latex_invoice_education_invoice_footer(i32* %0, double %1, double %2) {
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
store i32* %0, i32** %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = fcmp une double %7, 0.000000e+00
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = load double, double* %6
%12 = call i8* @string_commas_dollar(double %11)
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %9, %3
%15 = load i32*, i32** %4
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32*, i32** %4
%18 = load double, double* %5
%19 = load double, double* %6
%20 = fsub double %18, %19
%21 = call i8* @string_commas_dollar(double %20)
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Payment (Thank you) & -%s \\\\\0A\00"
@.str.1 = [17 x i8] c"\\bf Amount Due &\00"
@.str.2 = [13 x i8] c"\\bf \\$%s \\\\\0A\00"
define void @latex_invoice_education_invoice_footer(i32* nocapture %0, double %1, double %2) {
%4 = fcmp une double %2, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i8* @string_commas_dollar(double %2)
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %3
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 16, i64 1, i32* %0)
%10 = fsub double %1, %2
%11 = tail call i8* @string_commas_dollar(double %10)
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %11)
ret void
}