#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 accept_payment(int *, int);
int /*<<< orphan*/ printf(char *, char const *);
void meta_accept_payment(int stats[3], int *cb, int expected,
                         const char *message) {
  stats[0]++;
  printf("%s\n", message);
  if (accept_payment(cb, 5) == expected) {
    stats[1]++;
    printf("%53s", "\x1b[32mSuccess\x1b[39m\n");
  } else {
    stats[2]++;
    printf("%53s", "\x1b[31mFailure\x1b[39m\n");
  }
}


x86 assembly (clang, -O0):
<meta_accept_payment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <accept_payment@plt>
cmp    -0x14(%rbp),%eax
jne    118e <meta_accept_payment+0x6e>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x4(%rax)
lea    0xe87(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1030 <printf@plt>
jmp    11ae <meta_accept_payment+0x8e>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x8(%rax)
lea    0xe62(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meta_accept_payment>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
addl   $0x1,(%rdi)
lea    0xec9(%rip),%rdi
mov    %rcx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <accept_payment@plt>
xor    %ecx,%ecx
cmp    %r14d,%eax
setne  %cl
lea    0xeae(%rip),%rax
lea    0xeba(%rip),%rsi
cmove  %rax,%rsi
addl   $0x1,0x4(%rbp,%rcx,4)
lea    0xe92(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [5 x i8] c"%53s\00"
@.str.2 = [19 x i8] c"\1B[32mSuccess\1B[39m\0A\00"
@.str.3 = [19 x i8] c"\1B[31mFailure\1B[39m\0A\00"
define void @meta_accept_payment(i32* nocapture %0, i32* %1, i32 %2, i8* %3) {
%5 = load i32, i32* %0
%6 = add nsw i32 %5, 1
store i32 %6, i32* %0
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%8 = tail call i32 @accept_payment(i32* %1, i32 5)
%9 = icmp eq i32 %8, %2
%10 = select i1 %9, i64 1, i64 2
%11 = select i1 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0)
%12 = getelementptr inbounds i32, i32* %0, i64 %10
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11)
ret void
}