#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ money(int, int *, int *);
int /*<<< orphan*/ printMoneyResults(int, int *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr,
            "%s: program expected 1 argument, but instead recieved %i \n",
            argv[0], argc - 1);
    exit(EXIT_FAILURE);
  } else if (argv[1][0] == '-') {
    fprintf(stderr,
            "%s: program expected positive value for money, but instead "
            "recieved %i \n",
            argv[0], atoi(argv[1]));
    exit(EXIT_FAILURE);
  } else {
    int dollars = 0;
    int cents = 0;
    int total = atoi(argv[1]);
    money(total, &dollars, &cents);
    printMoneyResults(total, &dollars, &cents);
    exit(EXIT_SUCCESS);
  }
  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   $0x2,-0x8(%rbp)
je     11a0 <main+0x50>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe73(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11fb <main+0xab>
mov    0x2e25(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
lea    0xe53(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <money@plt>
mov    -0x1c(%rbp),%edi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <printMoneyResults@plt>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    1188 <main+0x38>
mov    0x8(%rsi),%rdi
cmpb   $0x2d,(%rdi)
jne    11b3 <main+0x63>
mov    0x2e72(%rip),%rax
mov    (%rax),%ebx
mov    (%rsi),%r14
call   1060 <atoi@plt>
lea    0xebc(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %eax,%ecx
jmp    11a0 <main+0x50>
mov    %edi,%ecx
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
add    $0xffffffff,%ecx
lea    0xe60(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
call   1060 <atoi@plt>
mov    %eax,%ebx
lea    0xc(%rsp),%r14
lea    0x8(%rsp),%r15
mov    %eax,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <money@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <printMoneyResults@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"%s: program expected 1 argument, but instead recieved %i \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [73 x i8] c"%s: program expected positive value for money, but instead recieved %i \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %21
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 45
br i1 %28, label %29, label %41
29: ; preds = %21
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), i8* %33, i32 %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %21
store i32 0, i32* %6
store i32 0, i32* %7
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %8
%46 = load i32, i32* %8
%47 = call i32 @money(i32 %46, i32* %6, i32* %7)
%48 = load i32, i32* %8
%49 = call i32 @printMoneyResults(i32 %48, i32* %6, i32* %7)
%50 = load i32, i32* @EXIT_SUCCESS
%51 = call i32 @exit(i32 %50)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"%s: program expected 1 argument, but instead recieved %i \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [73 x i8] c"%s: program expected positive value for money, but instead recieved %i \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = icmp eq i32 %0, 2
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = add nsw i32 %0, -1
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 45
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = tail call i32 @atoi(i8* %15)
%22 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), i8* %20, i32 %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %13
%26 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%27 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%28 = tail call i32 @atoi(i8* %15)
%29 = call i32 @money(i32 %28, i32* %3, i32* %4)
%30 = call i32 @printMoneyResults(i32 %28, i32* %3, i32* %4)
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}