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


x86 assembly (clang, -O0):
<update_card_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jle    1147 <update_card_count+0x37>
cmpl   $0x7,-0x4(%rbp)
jge    1147 <update_card_count+0x37>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1165 <update_card_count+0x55>
cmpl   $0xa,-0x4(%rbp)
jne    1160 <update_card_count+0x50>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1165 <update_card_count+0x55>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_card_count>:
lea    -0x3(%rdi),%eax
cmp    $0x3,%eax
ja     111f <update_card_count+0xf>
mov    (%rsi),%eax
add    $0x1,%eax
jmp    1129 <update_card_count+0x19>
mov    (%rsi),%eax
cmp    $0xa,%edi
jne    112b <update_card_count+0x1b>
add    $0xffffffff,%eax
mov    %eax,(%rsi)
lea    0xece(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [19 x i8] c"Current count: %i\0A\00"
define void @update_card_count(i32 %0, i32* nocapture %1) {
%3 = add i32 %0, -3
%4 = icmp ult i32 %3, 4
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 1
br label %13
8: ; preds = %2
%9 = icmp eq i32 %0, 10
%10 = load i32, i32* %1
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* %1
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
}