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

/* Variables and functions */
int /*<<< orphan*/ COLOR_PAIR(int);
int COLS;
int MAX(int, int);
int /*<<< orphan*/ abs(int /*<<< orphan*/);
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ addstr(char *);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ getyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ mvaddstr(int, int, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int,
                            int /*<<< orphan*/);
int /*<<< orphan*/ stdscr;
int strlen(char *);
void display_money(int money, char *str) {
  char number[(11 + 2) + 1];
  int y, x;
  int tx, cx;
  getyx(stdscr, y, x);
  snprintf(number, sizeof(number), "$%s%d.%02d",
           (((money) < 0 && (money) > -100) ? "-" : ""), ((money) / 100),
           (abs((money) - (((money) / 100) * 100))));
  if (str) {
    cx = COLS - MAX(strlen(number), 7) - strlen(str) - strlen(": ");
    for (tx = x; tx < cx; tx++)
      do {
        attron(COLOR_PAIR(1));
        addch((' '));
        attroff(COLOR_PAIR(1));
      } while (0);
    do {
      attron(COLOR_PAIR(1));
      addstr((str));
      attroff(COLOR_PAIR(1));
    } while (0);
    cx = COLS - MAX(strlen(number), 7) - strlen(": ");
    for (tx = x; tx < cx; tx++)
      do {
        attron(COLOR_PAIR(1));
        addch((' '));
        attroff(COLOR_PAIR(1));
      } while (0);
    do {
      attron(COLOR_PAIR(1));
      addstr((": "));
      attroff(COLOR_PAIR(1));
    } while (0);
  } else {
    cx = COLS - MAX(strlen(number), 7);
    for (tx = x; tx < cx; tx++)
      do {
        attron(COLOR_PAIR(1));
        addch((' '));
        attroff(COLOR_PAIR(1));
      } while (0);
  }
  x = COLS - strlen(number);
  do {
    attron(COLOR_PAIR(1));
    mvaddstr((y), (x), (number));
    attroff(COLOR_PAIR(1));
  } while (0);
}


