#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int width_image, height_image;
  int width_precinct_size, height_precinct_size;
  int total_number_of_wois;
  int i, j;
  if (argc < 5) {
    printf("\nUsage: %s <width_image> <height_image> <width_precinct_size> "
           "<height_precinct_size>\n",
           argv[0]);
    exit(1);
  }
  width_image = atoi(argv[1]);
  height_image = atoi(argv[2]);
  width_precinct_size = atoi(argv[3]);
  height_precinct_size = atoi(argv[4]);
  if (0) {
    printf("width_image: %d\n", width_image);
    printf("height_image: %d\n", height_image);
    printf("width_precinct_size: %d\n", width_precinct_size);
    printf("height_precinct_size: %d\n", height_precinct_size);
  }
  total_number_of_wois = (height_image / height_precinct_size) *
                         (width_image / width_precinct_size);
  if (0)
    printf("Total number of WOIS: %d\n", total_number_of_wois);
  for (i = 0; i < height_image; i = i + height_precinct_size) {
    for (j = 0; j < width_image; j = j + width_precinct_size) {
      if (0)
        printf("j: %4d \t i: %4d\n", j, i);
      else
        printf("%4d %4d\n", j, i);
    }
    if (0)
      printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    116f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x20(%rbp)
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1226 <main+0xf6>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1213 <main+0xe3>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11e5 <main+0xb5>
jmp    1218 <main+0xe8>
mov    -0x28(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11d2 <main+0xa2>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
jle    11da <main+0xaa>
mov    0x8(%rbx),%rdi
call   1040 <atoi@plt>
mov    %eax,%r13d
mov    0x10(%rbx),%rdi
call   1040 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rdi
call   1040 <atoi@plt>
mov    %eax,0x4(%rsp)
test   %r14d,%r14d
jle    11c9 <main+0x99>
mov    %r14d,%r15d
lea    0xed0(%rip),%r12
xor    %ebx,%ebx
jmp    1199 <main+0x69>
nopw   0x0(%rax,%rax,1)
add    0x4(%rsp),%ebx
cmp    %r15d,%ebx
jge    11c9 <main+0x99>
test   %r13d,%r13d
jle    1190 <main+0x60>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebp,%r14d
cmp    %r13d,%r14d
jl     11b0 <main+0x80>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xe1c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [86 x i8] c"\0AUsage: %s <width_image> <height_image> <width_precinct_size> <height_precinct_size>\0A\00"
@.str.1 = [9 x i8] c"%4d %4d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
store i32 %25, i32* %6
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %7
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %8
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 4
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %9
%38 = load i32, i32* %7
%39 = load i32, i32* %9
%40 = sdiv i32 %38, %39
%41 = load i32, i32* %6
%42 = load i32, i32* %8
%43 = sdiv i32 %41, %42
%44 = mul nsw i32 %40, %43
store i32 %44, i32* %10
store i32 0, i32* %11
br label %45
45: ; preds = %63, %21
%46 = load i32, i32* %11
%47 = load i32, i32* %7
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %67
49: ; preds = %45
store i32 0, i32* %12
br label %50
50: ; preds = %58, %49
%51 = load i32, i32* %12
%52 = load i32, i32* %6
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %62
54: ; preds = %50
%55 = load i32, i32* %12
%56 = load i32, i32* %11
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %55, i32 %56)
br label %58
58: ; preds = %54
%59 = load i32, i32* %12
%60 = load i32, i32* %8
%61 = add nsw i32 %59, %60
store i32 %61, i32* %12
br label %50
62: ; preds = %50
br label %63
63: ; preds = %62
%64 = load i32, i32* %11
%65 = load i32, i32* %9
%66 = add nsw i32 %64, %65
store i32 %66, i32* %11
br label %45
67: ; preds = %45
ret i32 0
}

LLVM IR (-O2):
@.str = [86 x i8] c"\0AUsage: %s <width_image> <height_image> <width_precinct_size> <height_precinct_size>\0A\00"
@.str.1 = [9 x i8] c"%4d %4d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 4
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = icmp sgt i32 %14, 0
br i1 %21, label %22, label %34
22: ; preds = %8
%23 = icmp sgt i32 %11, 0
br label %24
24: ; preds = %22, %31
%25 = phi i32 [ 0, %22 ], [ %32, %31 ]
br i1 %23, label %26, label %31
26: ; preds = %24, %26
%27 = phi i32 [ %29, %26 ], [ 0, %24 ]
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %25)
%29 = add nsw i32 %27, %17
%30 = icmp slt i32 %29, %11
br i1 %30, label %26, label %31
31: ; preds = %26, %24
%32 = add nsw i32 %25, %20
%33 = icmp slt i32 %32, %14
br i1 %33, label %24, label %34
34: ; preds = %31, %8
ret i32 0
}