#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*/ printf(char *, unsigned int, unsigned int const);
void print_exchange(unsigned money, const unsigned *bills) {
  if (!*bills)
    return;
  if (*bills > money) {
    print_exchange(money, bills + 1);
    return;
  }
  printf("%u %u\n", money / *bills, *bills);
  print_exchange(money % *bills, bills + 1);
}


x86 assembly (clang, -O0):
<print_exchange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1141 <print_exchange+0x21>
jmp    119e <print_exchange+0x7e>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jbe    1165 <print_exchange+0x45>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
call   1040 <print_exchange@plt>
jmp    119e <print_exchange+0x7e>
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %edx,%edi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
call   1040 <print_exchange@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_exchange>:
push   %rbp
push   %r14
push   %rbx
mov    (%rsi),%ecx
test   %ecx,%ecx
je     1161 <print_exchange+0x51>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeda(%rip),%r14
add    $0x4,%rbx
nopw   0x0(%rax,%rax,1)
cmp    %ebp,%ecx
jbe    1140 <print_exchange+0x30>
mov    (%rbx),%ecx
add    $0x4,%rbx
test   %ecx,%ecx
jne    1130 <print_exchange+0x20>
jmp    1161 <print_exchange+0x51>
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %r14,%rdi
mov    %eax,%esi
mov    %ecx,%edx
call   1030 <printf@plt>
mov    %ebp,%eax
xor    %edx,%edx
divl   -0x4(%rbx)
mov    (%rbx),%ecx
mov    %edx,%ebp
test   %ecx,%ecx
jne    1126 <print_exchange+0x16>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%u %u\0A\00"
define void @print_exchange(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %2
br label %32
9: ; preds = %2
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = load i32, i32* %3
%13 = icmp ugt i32 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32, i32* %3
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 1
br label %32
18: ; preds = %9
%19 = load i32, i32* %3
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = udiv i32 %19, %21
%23 = load i32*, i32** %4
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %24)
%26 = load i32, i32* %3
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = urem i32 %26, %28
%30 = load i32*, i32** %4
%31 = getelementptr inbounds i32, i32* %30, i64 1
br label %32
32: ; preds = %18, %14, %8
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%u %u\0A\00"
define void @print_exchange(i32 %0, i32* %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %25, label %5
5: ; preds = %2, %17
%6 = phi i32 [ %23, %17 ], [ %3, %2 ]
%7 = phi i32* [ %22, %17 ], [ %1, %2 ]
%8 = phi i32 [ %21, %17 ], [ %0, %2 ]
br label %9
9: ; preds = %5, %13
%10 = phi i32 [ %6, %5 ], [ %15, %13 ]
%11 = phi i32* [ %7, %5 ], [ %14, %13 ]
%12 = icmp ugt i32 %10, %8
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = getelementptr inbounds i32, i32* %11, i64 1
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %25, label %9
17: ; preds = %9
%18 = udiv i32 %8, %10
%19 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %10)
%20 = load i32, i32* %11
%21 = urem i32 %8, %20
%22 = getelementptr inbounds i32, i32* %11, i64 1
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %5
25: ; preds = %17, %13, %2
ret void
}