#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  for (int i = 0; i < 255 * 3 + 1; i++) {
    uint32_t range = (4 << 16) / (1 + i);
    if (range > 0xFFFF)
      range = 0xFFFF;
    if (i % 16 == 15) {
      printf("0x%04x,\n", range);
    } else {
      printf("0x%04x, ", range);
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2fe,-0x8(%rbp)
jge    11a6 <main+0x96>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    $0x40000,%eax
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0xffff,-0xc(%rbp)
jle    1158 <main+0x48>
movl   $0xffff,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0xf,%edx
jne    1182 <main+0x72>
mov    -0xc(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1193 <main+0x83>
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <main+0x88>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xecf(%rip),%r14
lea    0xed1(%rip),%r15
jmp    1162 <main+0x42>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%ecx
neg    %ecx
test   $0xf,%cl
mov    %r15,%rdi
cmove  %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x2ff,%ebx
je     1179 <main+0x59>
mov    $0x40000,%eax
xor    %edx,%edx
div    %ebx
cmp    $0xffff,%eax
jb     1140 <main+0x20>
mov    $0xffff,%eax
jmp    1140 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"0x%04x,\0A\00"
@.str.1 = [9 x i8] c"0x%04x, \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %25, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 766
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 1, %8
%10 = sdiv i32 262144, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 65535
br i1 %12, label %13, label %14
13: ; preds = %7
store i32 65535, i32* %3
br label %14
14: ; preds = %13, %7
%15 = load i32, i32* %2
%16 = srem i32 %15, 16
%17 = icmp eq i32 %16, 15
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %24
21: ; preds = %14
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %21, %18
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %4
28: ; preds = %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"0x%04x,\0A\00"
@.str.1 = [9 x i8] c"0x%04x, \00"
define i32 @main() {
br label %3
1: ; preds = %3
%2 = tail call i32 @putchar(i32 10)
ret i32 0
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %5, %3 ]
%5 = add nuw nsw i32 %4, 1
%6 = udiv i32 262144, %5
%7 = icmp ult i32 %6, 65535
%8 = select i1 %7, i32 %6, i32 65535
%9 = and i32 %4, 15
%10 = icmp eq i32 %9, 15
%11 = select i1 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %11, i32 %8)
%13 = icmp eq i32 %5, 766
br i1 %13, label %1, label %3
}