#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 *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  srand((unsigned)time(NULL));
  int a, j, k, f;
  int b[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  char c[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
              'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
              'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '\0'};
  printf("==========================\n== Generador de codigos "
         "==\n==========================\n\n*- Ingrese 1 si quiere generar un "
         "codigo\n");
  scanf("%i", &a);
  printf("\n====================================================\n\n");
  k = 0;
  f = 0;
  char letra[5];
  int numero[5];
  if (a != 1) {
    printf("Necesitas ingresar el numero 1 para generar un codigo\n");
  }
  if (a == 1) {
    for (j = 0; j < 5; j++) {
      k = 1 + rand() % 23;
      letra[j] = c[k];
    }
    f = 0;
    for (j = 0; j < 5; j++) {
      f = 1 + rand() % 9;
      numero[j] = b[f];
    }
    printf("Su codigo es:\n\n");
    printf("%c%d%c%d%c%d%c%d%c%d "
           "\n\n====================================================\n\n",
           letra[0], numero[0], letra[1], numero[1], letra[2], numero[2],
           letra[3], numero[3], letra[4], numero[4]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xb0,%rsp
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    -0x50(%rbp),%rdi
lea    0xe70(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    0xe8f(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe8c(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe89(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe86(%rip),%ax
mov    %ax,-0x58(%rbp)
mov    0xe7e(%rip),%al
mov    %al,-0x56(%rbp)
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xf33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1,-0x18(%rbp)
je     1221 <main+0xc1>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x18(%rbp)
jne    1323 <main+0x1c3>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    126f <main+0x10f>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x17,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
movslq -0x20(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%cl
movslq -0x1c(%rbp),%rax
mov    %cl,-0x75(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1232 <main+0xd2>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    12bd <main+0x15d>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x9,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%ecx
movslq -0x1c(%rbp),%rax
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    127d <main+0x11d>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x75(%rbp),%esi
mov    -0x90(%rbp),%edx
movsbl -0x74(%rbp),%ecx
mov    -0x8c(%rbp),%r8d
movsbl -0x73(%rbp),%r9d
mov    -0x88(%rbp),%r14d
movsbl -0x72(%rbp),%ebx
mov    -0x84(%rbp),%r11d
movsbl -0x71(%rbp),%r10d
mov    -0x80(%rbp),%eax
lea    0xe0b(%rip),%rdi
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x8(%rsp)
je     11c3 <main+0x63>
lea    0xfaa(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x1,0x8(%rsp)
jne    13fa <main+0x29a>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
lea    0xe39(%rip),%rbx
movsbl 0x1(%rax,%rbx,1),%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movsbl 0x1(%rax,%rbx,1),%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movsbl 0x1(%rax,%rbx,1),%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movsbl 0x1(%rax,%rbx,1),%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0xffffffffb21642c9,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
movsbl 0x1(%rax,%rbx,1),%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
lea    0xcf9(%rip),%r15
mov    0x4(%r15,%rax,4),%r14d
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
mov    0x4(%r15,%rax,4),%ebx
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
mov    0x4(%r15,%rax,4),%r12d
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
mov    0x4(%r15,%rax,4),%r13d
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    %ecx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
mov    0x4(%r15,%rax,4),%ebp
lea    0xd8f(%rip),%rdi
call   1030 <puts@plt>
sub    $0x8,%rsp
lea    0xc7f(%rip),%rdi
mov    0x1c(%rsp),%esi
mov    %r14d,%edx
mov    0x18(%rsp),%ecx
mov    %ebx,%r8d
mov    0x14(%rsp),%r9d
xor    %eax,%eax
push   %rbp
push   0x28(%rsp)
push   %r13
push   0x40(%rsp)
push   %r12
call   1040 <printf@plt>
add    $0x30,%rsp
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.b = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@__const.main.c = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str = [124 x i8] c"==========================\0A== Generador de codigos ==\0A==========================\0A\0A*- Ingrese 1 si quiere generar un codigo\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [56 x i8] c"\0A====================================================\0A\0A\00"
@.str.3 = [55 x i8] c"Necesitas ingresar el numero 1 para generar un codigo\0A\00"
@.str.4 = [16 x i8] c"Su codigo es:\0A\0A\00"
@.str.5 = [78 x i8] c"%c%d%c%d%c%d%c%d%c%d \0A\0A====================================================\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [10 x i32]
%7 = alloca [27 x i8]
%8 = alloca [5 x i8]
%9 = alloca [5 x i32]
store i32 0, i32* %1
%10 = call i64 @time(i32* null)
%11 = trunc i64 %10 to i32
%12 = call i32 @srand(i32 %11)
%13 = bitcast [10 x i32]* %6 to i8*
%14 = bitcast [27 x i8]* %7 to i8*
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
store i32 0, i32* %5
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %0
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %89
25: ; preds = %22
store i32 0, i32* %3
br label %26
26: ; preds = %40, %25
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 5
br i1 %28, label %29, label %43
29: ; preds = %26
%30 = call i32 (...) @rand()
%31 = srem i32 %30, 23
%32 = add nsw i32 1, %31
store i32 %32, i32* %4
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [27 x i8], [27 x i8]* %7, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 %38
store i8 %36, i8* %39
br label %40
40: ; preds = %29
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %26
43: ; preds = %26
store i32 0, i32* %5
store i32 0, i32* %3
br label %44
44: ; preds = %58, %43
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 5
br i1 %46, label %47, label %61
47: ; preds = %44
%48 = call i32 (...) @rand()
%49 = srem i32 %48, 9
%50 = add nsw i32 1, %49
store i32 %50, i32* %5
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 %56
store i32 %54, i32* %57
br label %58
58: ; preds = %47
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %44
61: ; preds = %44
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%63 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
%67 = load i32, i32* %66
%68 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 1
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 1
%72 = load i32, i32* %71
%73 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 2
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 2
%77 = load i32, i32* %76
%78 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 3
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 3
%82 = load i32, i32* %81
%83 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 4
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 4
%87 = load i32, i32* %86
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.5, i64 0, i64 0), i32 %65, i32 %67, i32 %70, i32 %72, i32 %75, i32 %77, i32 %80, i32 %82, i32 %85, i32 %87)
br label %89
89: ; preds = %61, %22
ret i32 0
}

LLVM IR (-O2):
@__const.main.b = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@__const.main.c = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.5 = [78 x i8] c"%c%d%c%d%c%d%c%d%c%d \0A\0A====================================================\0A\0A\00"
@str = [123 x i8] c"==========================\0A== Generador de codigos ==\0A==========================\0A\0A*- Ingrese 1 si quiere generar un codigo\00"
@str.6 = [55 x i8] c"\0A====================================================\0A\00"
@str.7 = [15 x i8] c"Su codigo es:\0A\00"
@str.8 = [54 x i8] c"Necesitas ingresar el numero 1 para generar un codigo\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srand(i32 %3)
%5 = bitcast i32* %1 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([123 x i8], [123 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.6, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 1
br i1 %10, label %15, label %11
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.8, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %83
15: ; preds = %11, %0
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 23
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.c, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 23
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.c, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 (...) @rand()
%29 = srem i32 %28, 23
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.c, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = call i32 (...) @rand()
%35 = srem i32 %34, 23
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.c, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = call i32 (...) @rand()
%41 = srem i32 %40, 23
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [27 x i8], [27 x i8]* @__const.main.c, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = call i32 (...) @rand()
%47 = srem i32 %46, 9
%48 = add nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.b, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (...) @rand()
%53 = srem i32 %52, 9
%54 = add nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.b, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = call i32 (...) @rand()
%59 = srem i32 %58, 9
%60 = add nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.b, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (...) @rand()
%65 = srem i32 %64, 9
%66 = add nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.b, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = call i32 (...) @rand()
%71 = srem i32 %70, 9
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.b, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
%77 = sext i8 %21 to i32
%78 = sext i8 %27 to i32
%79 = sext i8 %33 to i32
%80 = sext i8 %39 to i32
%81 = sext i8 %45 to i32
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.5, i64 0, i64 0), i32 %77, i32 %51, i32 %78, i32 %57, i32 %79, i32 %63, i32 %80, i32 %69, i32 %81, i32 %75)
br label %83
83: ; preds = %15, %11
ret i32 0
}