#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 *, int);
void count_cards(int *count, int val) {
  if ((val > 2) && (val < 7)) {
    (*count)++;
  } else if (val == 10) {
    (*count)--;
  }
  printf("Current Count: %i\n", *count);
}


x86 assembly (clang, -O0):
<count_cards>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jle    1143 <count_cards+0x33>
cmpl   $0x7,-0xc(%rbp)
jge    1143 <count_cards+0x33>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    115d <count_cards+0x4d>
cmpl   $0xa,-0xc(%rbp)
jne    1158 <count_cards+0x48>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
jmp    115d <count_cards+0x4d>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_cards>:
mov    %esi,%eax
lea    -0x3(%rax),%ecx
cmp    $0x3,%ecx
ja     1121 <count_cards+0x11>
mov    (%rdi),%esi
add    $0x1,%esi
jmp    112b <count_cards+0x1b>
mov    (%rdi),%esi
cmp    $0xa,%eax
jne    112d <count_cards+0x1d>
add    $0xffffffff,%esi
mov    %esi,(%rdi)
lea    0xecc(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Current Count: %i\0A\00"
define void @count_cards(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 = icmp sgt i32 %5, 2
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 7
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
br label %22
14: ; preds = %7, %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32*, i32** %3
%19 = load i32, i32* %18
%20 = add nsw i32 %19, -1
store i32 %20, i32* %18
br label %21
21: ; preds = %17, %14
br label %22
22: ; preds = %21, %10
%23 = load i32*, i32** %3
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %24)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Current Count: %i\0A\00"
define void @count_cards(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -3
%4 = icmp ult i32 %3, 4
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %0
%7 = add nsw i32 %6, 1
br label %13
8: ; preds = %2
%9 = icmp eq i32 %1, 10
%10 = load i32, i32* %0
br i1 %9, label %11, label %15
11: ; preds = %8
%12 = add nsw i32 %10, -1
br label %13
13: ; preds = %5, %11
%14 = phi i32 [ %12, %11 ], [ %7, %5 ]
store i32 %14, i32* %0
br label %15
15: ; preds = %13, %8
%16 = phi i32 [ %10, %8 ], [ %14, %13 ]
%17 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %16)
ret void
}