#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, char **argv) {
  char cadena[51];
  int matriu[10][10];
  int i, j, car;
  printf("\nPor favor, introduzca un texto (Máximo 50 caracteres): ");
  scanf("%c", cadena);
  while (i < 51 - 1 && (car = getchar()) != '\n') {
    cadena[i] = car;
    i++;
  }
  cadena[i] = 0;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++)
      if (cadena[i] != 0)
        printf(" %5d ", matriu[i][j] = cadena[i]);
    printf("\n");
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xed8(%rip),%rdi
call   1050 <scanf@plt>
xor    %eax,%eax
cmpl   $0x32,-0x1e4(%rbp)
mov    %al,-0x1ed(%rbp)
jge    1195 <main+0x65>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x1ec(%rbp)
cmp    $0xa,%eax
setne  %al
mov    %al,-0x1ed(%rbp)
mov    -0x1ed(%rbp),%al
test   $0x1,%al
jne    11a8 <main+0x78>
jmp    11cf <main+0x9f>
mov    -0x1ec(%rbp),%eax
mov    %al,%cl
movslq -0x1e4(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    1167 <main+0x37>
movslq -0x1e4(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
movl   $0x0,-0x1e4(%rbp)
cmpl   $0xa,-0x1e4(%rbp)
jge    1292 <main+0x162>
movl   $0x0,-0x1e8(%rbp)
cmpl   $0xa,-0x1e8(%rbp)
jge    1270 <main+0x140>
movslq -0x1e4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1257 <main+0x127>
movslq -0x1e4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%esi
movslq -0x1e4(%rbp),%rcx
lea    -0x1e0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1e8(%rbp),%rcx
mov    %esi,(%rax,%rcx,4)
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    125c <main+0x12c>
mov    -0x1e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e8(%rbp)
jmp    11fc <main+0xcc>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    11e5 <main+0xb5>
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeee(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movb   $0x0,(%rsp)
lea    0xede(%rip),%r14
xor    %eax,%eax
xor    %ebx,%ebx
test   %al,%al
je     1230 <main+0x100>
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl (%rsp,%rbx,1),%esi
test   %esi,%esi
je     1230 <main+0x100>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x9,%rbx
je     1253 <main+0x123>
movzbl 0x1(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <main+0x40>
jmp    1230 <main+0x100>
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [58 x i8] c"\0APor favor, introduzca un texto (M\C3\A1ximo 50 caracteres): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [6 x i8] c" %5d \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 [51 x i8]
%7 = alloca [10 x [10 x i32]]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %22, %2
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 50
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = call i32 (...) @getchar()
store i32 %18, i32* %10
%19 = icmp ne i32 %18, 10
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br i1 %21, label %22, label %30
22: ; preds = %20
%23 = load i32, i32* %10
%24 = trunc i32 %23 to i8
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 %26
store i8 %24, i8* %27
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %14
30: ; preds = %20
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 %32
store i8 0, i8* %33
store i32 0, i32* %8
br label %34
34: ; preds = %67, %30
%35 = load i32, i32* %8
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %70
37: ; preds = %34
store i32 0, i32* %9
br label %38
38: ; preds = %62, %37
%39 = load i32, i32* %9
%40 = icmp slt i32 %39, 10
br i1 %40, label %41, label %65
41: ; preds = %38
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %61
48: ; preds = %41
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [51 x i8], [51 x i8]* %6, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %7, i64 0, i64 %55
%57 = load i32, i32* %9
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %56, i64 0, i64 %58
store i32 %53, i32* %59
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %53)
br label %61
61: ; preds = %48, %41
br label %62
62: ; preds = %61
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %38
65: ; preds = %38
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %67
67: ; preds = %65
%68 = load i32, i32* %8
%69 = add nsw i32 %68, 1
store i32 %69, i32* %8
br label %34
70: ; preds = %34
%71 = load i32, i32* @EXIT_SUCCESS
ret i32 %71
}

LLVM IR (-O2):
@.str = [58 x i8] c"\0APor favor, introduzca un texto (M\C3\A1ximo 50 caracteres): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [6 x i8] c" %5d \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [51 x i8]
%4 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
store i8 0, i8* %4
br label %7
7: ; preds = %64, %2
%8 = phi i8 [ 0, %2 ], [ %66, %64 ]
%9 = phi i64 [ 0, %2 ], [ %62, %64 ]
%10 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 %9
%11 = icmp eq i8 %8, 0
br i1 %11, label %60, label %12
12: ; preds = %7
%13 = sext i8 %8 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = load i8, i8* %10
%16 = icmp eq i8 %15, 0
br i1 %16, label %60, label %17
17: ; preds = %12
%18 = sext i8 %15 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i8, i8* %10
%21 = icmp eq i8 %20, 0
br i1 %21, label %60, label %22
22: ; preds = %17
%23 = sext i8 %20 to i32
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i8, i8* %10
%26 = icmp eq i8 %25, 0
br i1 %26, label %60, label %27
27: ; preds = %22
%28 = sext i8 %25 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = load i8, i8* %10
%31 = icmp eq i8 %30, 0
br i1 %31, label %60, label %32
32: ; preds = %27
%33 = sext i8 %30 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = load i8, i8* %10
%36 = icmp eq i8 %35, 0
br i1 %36, label %60, label %37
37: ; preds = %32
%38 = sext i8 %35 to i32
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = load i8, i8* %10
%41 = icmp eq i8 %40, 0
br i1 %41, label %60, label %42
42: ; preds = %37
%43 = sext i8 %40 to i32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i8, i8* %10
%46 = icmp eq i8 %45, 0
br i1 %46, label %60, label %47
47: ; preds = %42
%48 = sext i8 %45 to i32
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = load i8, i8* %10
%51 = icmp eq i8 %50, 0
br i1 %51, label %60, label %52
52: ; preds = %47
%53 = sext i8 %50 to i32
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = load i8, i8* %10
%56 = icmp eq i8 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %52
%58 = sext i8 %55 to i32
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %7, %12, %17, %22, %27, %32, %37, %42, %47, %57, %52
%61 = call i32 @putchar(i32 10)
%62 = add nuw nsw i64 %9, 1
%63 = icmp eq i64 %62, 10
br i1 %63, label %67, label %64
64: ; preds = %60
%65 = getelementptr inbounds [51 x i8], [51 x i8]* %3, i64 0, i64 %62
%66 = load i8, i8* %65
br label %7
67: ; preds = %60
%68 = load i32, i32* @EXIT_SUCCESS
ret i32 %68
}