#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 *, ...);
void print_cards(char *message, char *cards, int user_pick) {
  int i;
  printf("\n\t*** %s ***\n", message);
  printf("\t._.\t._.\t._.\n");
  printf("Cards:\t|%c|\t|%c|\t|%c|\n\t", cards[0], cards[1], cards[2]);
  if (user_pick == -1)
    printf(" 1 \t 2 \t 3\n");
  else {
    for (i = 0; i < user_pick; i++)
      printf("\t");
    printf(" ^-- your pick\n");
  }
}


x86 assembly (clang, -O0):
<print_cards>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edx
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%ecx
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xffffffff,-0x14(%rbp)
jne    1185 <print_cards+0x75>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c2 <print_cards+0xb2>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b4 <print_cards+0xa4>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118c <print_cards+0x7c>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cards>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed5(%rip),%rdi
call   1040 <puts@plt>
movsbl (%r14),%esi
movsbl 0x1(%r14),%edx
movsbl 0x2(%r14),%ecx
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xffffffff,%ebx
je     11a1 <print_cards+0x71>
lea    0xeb5(%rip),%r14
test   %ebx,%ebx
jle    11a8 <print_cards+0x78>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1190 <print_cards+0x60>
jmp    11a8 <print_cards+0x78>
lea    0xe9a(%rip),%r14
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\0A\09*** %s ***\0A\00"
@.str.1 = [14 x i8] c"\09._.\09._.\09._.\0A\00"
@.str.2 = [24 x i8] c"Cards:\09|%c|\09|%c|\09|%c|\0A\09\00"
@.str.3 = [12 x i8] c" 1 \09 2 \09 3\0A\00"
@.str.4 = [2 x i8] c"\09\00"
@.str.5 = [16 x i8] c" ^-- your pick\0A\00"
define void @print_cards(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %18, i32 %22)
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %40
28: ; preds = %3
store i32 0, i32* %7
br label %29
29: ; preds = %35, %28
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %29
38: ; preds = %29
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %38, %26
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0A\09*** %s ***\0A\00"
@.str.2 = [24 x i8] c"Cards:\09|%c|\09|%c|\09|%c|\0A\09\00"
@str = [13 x i8] c"\09._.\09._.\09._.\00"
@str.6 = [15 x i8] c" ^-- your pick\00"
@str.7 = [11 x i8] c" 1 \09 2 \09 3\00"
define void @print_cards(i8* %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%6 = load i8, i8* %1
%7 = sext i8 %6 to i32
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %10, i32 %13)
%15 = icmp eq i32 %2, -1
br i1 %15, label %23, label %16
16: ; preds = %3
%17 = icmp sgt i32 %2, 0
br i1 %17, label %18, label %23
18: ; preds = %16, %18
%19 = phi i32 [ %21, %18 ], [ 0, %16 ]
%20 = tail call i32 @putchar(i32 9)
%21 = add nuw nsw i32 %19, 1
%22 = icmp eq i32 %21, %2
br i1 %22, label %23, label %18
23: ; preds = %18, %16, %3
%24 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0), %3 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0), %16 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0), %18 ]
%25 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret void
}