#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*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int main() {
  const char *cardsp = "JQK";
  char cards[4];
  strcpy(cards, cardsp);
  char a_card = cards[2];
  cards[2] = cards[1];
  cards[1] = cards[0];
  cards[0] = cards[2];
  cards[2] = cards[1];
  cards[1] = a_card;
  puts(cards);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x12(%rbp),%al
mov    %al,-0x15(%rbp)
mov    -0x13(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x14(%rbp),%al
mov    %al,-0x13(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x14(%rbp)
mov    -0x13(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x15(%rbp),%al
mov    %al,-0x13(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
movzwl 0xd(%rsp),%eax
mov    0xc(%rsp),%cl
mov    %ax,0xc(%rsp)
mov    %cl,0xe(%rsp)
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"JQK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [4 x i8]
%4 = alloca i8
store i32 0, i32* %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%9 = load i8, i8* %8
store i8 %9, i8* %4
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%11 = load i8, i8* %10
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %11, i8* %12
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%14 = load i8, i8* %13
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %14, i8* %15
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%17 = load i8, i8* %16
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 %17, i8* %18
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%20 = load i8, i8* %19
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 %20, i8* %21
%22 = load i8, i8* %4
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 %22, i8* %23
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%25 = call i32 @puts(i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"JQK\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 2
%5 = load i8, i8* %4
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
%7 = load i8, i8* %6
%8 = load i8, i8* %2
store i8 %7, i8* %2
store i8 %8, i8* %4
store i8 %5, i8* %6
%9 = call i32 @puts(i8* %2)
ret i32 0
}