#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
char rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i, j, num;
  char matriu[100][100];
  do {
    printf("Introduce la dimensión de la matriz entre (1-%d): ", 100);
    scanf("%d", &num);
  } while (num < 1 || num > 100);
  srandom(time(0));
  for (i = 0; i < num; i++) {
    for (j = 0; j < num; j++)
      printf("%3c", matriu[i][j] = 'a' + rand() % (('z' - 'a') + 1));
    printf("\n");
  }
  printf("\n");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2740,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x1c(%rbp)
mov    %al,-0x2731(%rbp)
jl     11ab <main+0x5b>
cmpl   $0x64,-0x1c(%rbp)
setg   %al
mov    %al,-0x2731(%rbp)
mov    -0x2731(%rbp),%al
test   $0x1,%al
jne    1169 <main+0x19>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1258 <main+0x108>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    123c <main+0xec>
mov    $0x0,%al
call   1070 <rand@plt>
movsbl %al,%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%al
movslq -0x14(%rbp),%rdx
lea    -0x2730(%rbp),%rcx
imul   $0x64,%rdx,%rdx
add    %rdx,%rcx
movslq -0x18(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%esi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e1 <main+0x91>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ce <main+0x7e>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%eax
add    $0x2740,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe92(%rip),%r14
lea    0xebf(%rip),%r15
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffff9b,%eax
cmp    $0xffffff9c,%eax
jb     1180 <main+0x20>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srandom@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    122f <main+0xcf>
lea    0xe74(%rip),%rbx
xor    %r14d,%r14d
jmp    11e7 <main+0x87>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0x4(%rsp),%eax
cmp    %eax,%r14d
jge    122f <main+0xcf>
test   %eax,%eax
jle    11d0 <main+0x70>
xor    %ebp,%ebp
nopl   (%rax)
xor    %eax,%eax
call   1080 <rand@plt>
movsbl %al,%eax
imul   $0x4f,%eax,%ecx
movzwl %cx,%edx
shr    $0xb,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %dl,%al
add    $0x61,%al
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11f0 <main+0x90>
jmp    11d0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Introduce la dimensi\C3\B3n de la matriz entre (1-%d): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%3c\00"
@.str.3 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x [100 x i8]]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %19, %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 100)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
br label %13
13: ; preds = %10
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 1
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %8
%18 = icmp sgt i32 %17, 100
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ true, %13 ], [ %18, %16 ]
br i1 %20, label %10, label %21
21: ; preds = %19
%22 = call i32 @time(i32 0)
%23 = call i32 @srandom(i32 %22)
store i32 0, i32* %6
br label %24
24: ; preds = %52, %21
%25 = load i32, i32* %6
%26 = load i32, i32* %8
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %55
28: ; preds = %24
store i32 0, i32* %7
br label %29
29: ; preds = %47, %28
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %50
33: ; preds = %29
%34 = call signext i8 (...) @rand()
%35 = sext i8 %34 to i32
%36 = srem i32 %35, 26
%37 = add nsw i32 97, %36
%38 = trunc i32 %37 to i8
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %9, i64 0, i64 %40
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %41, i64 0, i64 %43
store i8 %38, i8* %44
%45 = sext i8 %38 to i32
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %33
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %29
50: ; preds = %29
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %24
55: ; preds = %24
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = load i32, i32* @EXIT_SUCCESS
ret i32 %57
}

LLVM IR (-O2):
@.str = [52 x i8] c"Introduce la dimensi\C3\B3n de la matriz entre (1-%d): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%3c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
br label %5
5: ; preds = %5, %2
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 100)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = add i32 %8, -101
%10 = icmp ult i32 %9, -100
br i1 %10, label %5, label %11
11: ; preds = %5
%12 = call i32 @time(i32 0)
%13 = call i32 @srandom(i32 %12)
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %35
16: ; preds = %11, %30
%17 = phi i32 [ %33, %30 ], [ %14, %11 ]
%18 = phi i32 [ %32, %30 ], [ 0, %11 ]
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %30
20: ; preds = %16, %20
%21 = phi i32 [ %27, %20 ], [ 0, %16 ]
%22 = call signext i8 (...) @rand()
%23 = srem i8 %22, 26
%24 = add nsw i8 %23, 97
%25 = zext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i32 %21, 1
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %20, label %30
30: ; preds = %20, %16
%31 = call i32 @putchar(i32 10)
%32 = add nuw nsw i32 %18, 1
%33 = load i32, i32* %3
%34 = icmp slt i32 %32, %33
br i1 %34, label %16, label %35
35: ; preds = %30, %11
%36 = call i32 @putchar(i32 10)
%37 = load i32, i32* @EXIT_SUCCESS
ret i32 %37
}