#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 *alloca(int);
int main() {
  int *a = alloca(sizeof(int));
  int *i = alloca(sizeof(int));
  int *b = alloca(sizeof(int));
  int *j = alloca(sizeof(int));
  int *c = alloca(sizeof(int));
  int *M = alloca(sizeof(int));
  int *N = alloca(sizeof(int));
  *a = *i;
  *b = *j;
  *c = 0;
  while (*i < *M || *j < *N) {
    *i = *i + 1;
    *j = *j + 1;
    *c = *c + 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x30(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x38(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rdx
mov    $0x1,%al
cmp    (%rdx),%ecx
mov    %al,-0x41(%rbp)
jl     11cc <main+0xbc>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x40(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11dc <main+0xcc>
jmp    120e <main+0xfe>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
jmp    11a3 <main+0x93>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r12
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbp
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r13
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    (%r15),%ecx
mov    %ecx,(%r12)
mov    (%r14),%ecx
mov    %ecx,0x0(%rbp)
xor    %ecx,%ecx
jmp    119f <main+0x8f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
mov    %ecx,(%r15)
addl   $0x1,(%r14)
mov    (%rbx),%ecx
add    $0x1,%ecx
mov    %ecx,(%rbx)
mov    (%r15),%ecx
cmp    0x0(%r13),%ecx
jl     1190 <main+0x80>
mov    (%r14),%edx
cmp    (%rax),%edx
jl     1190 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %1
%9 = call i32* @alloca(i32 4)
store i32* %9, i32** %2
%10 = call i32* @alloca(i32 4)
store i32* %10, i32** %3
%11 = call i32* @alloca(i32 4)
store i32* %11, i32** %4
%12 = call i32* @alloca(i32 4)
store i32* %12, i32** %5
%13 = call i32* @alloca(i32 4)
store i32* %13, i32** %6
%14 = call i32* @alloca(i32 4)
store i32* %14, i32** %7
%15 = call i32* @alloca(i32 4)
store i32* %15, i32** %8
%16 = load i32*, i32** %3
%17 = load i32, i32* %16
%18 = load i32*, i32** %2
store i32 %17, i32* %18
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = load i32*, i32** %4
store i32 %20, i32* %21
%22 = load i32*, i32** %6
store i32 0, i32* %22
br label %23
23: ; preds = %37, %0
%24 = load i32*, i32** %3
%25 = load i32, i32* %24
%26 = load i32*, i32** %7
%27 = load i32, i32* %26
%28 = icmp slt i32 %25, %27
br i1 %28, label %35, label %29
29: ; preds = %23
%30 = load i32*, i32** %5
%31 = load i32, i32* %30
%32 = load i32*, i32** %8
%33 = load i32, i32* %32
%34 = icmp slt i32 %31, %33
br label %35
35: ; preds = %29, %23
%36 = phi i1 [ true, %23 ], [ %34, %29 ]
br i1 %36, label %37, label %50
37: ; preds = %35
%38 = load i32*, i32** %3
%39 = load i32, i32* %38
%40 = add nsw i32 %39, 1
%41 = load i32*, i32** %3
store i32 %40, i32* %41
%42 = load i32*, i32** %5
%43 = load i32, i32* %42
%44 = add nsw i32 %43, 1
%45 = load i32*, i32** %5
store i32 %44, i32* %45
%46 = load i32*, i32** %6
%47 = load i32, i32* %46
%48 = add nsw i32 %47, 1
%49 = load i32*, i32** %6
store i32 %48, i32* %49
br label %23
50: ; preds = %35
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
%3 = tail call i32* @alloca(i32 4)
%4 = tail call i32* @alloca(i32 4)
%5 = tail call i32* @alloca(i32 4)
%6 = tail call i32* @alloca(i32 4)
%7 = tail call i32* @alloca(i32 4)
%8 = load i32, i32* %2
store i32 %8, i32* %1
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %10
10: ; preds = %19, %0
%11 = phi i32 [ 0, %0 ], [ %24, %19 ]
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = load i32, i32* %4
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %10, %15
%20 = add nsw i32 %12, 1
store i32 %20, i32* %2
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
br label %10
25: ; preds = %15
ret i32 0
}