#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*/ S(int, int);
void matrix_add(double **x, double **a, double **b, int m, int n) {
  int i, j;
  for (i = 0; i <= m - 1; i++)
    for (j = 0; j <= n - 1; j++)
      S(i, j);
}


x86 assembly (clang, -O0):
<matrix_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1187 <matrix_add+0x77>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1174 <matrix_add+0x64>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1030 <S@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    114a <matrix_add+0x3a>
jmp    1179 <matrix_add+0x69>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <matrix_add+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_add>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %ecx,%ecx
jle    1153 <matrix_add+0x43>
mov    %r8d,%r15d
mov    %ecx,%r14d
xor    %ebp,%ebp
jmp    1138 <matrix_add+0x28>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    %r14d,%ebp
je     1153 <matrix_add+0x43>
test   %r15d,%r15d
jle    1130 <matrix_add+0x20>
xor    %ebx,%ebx
nop
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <S@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    1140 <matrix_add+0x30>
jmp    1130 <matrix_add+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @matrix_add(double** %0, double** %1, double** %2, i32 %3, i32 %4) {
%6 = alloca double**
%7 = alloca double**
%8 = alloca double**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store double** %0, double*** %6
store double** %1, double*** %7
store double** %2, double*** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 0, i32* %11
br label %13
13: ; preds = %32, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %9
%16 = sub nsw i32 %15, 1
%17 = icmp sle i32 %14, %16
br i1 %17, label %18, label %35
18: ; preds = %13
store i32 0, i32* %12
br label %19
19: ; preds = %28, %18
%20 = load i32, i32* %12
%21 = load i32, i32* %10
%22 = sub nsw i32 %21, 1
%23 = icmp sle i32 %20, %22
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = load i32, i32* %11
%26 = load i32, i32* %12
%27 = call i32 @S(i32 %25, i32 %26)
br label %28
28: ; preds = %24
%29 = load i32, i32* %12
%30 = add nsw i32 %29, 1
store i32 %30, i32* %12
br label %19
31: ; preds = %19
br label %32
32: ; preds = %31
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %13
35: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @matrix_add(double** nocapture readnone %0, double** nocapture readnone %1, double** nocapture readnone %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %19
7: ; preds = %5
%8 = icmp sgt i32 %4, 0
br label %9
9: ; preds = %7, %16
%10 = phi i32 [ 0, %7 ], [ %17, %16 ]
br i1 %8, label %11, label %16
11: ; preds = %9, %11
%12 = phi i32 [ %14, %11 ], [ 0, %9 ]
%13 = tail call i32 @S(i32 %10, i32 %12)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %4
br i1 %15, label %16, label %11
16: ; preds = %11, %9
%17 = add nuw nsw i32 %10, 1
%18 = icmp eq i32 %17, %3
br i1 %18, label %19, label %9
19: ; preds = %16, %5
ret void
}