#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*/ isspace(char);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int strlen(char *);
void toIntMatrix(char *numString, int matrix[20][20]) {
  int i, j;
  char c;
  for (i = 0; i < 20; i++) {
    for (j = 0; j < 20; j++) {
      char charInt[4] = "\0";
      int res;
      c = numString[0];
      while (!isspace(c)) {
        int len = strlen(charInt);
        c = *numString++;
        charInt[len++] = c;
        charInt[len] = '\0';
      }
      sscanf(charInt, "%d", &res);
      matrix[i][j] = res;
    }
  }
}


x86 assembly (clang, -O0):
<toIntMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jge    1239 <toIntMatrix+0xf9>
movl   $0x0,-0x18(%rbp)
cmpl   $0x14,-0x18(%rbp)
jge    1226 <toIntMatrix+0xe6>
lea    -0x1d(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a9 <toIntMatrix+0x69>
jmp    11eb <toIntMatrix+0xab>
lea    -0x1d(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%cl
mov    -0x28(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
cltq
mov    %cl,-0x1d(%rbp,%rax,1)
movslq -0x28(%rbp),%rax
movb   $0x0,-0x1d(%rbp,%rax,1)
jmp    118b <toIntMatrix+0x4b>
lea    -0x1d(%rbp),%rdi
lea    0xe0a(%rip),%rsi
lea    -0x24(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x24(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1168 <toIntMatrix+0x28>
jmp    122b <toIntMatrix+0xeb>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <toIntMatrix+0x17>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toIntMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
mov    %rsp,%r15
lea    0x4(%rsp),%r13
jmp    115a <toIntMatrix+0x2a>
nopl   (%rax)
add    $0x1,%rbp
cmp    $0x14,%rbp
je     11c5 <toIntMatrix+0x95>
xor    %r12d,%r12d
jmp    1193 <toIntMatrix+0x63>
nop
lea    0xe99(%rip),%rsi
mov    %r13,%rdx
call   1050 <sscanf@plt>
mov    0x4(%rsp),%eax
lea    0x0(,%rbp,4),%rcx
add    %rbp,%rcx
shl    $0x4,%rcx
add    %r14,%rcx
mov    %eax,(%rcx,%r12,4)
add    $0x1,%r12
cmp    $0x14,%r12
je     1150 <toIntMatrix+0x20>
movl   $0x0,(%rsp)
movsbl (%rbx),%edi
nopl   (%rax)
call   1040 <isspace@plt>
mov    %r15,%rdi
test   %eax,%eax
jne    1160 <toIntMatrix+0x30>
call   1030 <strlen@plt>
movsbl (%rbx),%edi
add    $0x1,%rbx
cltq
mov    %dil,(%rsp,%rax,1)
movb   $0x0,0x1(%rsp,%rax,1)
jmp    11a0 <toIntMatrix+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @toIntMatrix(i8* %0, [20 x i32]* %1) {
%3 = alloca i8*
%4 = alloca [20 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca [4 x i8]
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
store [20 x i32]* %1, [20 x i32]** %4
store i32 0, i32* %5
br label %11
11: ; preds = %57, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 20
br i1 %13, label %14, label %60
14: ; preds = %11
store i32 0, i32* %6
br label %15
15: ; preds = %53, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 20
br i1 %17, label %18, label %56
18: ; preds = %15
%19 = bitcast [4 x i8]* %8 to i8*
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
store i8 %22, i8* %7
br label %23
23: ; preds = %28, %18
%24 = load i8, i8* %7
%25 = call i32 @isspace(i8 signext %24)
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %28, label %42
28: ; preds = %23
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
store i32 %30, i32* %10
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
%33 = load i8, i8* %31
store i8 %33, i8* %7
%34 = load i8, i8* %7
%35 = load i32, i32* %10
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 %37
store i8 %34, i8* %38
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 %40
store i8 0, i8* %41
br label %23
42: ; preds = %23
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%44 = call i32 @sscanf(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%45 = load i32, i32* %9
%46 = load [20 x i32]*, [20 x i32]** %4
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %46, i64 %48
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %49, i64 0, i64 %51
store i32 %45, i32* %52
br label %53
53: ; preds = %42
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %15
56: ; preds = %15
br label %57
57: ; preds = %56
%58 = load i32, i32* %5
%59 = add nsw i32 %58, 1
store i32 %59, i32* %5
br label %11
60: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @toIntMatrix(i8* nocapture %0, [20 x i32]* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to [4 x i8]*
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %5 to i8*
br label %8
8: ; preds = %2, %36
%9 = phi i64 [ 0, %2 ], [ %37, %36 ]
%10 = phi i8* [ %0, %2 ], [ %30, %36 ]
br label %11
11: ; preds = %8, %29
%12 = phi i64 [ 0, %8 ], [ %34, %29 ]
%13 = phi i8* [ %10, %8 ], [ %30, %29 ]
store i32 0, i32* %3
%14 = load i8, i8* %13
%15 = call i32 @isspace(i8 signext %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %11, %17
%18 = phi i8* [ %20, %17 ], [ %13, %11 ]
%19 = call i32 @strlen(i8* %6)
%20 = getelementptr inbounds i8, i8* %18, i64 1
%21 = load i8, i8* %18
%22 = add nsw i32 %19, 1
%23 = sext i32 %19 to i64
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 %23
store i8 %21, i8* %24
%25 = sext i32 %22 to i64
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 %25
store i8 0, i8* %26
%27 = call i32 @isspace(i8 signext %21)
%28 = icmp eq i32 %27, 0
br i1 %28, label %17, label %29
29: ; preds = %17, %11
%30 = phi i8* [ %13, %11 ], [ %20, %17 ]
%31 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%32 = load i32, i32* %5
%33 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 %9, i64 %12
store i32 %32, i32* %33
%34 = add nuw nsw i64 %12, 1
%35 = icmp eq i64 %34, 20
br i1 %35, label %36, label %11
36: ; preds = %29
%37 = add nuw nsw i64 %9, 1
%38 = icmp eq i64 %37, 20
br i1 %38, label %39, label %8
39: ; preds = %36
ret void
}