#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 *, ...);
void add(int a[20][20], int b[20][20], int r, int s, int x, int y) {
  int c[20][20];
  int i, j;
  if (r == x && s == y) {
    printf("\nAnswer:\n");
    for (i = 0; i < r; i++) {
      for (j = 0; j < s; j++) {
        c[i][j] = a[i][j] + b[i][j];
        printf("%d ", c[i][j]);
      }
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x670,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1248 <add+0x138>
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1248 <add+0x138>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x664(%rbp)
mov    -0x664(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1243 <add+0x133>
movl   $0x0,-0x668(%rbp)
mov    -0x668(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1221 <add+0x111>
mov    -0x8(%rbp),%rax
movslq -0x664(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x668(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x664(%rbp),%rcx
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x668(%rbp),%rcx
add    (%rax,%rcx,4),%edx
movslq -0x664(%rbp),%rcx
lea    -0x660(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x668(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0x664(%rbp),%rcx
lea    -0x660(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x668(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x668(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x668(%rbp)
jmp    117a <add+0x6a>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x664(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x664(%rbp)
jmp    1161 <add+0x51>
jmp    1248 <add+0x138>
add    $0x670,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,0xc(%rsp)
cmp    %r8d,%edx
jne    11de <add+0xae>
cmp    %r9d,0xc(%rsp)
jne    11de <add+0xae>
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xe9e(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11de <add+0xae>
mov    %r15d,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r13d
lea    0xe7c(%rip),%r15
xor    %r14d,%r14d
jmp    11ad <add+0x7d>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
add    $0x50,%rbx
add    $0x50,%rbp
cmp    0x10(%rsp),%r14
je     11de <add+0xae>
cmpl   $0x0,0xc(%rsp)
jle    1190 <add+0x60>
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%r12,4),%esi
add    0x0(%rbp,%r12,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r13
jne    11c0 <add+0x90>
jmp    1190 <add+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0AAnswer:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @add([20 x i32]* %0, [20 x i32]* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [20 x i32]*
%8 = alloca [20 x i32]*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [20 x [20 x i32]]
%14 = alloca i32
%15 = alloca i32
store [20 x i32]* %0, [20 x i32]** %7
store [20 x i32]* %1, [20 x i32]** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i32, i32* %9
%17 = load i32, i32* %11
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %75
19: ; preds = %6
%20 = load i32, i32* %10
%21 = load i32, i32* %12
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %75
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %14
br label %25
25: ; preds = %71, %23
%26 = load i32, i32* %14
%27 = load i32, i32* %9
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %74
29: ; preds = %25
store i32 0, i32* %15
br label %30
30: ; preds = %66, %29
%31 = load i32, i32* %15
%32 = load i32, i32* %10
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %69
34: ; preds = %30
%35 = load [20 x i32]*, [20 x i32]** %7
%36 = load i32, i32* %14
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %35, i64 %37
%39 = load i32, i32* %15
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [20 x i32], [20 x i32]* %38, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load [20 x i32]*, [20 x i32]** %8
%44 = load i32, i32* %14
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [20 x i32], [20 x i32]* %43, i64 %45
%47 = load i32, i32* %15
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %46, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = add nsw i32 %42, %50
%52 = load i32, i32* %14
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %13, i64 0, i64 %53
%55 = load i32, i32* %15
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [20 x i32], [20 x i32]* %54, i64 0, i64 %56
store i32 %51, i32* %57
%58 = load i32, i32* %14
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %13, i64 0, i64 %59
%61 = load i32, i32* %15
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [20 x i32], [20 x i32]* %60, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %34
%67 = load i32, i32* %15
%68 = add nsw i32 %67, 1
store i32 %68, i32* %15
br label %30
69: ; preds = %30
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %71
71: ; preds = %69
%72 = load i32, i32* %14
%73 = add nsw i32 %72, 1
store i32 %73, i32* %14
br label %25
74: ; preds = %25
br label %75
75: ; preds = %74, %19, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@str = [9 x i8] c"\0AAnswer:\00"
define void @add([20 x i32]* nocapture %0, [20 x i32]* nocapture %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %2, %4
%8 = icmp eq i32 %3, %5
%9 = and i1 %7, %8
br i1 %9, label %10, label %33
10: ; preds = %6
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%12 = icmp sgt i32 %2, 0
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = icmp sgt i32 %3, 0
%15 = zext i32 %2 to i64
%16 = zext i32 %3 to i64
br label %17
17: ; preds = %13, %29
%18 = phi i64 [ 0, %13 ], [ %31, %29 ]
br i1 %14, label %19, label %29
19: ; preds = %17, %19
%20 = phi i64 [ %27, %19 ], [ 0, %17 ]
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %0, i64 %18, i64 %20
%22 = load i32, i32* %21
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 %18, i64 %20
%24 = load i32, i32* %23
%25 = add nsw i32 %24, %22
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i64 %20, 1
%28 = icmp eq i64 %27, %16
br i1 %28, label %29, label %19
29: ; preds = %19, %17
%30 = tail call i32 @putchar(i32 10)
%31 = add nuw nsw i64 %18, 1
%32 = icmp eq i64 %31, %15
br i1 %32, label %33, label %17
33: ; preds = %29, %10, %6
ret void
}