#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 */
struct timespec {
  int /*<<< orphan*/ tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
scalar_t__ EOF;
scalar_t__ canshuffle(char *);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ printf(char *, ...);
int randrange(int, int);
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  struct timespec tm;
  clock_gettime(CLOCK_REALTIME, &tm);
  srand(tm.tv_nsec);
  char word[255];
  char origword[255];
  int randnum;
  char tmp;
  int endindex;
  while (scanf("%s", origword) != EOF) {
    endindex = strlen(origword) - 2;
    strcpy(word, origword);
    if (canshuffle(origword)) {
      while ((strcmp(word, origword) == 0)) {
        for (int i = 1; i < endindex; i++) {
          randnum = randrange(i, endindex);
          tmp = word[i];
          word[i] = word[randnum];
          word[randnum] = tmp;
        }
      }
    }
    printf("%s ", word);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x8(%rbp),%edi
call   1070 <srand@plt>
lea    -0x210(%rbp),%rsi
lea    0xe36(%rip),%rdi
call   1090 <scanf@plt>
mov    0x2e12(%rip),%rcx
cmp    (%rcx),%rax
je     12ee <main+0x15e>
lea    -0x210(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x2,%eax
mov    %eax,-0x21c(%rbp)
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x210(%rbp),%rdi
call   10a0 <canshuffle@plt>
cmp    $0x0,%rax
je     12d4 <main+0x144>
jmp    1222 <main+0x92>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    12cf <main+0x13f>
movl   $0x1,-0x220(%rbp)
mov    -0x220(%rbp),%eax
cmp    -0x21c(%rbp),%eax
jge    12ca <main+0x13a>
mov    -0x220(%rbp),%edi
mov    -0x21c(%rbp),%esi
call   10b0 <randrange@plt>
mov    %eax,-0x214(%rbp)
movslq -0x220(%rbp),%rax
mov    -0x110(%rbp,%rax,1),%al
mov    %al,-0x215(%rbp)
movslq -0x214(%rbp),%rax
mov    -0x110(%rbp,%rax,1),%cl
movslq -0x220(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x215(%rbp),%cl
movslq -0x214(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x220(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x220(%rbp)
jmp    1249 <main+0xb9>
jmp    1222 <main+0x92>
jmp    12d4 <main+0x144>
lea    -0x110(%rbp),%rsi
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    11bc <main+0x2c>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1050 <clock_gettime@plt>
mov    0x8(%rsp),%edi
call   1080 <srand@plt>
lea    0xe2c(%rip),%rdi
lea    0x110(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0x2e00(%rip),%rcx
cmp    (%rcx),%rax
jne    120b <main+0x6b>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x110(%rsp),%r13
lea    0x10(%rsp),%r14
jmp    124c <main+0xac>
nopw   0x0(%rax,%rax,1)
lea    0xddc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdc8(%rip),%rdi
mov    %r13,%rsi
call   10a0 <scanf@plt>
mov    0x2da1(%rip),%rcx
cmp    (%rcx),%rax
je     11ed <main+0x4d>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
call   10b0 <canshuffle@plt>
test   %rax,%rax
je     1220 <main+0x80>
mov    %r14,%rdi
mov    %r13,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1220 <main+0x80>
lea    -0x2(%rbx),%ebp
mov    %ebp,%r12d
jmp    12a0 <main+0x100>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r13,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1220 <main+0x80>
cmp    $0x4,%ebx
jl     1290 <main+0xf0>
mov    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %ebp,%esi
call   10c0 <randrange@plt>
movzbl 0x10(%rsp,%r15,1),%ecx
cltq
movzbl 0x10(%rsp,%rax,1),%edx
mov    %dl,0x10(%rsp,%r15,1)
mov    %cl,0x10(%rsp,%rax,1)
add    $0x1,%r15
cmp    %r15,%r12
jne    12b0 <main+0x110>
jmp    1290 <main+0xf0>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = alloca [255 x i8]
%4 = alloca [255 x i8]
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = load i32, i32* @CLOCK_REALTIME
%10 = call i32 @clock_gettime(i32 %9, %struct.timespec* %2)
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @srand(i32 %12)
br label %14
14: ; preds = %64, %0
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%16 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i64, i64* @EOF
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %67
19: ; preds = %14
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = sub nsw i32 %21, 2
store i32 %22, i32* %7
%23 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%25 = call i32 @strcpy(i8* %23, i8* %24)
%26 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%27 = call i64 @canshuffle(i8* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %64
29: ; preds = %19
br label %30
30: ; preds = %62, %29
%31 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%33 = call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %63
35: ; preds = %30
store i32 1, i32* %8
br label %36
36: ; preds = %59, %35
%37 = load i32, i32* %8
%38 = load i32, i32* %7
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %62
40: ; preds = %36
%41 = load i32, i32* %8
%42 = load i32, i32* %7
%43 = call i32 @randrange(i32 %41, i32 %42)
store i32 %43, i32* %5
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %45
%47 = load i8, i8* %46
store i8 %47, i8* %6
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %53
store i8 %51, i8* %54
%55 = load i8, i8* %6
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %57
store i8 %55, i8* %58
br label %59
59: ; preds = %40
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 1
store i32 %61, i32* %8
br label %36
62: ; preds = %36
br label %30
63: ; preds = %30
br label %64
64: ; preds = %63, %19
%65 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %65)
br label %14
67: ; preds = %14
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%69 = load i32, i32* %1
ret i32 %69
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%s \00"
define i32 @main() {
%1 = alloca %struct.timespec
%2 = alloca [255 x i8]
%3 = alloca [255 x i8]
%4 = bitcast %struct.timespec* %1 to i8*
%5 = load i32, i32* @CLOCK_REALTIME
%6 = call i32 @clock_gettime(i32 %5, %struct.timespec* %1)
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @srand(i32 %8)
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %47, label %15
15: ; preds = %0, %42
%16 = call i32 @strlen(i8* %11)
%17 = add i32 %16, -2
%18 = call i32 @strcpy(i8* %10, i8* %11)
%19 = call i64 @canshuffle(i8* %11)
%20 = icmp eq i64 %19, 0
br i1 %20, label %42, label %21
21: ; preds = %15
%22 = call i64 @strcmp(i8* %10, i8* %11)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %42
24: ; preds = %21
%25 = icmp sgt i32 %16, 3
%26 = zext i32 %17 to i64
br label %30
27: ; preds = %31, %30
%28 = call i64 @strcmp(i8* %10, i8* %11)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %42
30: ; preds = %24, %27
br i1 %25, label %31, label %27
31: ; preds = %30, %31
%32 = phi i64 [ %40, %31 ], [ 1, %30 ]
%33 = trunc i64 %32 to i32
%34 = call i32 @randrange(i32 %33, i32 %17)
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %32
%36 = load i8, i8* %35
%37 = sext i32 %34 to i64
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %37
%39 = load i8, i8* %38
store i8 %39, i8* %35
store i8 %36, i8* %38
%40 = add nuw nsw i64 %32, 1
%41 = icmp eq i64 %40, %26
br i1 %41, label %27, label %31
42: ; preds = %27, %21, %15
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%44 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%45 = load i64, i64* @EOF
%46 = icmp eq i64 %44, %45
br i1 %46, label %47, label %15
47: ; preds = %42, %0
%48 = call i32 @putchar(i32 10)
ret i32 0
}