#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*/ strncpy(char *, char *, int);
char *freecell_solver_p2u_suit(int suit, char *str, int card_num_is_null,
                               int flipped) {
  if (flipped) {
    strncpy(str, "*", 2);
  } else if (suit == 0) {
    if (card_num_is_null)
      strncpy(str, " ", 2);
    else
      strncpy(str, "H", 2);
  } else if (suit == 1)
    strncpy(str, "C", 2);
  else if (suit == 2)
    strncpy(str, "D", 2);
  else if (suit == 3)
    strncpy(str, "S", 2);
  else
    strncpy(str, " ", 2);
  return str;
}


x86 assembly (clang, -O0):
<freecell_solver_p2u_suit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1149 <freecell_solver_p2u_suit+0x39>
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    1226 <freecell_solver_p2u_suit+0x116>
cmpl   $0x0,-0x4(%rbp)
jne    1191 <freecell_solver_p2u_suit+0x81>
cmpl   $0x0,-0x14(%rbp)
je     1177 <freecell_solver_p2u_suit+0x67>
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    118c <freecell_solver_p2u_suit+0x7c>
mov    -0x10(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    1221 <freecell_solver_p2u_suit+0x111>
cmpl   $0x1,-0x4(%rbp)
jne    11b5 <freecell_solver_p2u_suit+0xa5>
mov    -0x10(%rbp),%rdi
lea    0xe60(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    121c <freecell_solver_p2u_suit+0x10c>
cmpl   $0x2,-0x4(%rbp)
jne    11d9 <freecell_solver_p2u_suit+0xc9>
mov    -0x10(%rbp),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    1217 <freecell_solver_p2u_suit+0x107>
cmpl   $0x3,-0x4(%rbp)
jne    11fd <freecell_solver_p2u_suit+0xed>
mov    -0x10(%rbp),%rdi
lea    0xe1c(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    1212 <freecell_solver_p2u_suit+0x102>
mov    -0x10(%rbp),%rdi
lea    0xdfa(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
jmp    1217 <freecell_solver_p2u_suit+0x107>
jmp    121c <freecell_solver_p2u_suit+0x10c>
jmp    1221 <freecell_solver_p2u_suit+0x111>
jmp    1226 <freecell_solver_p2u_suit+0x116>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freecell_solver_p2u_suit>:
push   %rbx
mov    %rsi,%rbx
test   %ecx,%ecx
je     1131 <freecell_solver_p2u_suit+0x21>
lea    0xef1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
ret
cmp    $0x3,%edi
ja     1165 <freecell_solver_p2u_suit+0x55>
lea    0xed9(%rip),%rsi
mov    %edi,%eax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
test   %edx,%edx
lea    0xebc(%rip),%rax
lea    0xeb3(%rip),%rsi
cmove  %rax,%rsi
jmp    111f <freecell_solver_p2u_suit+0xf>
lea    0xea6(%rip),%rsi
jmp    111f <freecell_solver_p2u_suit+0xf>
lea    0xea3(%rip),%rsi
jmp    111f <freecell_solver_p2u_suit+0xf>
lea    0xe9c(%rip),%rsi
jmp    111f <freecell_solver_p2u_suit+0xf>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"H\00"
@.str.3 = [2 x i8] c"C\00"
@.str.4 = [2 x i8] c"D\00"
@.str.5 = [2 x i8] c"S\00"
define i8* @freecell_solver_p2u_suit(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = call i32 @strncpy(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 2)
br label %52
14: ; preds = %4
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i8*, i8** %6
%22 = call i32 @strncpy(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %26
23: ; preds = %17
%24 = load i8*, i8** %6
%25 = call i32 @strncpy(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 2)
br label %26
26: ; preds = %23, %20
br label %51
27: ; preds = %14
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i8*, i8** %6
%32 = call i32 @strncpy(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 2)
br label %50
33: ; preds = %27
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 2
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i8*, i8** %6
%38 = call i32 @strncpy(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 2)
br label %49
39: ; preds = %33
%40 = load i32, i32* %5
%41 = icmp eq i32 %40, 3
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i8*, i8** %6
%44 = call i32 @strncpy(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 2)
br label %48
45: ; preds = %39
%46 = load i8*, i8** %6
%47 = call i32 @strncpy(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %48
48: ; preds = %45, %42
br label %49
49: ; preds = %48, %36
br label %50
50: ; preds = %49, %30
br label %51
51: ; preds = %50, %26
br label %52
52: ; preds = %51, %11
%53 = load i8*, i8** %6
ret i8* %53
}

LLVM IR (-O2):
@.str = [2 x i8] c"*\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"H\00"
@.str.3 = [2 x i8] c"C\00"
@.str.4 = [2 x i8] c"D\00"
@.str.5 = [2 x i8] c"S\00"
define i8* @freecell_solver_p2u_suit(i32 %0, i8* returned %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %13
6: ; preds = %4
switch i32 %0, label %12 [
i32 0, label %7
i32 1, label %13
i32 2, label %10
i32 3, label %11
]
7: ; preds = %6
%8 = icmp eq i32 %2, 0
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
br label %13
10: ; preds = %6
br label %13
11: ; preds = %6
br label %13
12: ; preds = %6
br label %13
13: ; preds = %6, %7, %4, %10, %12, %11
%14 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), %10 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %12 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), %11 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %4 ], [ %9, %7 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %6 ]
%15 = tail call i32 @strncpy(i8* %1, i8* %14, i32 2)
ret i8* %1
}