#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 EXIT_SUCCESS;
int count_black(unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, unsigned int *, unsigned int *);
int main() {
  unsigned w = 0;
  unsigned h = 0;
  while (2 == scanf("%u %u", &w, &h) && w && h)
    printf("%u\n", count_black(w, h));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x2,%ecx
cmp    %edx,%ecx
mov    %al,-0xd(%rbp)
jne    118e <main+0x5e>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     118e <main+0x5e>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    119e <main+0x6e>
jmp    11bc <main+0x8c>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <count_black@plt>
mov    %eax,%esi
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
jmp    114d <main+0x1d>
mov    0x2e1d(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xeb2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11c1 <main+0x91>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     11c1 <main+0x91>
mov    (%rsp),%esi
test   %esi,%esi
je     11c1 <main+0x91>
lea    0xe90(%rip),%r14
lea    0xe83(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <count_black@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    11c1 <main+0x91>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     11c1 <main+0x91>
mov    (%rsp),%esi
test   %esi,%esi
jne    1190 <main+0x60>
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%u %u\00"
@.str.1 = [4 x i8] c"%u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %15, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%6 = icmp eq i32 2, %5
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %10, %7, %4
%14 = phi i1 [ false, %7 ], [ false, %4 ], [ %12, %10 ]
br i1 %14, label %15, label %20
15: ; preds = %13
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32 @count_black(i32 %16, i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %4
20: ; preds = %13
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}

LLVM IR (-O2):
@.str = [6 x i8] c"%u %u\00"
@.str.1 = [4 x i8] c"%u\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %26
13: ; preds = %0, %13
%14 = phi i32 [ %23, %13 ], [ %10, %0 ]
%15 = phi i32 [ %20, %13 ], [ %7, %0 ]
%16 = call i32 @count_black(i32 %15, i32 %14)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%19 = icmp eq i32 %18, 2
%20 = load i32, i32* %1
%21 = icmp ne i32 %20, 0
%22 = select i1 %19, i1 %21, i1 false
%23 = load i32, i32* %2
%24 = icmp ne i32 %23, 0
%25 = select i1 %22, i1 %24, i1 false
br i1 %25, label %13, label %26
26: ; preds = %13, %0
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}