#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int p, i, j, m, n, an, k;
  scanf("%d %d", &m, &n);
  p = 1;
  for (j = 1; j <= m; j++) {
    if ((j % 2) != 0) {
      for (i = 1; i <= n; i++) {
        printf("%02d ", p);
        p = p + 2;
      }
      printf("\n");
    } else {
      p = p + (2 * n);
      an = p - 2;
      for (k = 1; k <= n; k++) {
        printf("%02d ", an);
        an = an - 2;
      }
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1232 <main+0x112>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11bf <main+0x9f>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11ac <main+0x8c>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x58>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121f <main+0xff>
mov    -0x8(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1211 <main+0xf1>
mov    -0x1c(%rbp),%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dd <main+0xbd>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1224 <main+0x104>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1151 <main+0x31>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    120d <main+0xdd>
mov    $0x1,%r15d
lea    0xe9c(%rip),%r14
mov    $0x1,%ebx
jmp    119b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12d,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jge    120d <main+0xdd>
mov    0x8(%rsp),%eax
test   $0x1,%r15b
jne    11e0 <main+0xb0>
lea    (%rbx,%rax,2),%r12d
test   %eax,%eax
jle    1180 <main+0x50>
add    %eax,%eax
add    %eax,%ebx
add    $0xfffffffe,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xfffffffe,%ebx
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     11c0 <main+0x90>
jmp    1180 <main+0x50>
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
jle    1183 <main+0x53>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x2,%ebx
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     11f0 <main+0xc0>
jmp    1183 <main+0x53>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [6 x i8] c"%02d \00"
@.str.2 = [2 x i8] c"\0A\00"
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 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
store i32 1, i32* %2
store i32 1, i32* %4
br label %10
10: ; preds = %55, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %58
14: ; preds = %10
%15 = load i32, i32* %4
%16 = srem i32 %15, 2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %33
18: ; preds = %14
store i32 1, i32* %3
br label %19
19: ; preds = %28, %18
%20 = load i32, i32* %3
%21 = load i32, i32* %6
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 2
store i32 %27, i32* %2
br label %28
28: ; preds = %23
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %19
31: ; preds = %19
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %54
33: ; preds = %14
%34 = load i32, i32* %2
%35 = load i32, i32* %6
%36 = mul nsw i32 2, %35
%37 = add nsw i32 %34, %36
store i32 %37, i32* %2
%38 = load i32, i32* %2
%39 = sub nsw i32 %38, 2
store i32 %39, i32* %7
store i32 1, i32* %8
br label %40
40: ; preds = %49, %33
%41 = load i32, i32* %8
%42 = load i32, i32* %6
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %52
44: ; preds = %40
%45 = load i32, i32* %7
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %7
%48 = sub nsw i32 %47, 2
store i32 %48, i32* %7
br label %49
49: ; preds = %44
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %40
52: ; preds = %40
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %52, %31
br label %55
55: ; preds = %54
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %10
58: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [6 x i8] c"%02d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %42, label %8
8: ; preds = %0, %36
%9 = phi i32 [ %39, %36 ], [ 1, %0 ]
%10 = phi i32 [ %37, %36 ], [ 1, %0 ]
%11 = and i32 %9, 1
%12 = icmp eq i32 %11, 0
%13 = load i32, i32* %2
br i1 %12, label %24, label %14
14: ; preds = %8
%15 = icmp slt i32 %13, 1
br i1 %15, label %36, label %16
16: ; preds = %14, %16
%17 = phi i32 [ %21, %16 ], [ 1, %14 ]
%18 = phi i32 [ %20, %16 ], [ %10, %14 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = add nsw i32 %18, 2
%21 = add nuw nsw i32 %17, 1
%22 = load i32, i32* %2
%23 = icmp slt i32 %17, %22
br i1 %23, label %16, label %36
24: ; preds = %8
%25 = shl nsw i32 %13, 1
%26 = add nsw i32 %25, %10
%27 = icmp slt i32 %13, 1
br i1 %27, label %36, label %28
28: ; preds = %24, %28
%29 = phi i32 [ %31, %28 ], [ %26, %24 ]
%30 = phi i32 [ %33, %28 ], [ 1, %24 ]
%31 = add nsw i32 %29, -2
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = add nuw nsw i32 %30, 1
%34 = load i32, i32* %2
%35 = icmp slt i32 %30, %34
br i1 %35, label %28, label %36
36: ; preds = %16, %28, %24, %14
%37 = phi i32 [ %10, %14 ], [ %26, %24 ], [ %26, %28 ], [ %20, %16 ]
%38 = call i32 @putchar(i32 10)
%39 = add nuw nsw i32 %9, 1
%40 = load i32, i32* %1
%41 = icmp slt i32 %9, %40
br i1 %41, label %8, label %42
42: ; preds = %36, %0
ret i32 0
}