#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 */
struct vm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dispense_change_tests(int *, struct vm *);
int /*<<< orphan*/ item_retrieval_tests(int *, struct vm *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ take_coin_tests(int *);
int /*<<< orphan*/ validate_coin_tests(int *);
void run_tests(struct vm *vm) {
  int stats[3] = {0, 0, 0};
  printf("\n\nRunning test suite.\n\n");
  item_retrieval_tests(stats, vm);
  validate_coin_tests(stats);
  take_coin_tests(stats);
  dispense_change_tests(stats, vm);
  printf("\n\n%d tests run, %d passed, %d failed\n", stats[0], stats[1],
         stats[2]);
}


x86 assembly (clang, -O0):
<run_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <item_retrieval_tests@plt>
lea    -0x14(%rbp),%rdi
call   1060 <validate_coin_tests@plt>
lea    -0x14(%rbp),%rdi
call   1070 <take_coin_tests@plt>
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <dispense_change_tests@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_tests>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xea4(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <item_retrieval_tests@plt>
mov    %rbx,%rdi
call   1060 <validate_coin_tests@plt>
mov    %rbx,%rdi
call   1070 <take_coin_tests@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <dispense_change_tests@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
lea    0xe3b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.vm = type { i32 }
@.str = [24 x i8] c"\0A\0ARunning test suite.\0A\0A\00"
@.str.1 = [38 x i8] c"\0A\0A%d tests run, %d passed, %d failed\0A\00"
define void @run_tests(%struct.vm* %0) {
%2 = alloca %struct.vm*
%3 = alloca [3 x i32]
store %struct.vm* %0, %struct.vm** %2
%4 = bitcast [3 x i32]* %3 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%7 = load %struct.vm*, %struct.vm** %2
%8 = call i32 @item_retrieval_tests(i32* %6, %struct.vm* %7)
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%10 = call i32 @validate_coin_tests(i32* %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%12 = call i32 @take_coin_tests(i32* %11)
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%14 = load %struct.vm*, %struct.vm** %2
%15 = call i32 @dispense_change_tests(i32* %13, %struct.vm* %14)
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%17 = load i32, i32* %16
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %19, i32 %21)
ret void
}

LLVM IR (-O2):
%struct.vm = type { i32 }
@.str.1 = [38 x i8] c"\0A\0A%d tests run, %d passed, %d failed\0A\00"
@str = [23 x i8] c"\0A\0ARunning test suite.\0A\00"
define void @run_tests(%struct.vm* %0) {
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = call i32 @item_retrieval_tests(i32* %5, %struct.vm* %0)
%7 = call i32 @validate_coin_tests(i32* %5)
%8 = call i32 @take_coin_tests(i32* %5)
%9 = call i32 @dispense_change_tests(i32* %5, %struct.vm* %0)
%10 = load i32, i32* %5
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%12 = load i32, i32* %11
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12, i32 %14)
ret void
}