x86 assembly (clang, -O0):
<display_money>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1070 <getyx@plt>
lea    -0x1e(%rbp),%rax
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x31(%rbp)
jge    11f4 <display_money+0x44>
cmpl   $0xffffff9c,-0x4(%rbp)
setg   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%dl
lea    0xe11(%rip),%rax
lea    0xe06(%rip),%rcx
test   $0x1,%dl
cmovne %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   $0x64,%eax,%eax
sub    %eax,%edi
call   1040 <abs@plt>
mov    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%rcx
mov    -0x44(%rbp),%r8d
mov    %eax,%r9d
mov    $0xe,%esi
lea    0xdaf(%rip),%rdx
call   1080 <snprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     140a <display_money+0x25a>
mov    0x2d78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
lea    -0x1e(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
mov    $0x7,%esi
call   1050 <MAX@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x54(%rbp)
lea    0xd67(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    130b <display_money+0x15b>
jmp    12cc <display_money+0x11c>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x20,%edi
call   10b0 <addch@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
jmp    12fd <display_money+0x14d>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12bb <display_money+0x10b>
jmp    1310 <display_money+0x160>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    -0x10(%rbp),%rdi
call   10d0 <addstr@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    0x2c9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
lea    -0x1e(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
mov    $0x7,%esi
call   1050 <MAX@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x60(%rbp)
lea    0xca0(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13d2 <display_money+0x222>
jmp    1393 <display_money+0x1e3>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x20,%edi
call   10b0 <addch@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
jmp    13c4 <display_money+0x214>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1382 <display_money+0x1d2>
jmp    13d7 <display_money+0x227>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
lea    0xc1e(%rip),%rdi
call   10d0 <addstr@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
jmp    1490 <display_money+0x2e0>
mov    0x2bcf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
lea    -0x1e(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%edi
mov    $0x7,%esi
call   1050 <MAX@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    148b <display_money+0x2db>
jmp    144c <display_money+0x29c>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    $0x20,%edi
call   10b0 <addch@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
jmp    147d <display_money+0x2cd>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    143b <display_money+0x28b>
jmp    1490 <display_money+0x2e0>
mov    0x2b49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
lea    -0x1e(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1090 <attron@plt>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
lea    -0x1e(%rbp),%rdx
call   10c0 <mvaddstr@plt>
mov    $0x1,%edi
call   10a0 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_money>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1060 <getyx@plt>
cmp    $0xffffff9d,%ebp
lea    0xe56(%rip),%rax
lea    0xe53(%rip),%rcx
cmovae %rax,%rcx
movslq %ebp,%rax
imul   $0x51eb851f,%rax,%r8
mov    %r8,%rdx
shr    $0x3f,%rdx
sar    $0x25,%r8
add    %edx,%r8d
imul   $0xffffff9c,%r8d,%edx
add    %edx,%eax
mov    %eax,%r9d
neg    %r9d
cmovs  %eax,%r9d
lea    0xe11(%rip),%rdx
lea    0x2(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xe,%esi
call   1070 <snprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
mov    $0x7,%esi
call   1040 <MAX@plt>
test   %rbx,%rbx
je     12a7 <display_money+0x117>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xde0(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1080 <attron@plt>
mov    %rbx,%rdi
call   10b0 <addstr@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
lea    0x2(%rsp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
mov    $0x7,%esi
call   1040 <MAX@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1080 <attron@plt>
mov    %r14,%rdi
call   10b0 <addstr@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%ebx
lea    0x2(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
sub    %eax,%ebx
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1080 <attron@plt>
mov    %ebx,%esi
mov    %rbp,%rdx
call   10a0 <mvaddstr@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdscr = global i32 0
@.str = [11 x i8] c"$%s%d.%02d\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [1 x i8] zeroinitializer
@COLS = global i32 0
@.str.3 = [3 x i8] c": \00"
define void @display_money(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [14 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%10 = load i32, i32* @stdscr
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @getyx(i32 %10, i32 %11, i32 %12)
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, -100
br label %20
20: ; preds = %17, %2
%21 = phi i1 [ false, %2 ], [ %19, %17 ]
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%24 = load i32, i32* %3
%25 = sdiv i32 %24, 100
%26 = load i32, i32* %3
%27 = load i32, i32* %3
%28 = sdiv i32 %27, 100
%29 = mul nsw i32 %28, 100
%30 = sub nsw i32 %26, %29
%31 = call i32 @abs(i32 %30)
%32 = call i32 @snprintf(i8* %14, i32 14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %23, i32 %25, i32 %31)
%33 = load i8*, i8** %4
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %102
35: ; preds = %20
%36 = load i32, i32* @COLS
%37 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
%39 = call i32 @MAX(i32 %38, i32 7)
%40 = sub nsw i32 %36, %39
%41 = load i8*, i8** %4
%42 = call i32 @strlen(i8* %41)
%43 = sub nsw i32 %40, %42
%44 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%45 = sub nsw i32 %43, %44
store i32 %45, i32* %9
%46 = load i32, i32* %7
store i32 %46, i32* %8
br label %47
47: ; preds = %59, %35
%48 = load i32, i32* %8
%49 = load i32, i32* %9
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %62
51: ; preds = %47
br label %52
52: ; preds = %51
%53 = call i32 @COLOR_PAIR(i32 1)
%54 = call i32 @attron(i32 %53)
%55 = call i32 @addch(i8 signext 32)
%56 = call i32 @COLOR_PAIR(i32 1)
%57 = call i32 @attroff(i32 %56)
br label %58
58: ; preds = %52
br label %59
59: ; preds = %58
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %47
62: ; preds = %47
br label %63
63: ; preds = %62
%64 = call i32 @COLOR_PAIR(i32 1)
%65 = call i32 @attron(i32 %64)
%66 = load i8*, i8** %4
%67 = call i32 @addstr(i8* %66)
%68 = call i32 @COLOR_PAIR(i32 1)
%69 = call i32 @attroff(i32 %68)
br label %70
70: ; preds = %63
%71 = load i32, i32* @COLS
%72 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%73 = call i32 @strlen(i8* %72)
%74 = call i32 @MAX(i32 %73, i32 7)
%75 = sub nsw i32 %71, %74
%76 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%77 = sub nsw i32 %75, %76
store i32 %77, i32* %9
%78 = load i32, i32* %7
store i32 %78, i32* %8
br label %79
79: ; preds = %91, %70
%80 = load i32, i32* %8
%81 = load i32, i32* %9
%82 = icmp slt i32 %80, %81
br i1 %82, label %83, label %94
83: ; preds = %79
br label %84
84: ; preds = %83
%85 = call i32 @COLOR_PAIR(i32 1)
%86 = call i32 @attron(i32 %85)
%87 = call i32 @addch(i8 signext 32)
%88 = call i32 @COLOR_PAIR(i32 1)
%89 = call i32 @attroff(i32 %88)
br label %90
90: ; preds = %84
br label %91
91: ; preds = %90
%92 = load i32, i32* %8
%93 = add nsw i32 %92, 1
store i32 %93, i32* %8
br label %79
94: ; preds = %79
br label %95
95: ; preds = %94
%96 = call i32 @COLOR_PAIR(i32 1)
%97 = call i32 @attron(i32 %96)
%98 = call i32 @addstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%99 = call i32 @COLOR_PAIR(i32 1)
%100 = call i32 @attroff(i32 %99)
br label %101
101: ; preds = %95
br label %125
102: ; preds = %20
%103 = load i32, i32* @COLS
%104 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%105 = call i32 @strlen(i8* %104)
%106 = call i32 @MAX(i32 %105, i32 7)
%107 = sub nsw i32 %103, %106
store i32 %107, i32* %9
%108 = load i32, i32* %7
store i32 %108, i32* %8
br label %109
109: ; preds = %121, %102
%110 = load i32, i32* %8
%111 = load i32, i32* %9
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %124
113: ; preds = %109
br label %114
114: ; preds = %113
%115 = call i32 @COLOR_PAIR(i32 1)
%116 = call i32 @attron(i32 %115)
%117 = call i32 @addch(i8 signext 32)
%118 = call i32 @COLOR_PAIR(i32 1)
%119 = call i32 @attroff(i32 %118)
br label %120
120: ; preds = %114
br label %121
121: ; preds = %120
%122 = load i32, i32* %8
%123 = add nsw i32 %122, 1
store i32 %123, i32* %8
br label %109
124: ; preds = %109
br label %125
125: ; preds = %124, %101
%126 = load i32, i32* @COLS
%127 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%128 = call i32 @strlen(i8* %127)
%129 = sub nsw i32 %126, %128
store i32 %129, i32* %7
br label %130
130: ; preds = %125
%131 = call i32 @COLOR_PAIR(i32 1)
%132 = call i32 @attron(i32 %131)
%133 = load i32, i32* %6
%134 = load i32, i32* %7
%135 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%136 = call i32 @mvaddstr(i32 %133, i32 %134, i8* %135)
%137 = call i32 @COLOR_PAIR(i32 1)
%138 = call i32 @attroff(i32 %137)
br label %139
139: ; preds = %130
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@.str = [11 x i8] c"$%s%d.%02d\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [1 x i8] zeroinitializer
@COLS = global i32 0
@.str.3 = [3 x i8] c": \00"
define void @display_money(i32 %0, i8* %1) {
%3 = alloca [14 x i8]
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdscr
%6 = tail call i32 @getyx(i32 %5, i32 undef, i32 undef)
%7 = icmp ugt i32 %0, -100
%8 = select i1 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%9 = sdiv i32 %0, 100
%10 = mul nsw i32 %9, -100
%11 = add i32 %10, %0
%12 = tail call i32 @llvm.abs.i32(i32 %11, i1 true)
%13 = call i32 @snprintf(i8* %4, i32 14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i32 %12)
%14 = icmp eq i8* %1, null
%15 = call i32 @strlen(i8* %4)
%16 = call i32 @MAX(i32 %15, i32 7)
br i1 %14, label %33, label %17
17: ; preds = %2
%18 = call i32 @strlen(i8* %1)
%19 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @COLOR_PAIR(i32 1)
%21 = call i32 @attron(i32 %20)
%22 = call i32 @addstr(i8* %1)
%23 = call i32 @COLOR_PAIR(i32 1)
%24 = call i32 @attroff(i32 %23)
%25 = call i32 @strlen(i8* %4)
%26 = call i32 @MAX(i32 %25, i32 7)
%27 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @COLOR_PAIR(i32 1)
%29 = call i32 @attron(i32 %28)
%30 = call i32 @addstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 @COLOR_PAIR(i32 1)
%32 = call i32 @attroff(i32 %31)
br label %33
33: ; preds = %2, %17
%34 = load i32, i32* @COLS
%35 = call i32 @strlen(i8* %4)
%36 = sub nsw i32 %34, %35
%37 = call i32 @COLOR_PAIR(i32 1)
%38 = call i32 @attron(i32 %37)
%39 = call i32 @mvaddstr(i32 undef, i32 %36, i8* %4)
%40 = call i32 @COLOR_PAIR(i32 1)
%41 = call i32 @attroff(i32 %40)
ret void
}