#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);
      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     11ee <main+0xce>
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    11db <main+0xbb>
mov    -0x8(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e0 <main+0xc0>
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   %rbx
push   %rax
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11b9 <main+0x89>
mov    $0x1,%ebx
lea    0xea8(%rip),%r14
mov    $0x1,%r15d
jmp    118b <main+0x5b>
cs nopw 0x0(%rax,%rax,1)
lea    (%rbx,%rax,2),%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
cmp    0x4(%rsp),%r15d
mov    %eax,%r15d
jge    11b9 <main+0x89>
mov    (%rsp),%eax
test   $0x1,%r15b
je     1170 <main+0x40>
test   %eax,%eax
jle    1173 <main+0x43>
xor    %ebp,%ebp
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    (%rsp),%ebp
jl     11a0 <main+0x70>
jmp    1173 <main+0x43>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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 = %40, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %43
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 %39
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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %33, %31
br label %40
40: ; preds = %39
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %10
43: ; 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 %33, label %8
8: ; preds = %0, %27
%9 = phi i32 [ %28, %27 ], [ 1, %0 ]
%10 = phi i32 [ %30, %27 ], [ 1, %0 ]
%11 = and i32 %10, 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 %27, label %16
16: ; preds = %14, %16
%17 = phi i32 [ %20, %16 ], [ %9, %14 ]
%18 = phi i32 [ %21, %16 ], [ 1, %14 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%20 = add nsw i32 %17, 2
%21 = add nuw nsw i32 %18, 1
%22 = load i32, i32* %2
%23 = icmp slt i32 %18, %22
br i1 %23, label %16, label %27
24: ; preds = %8
%25 = shl nsw i32 %13, 1
%26 = add nsw i32 %25, %9
br label %27
27: ; preds = %16, %14, %24
%28 = phi i32 [ %26, %24 ], [ %9, %14 ], [ %20, %16 ]
%29 = call i32 @putchar(i32 10)
%30 = add nuw nsw i32 %10, 1
%31 = load i32, i32* %1
%32 = icmp slt i32 %10, %31
br i1 %32, label %8, label %33
33: ; preds = %27, %0
ret i32 0
}