#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 */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("Add a number of characters!\n");
    return 0;
  }
  char array[] = {'\x40', '\x43', '\x41', '\x42', '\x48',
                  '\x4B', '\x49', '\x4A', '\x0f'};
  srand(time(NULL));
  int i;
  for (i = 0; i < atoi(argv[1]); i++) {
    int random = rand() % sizeof(array);
    printf("\\x%x", array[random]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118a <main+0x3a>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1227 <main+0xd7>
mov    0xe91(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xe8f(%rip),%al
mov    %al,-0x11(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jge    1212 <main+0xc2>
mov    $0x0,%al
call   1070 <rand@plt>
cltq
mov    $0x9,%ecx
xor    %edx,%edx
div    %rcx
mov    %edx,%eax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x19(%rbp,%rax,1),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b5 <main+0x65>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x1,%edi
jg     118e <main+0x1e>
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
jmp    1214 <main+0xa4>
mov    %rsi,%rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    0x8(%rbx),%rdi
call   1080 <atoi@plt>
test   %eax,%eax
jle    120a <main+0x9a>
movabs $0xe38e38e38e38e38f,%r15
38 8e e3
lea    0xe43(%rip),%r12
lea    0xe45(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <rand@plt>
movslq %eax,%rcx
mov    %rcx,%rax
mul    %r15
shr    $0x3,%rdx
lea    (%rdx,%rdx,8),%rax
sub    %rax,%rcx
movsbl (%r12,%rcx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
mov    0x8(%rbx),%rdi
call   1080 <atoi@plt>
cmp    %eax,%ebp
jl     11d0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Add a number of characters!\0A\00"
@__const.main.array = [9 x i8] c"@CABHKIJ\0F"
@.str.1 = [5 x i8] c"\\x%x\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %40
13: ; preds = %2
%14 = bitcast [9 x i8]* %6 to i8*
%15 = call i32 @time(i32* null)
%16 = call i32 @srand(i32 %15)
store i32 0, i32* %7
br label %17
17: ; preds = %35, %13
%18 = load i32, i32* %7
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
%23 = icmp slt i32 %18, %22
br i1 %23, label %24, label %38
24: ; preds = %17
%25 = call i32 (...) @rand()
%26 = sext i32 %25 to i64
%27 = urem i64 %26, 9
%28 = trunc i64 %27 to i32
store i32 %28, i32* %8
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %24
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %17
38: ; preds = %17
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %40
40: ; preds = %38, %11
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@__const.main.array = [9 x i8] c"@CABHKIJ\0F"
@.str.1 = [5 x i8] c"\\x%x\00"
@str = [28 x i8] c"Add a number of characters!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %28
6: ; preds = %2
%7 = tail call i32 @time(i32* null)
%8 = tail call i32 @srand(i32 %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %6, %13
%14 = phi i32 [ %22, %13 ], [ 0, %6 ]
%15 = tail call i32 (...) @rand()
%16 = sext i32 %15 to i64
%17 = urem i64 %16, 9
%18 = getelementptr inbounds [9 x i8], [9 x i8]* @__const.main.array, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i32 %14, 1
%23 = load i8*, i8** %9
%24 = tail call i32 @atoi(i8* %23)
%25 = icmp slt i32 %22, %24
br i1 %25, label %13, label %26
26: ; preds = %13, %6
%27 = tail call i32 @putchar(i32 10)
br label %28
28: ; preds = %26, %4
ret i32 0
}