#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 *);
scalar_t__ ceil(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int strtod(char *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int i = 0;
  double sx;
  double sy;
  double zx;
  double zy;
  int rx;
  int ry;
  if (argc < 3) {
    fprintf(stderr, "usage: mk_scale x y\n");
    return 1;
  }
  sx = strtod(argv[1], NULL) / 512;
  sy = strtod(argv[2], NULL) / 512;
  rx = atoi(argv[1]) - 1;
  ry = atoi(argv[2]) - 1;
  zx = 512 / strtod(argv[1], NULL);
  zy = 512 / strtod(argv[2], NULL);
  printf("/* ! Autogenerated by tools/mk_scale.c */\n\n"
         "#ifndef SCALE_H\n"
         "#define SCALE_H\n\n"
         "unsigned short scalex[]={\n");
  for (i = 0; i < 512; i++) {
    printf("%d,", (int)ceil(i * sx));
    if (i % 8 == 7)
      printf("\n");
  }
  printf("};\n\n");
  printf("unsigned short scaley[]={\n");
  for (i = 511; i >= 0; i -= 1) {
    printf("%d,", (int)ceil(i * sy));
    if (i % 8 == 0)
      printf("\n");
  }
  printf("};\n\n");
  printf("unsigned short scaletx[]={\n");
  for (i = 0; i < rx; i++) {
    printf("%d,", (int)ceil(i * zx));
    if (i % 8 == 7)
      printf("\n");
  }
  printf("};\n\n");
  printf("unsigned short scalety[]={\n");
  for (i = ry; i >= 0; i -= 1) {
    printf("%d,", (int)ceil(i * zy));
    if (i % 8 == 0)
      printf("\n");
  }
  printf("};\n\n");
  printf("#endif  /* scale_h */\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1198 <main+0x48>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1477 <main+0x327>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    $0x200,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    $0x200,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %eax,%ecx
mov    $0x200,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %eax,%ecx
mov    $0x200,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x200,-0x14(%rbp)
jge    12c4 <main+0x174>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <ceil@plt>
mov    %eax,%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    12b1 <main+0x161>
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b6 <main+0x166>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    125f <main+0x10f>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1ff,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1349 <main+0x1f9>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <ceil@plt>
mov    %eax,%esi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1336 <main+0x1e6>
lea    0xd54(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    133b <main+0x1eb>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12e7 <main+0x197>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    13d0 <main+0x280>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <ceil@plt>
mov    %eax,%esi
lea    0xce8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x7,%edx
jne    13bd <main+0x26d>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13c2 <main+0x272>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    136c <main+0x21c>
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1454 <main+0x304>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <ceil@plt>
mov    %eax,%esi
lea    0xc64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1441 <main+0x2f1>
lea    0xc49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1446 <main+0x2f6>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13f2 <main+0x2a2>
lea    0xc25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jg     11a2 <main+0x32>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%eax
jmp    1448 <main+0x2d8>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
xor    %esi,%esi
call   1050 <strtod@plt>
lea    0x1ff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x9,%ecx
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x10(%r14),%rdi
xor    %esi,%esi
call   1050 <strtod@plt>
lea    0x1ff(%rax),%r13d
test   %eax,%eax
cmovns %eax,%r13d
sar    $0x9,%r13d
mov    0x8(%r14),%rbp
mov    %rbp,%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
mov    0x10(%r14),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
xor    %esi,%esi
call   1050 <strtod@plt>
mov    %eax,%ecx
mov    $0x200,%eax
xor    %edx,%edx
idiv   %ecx
mov    %eax,%r15d
mov    0x10(%r14),%rdi
xor    %esi,%esi
call   1050 <strtod@plt>
mov    %eax,%ecx
mov    $0x200,%eax
xor    %edx,%edx
idiv   %ecx
mov    %eax,0x14(%rsp)
lea    0xdea(%rip),%rdi
call   1040 <puts@plt>
xorpd  %xmm1,%xmm1
lea    0xdd6(%rip),%rbp
xor    %r14d,%r14d
jmp    126e <main+0xfe>
nopl   0x0(%rax)
movsd  (%rsp),%xmm0
addsd  0xda3(%rip),%xmm0
add    $0x1,%r14d
cmp    $0x200,%r14d
movapd %xmm0,%xmm1
je     12a7 <main+0x137>
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <ceil@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%eax
not    %eax
test   $0x7,%al
jne    1250 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1250 <main+0xe0>
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe0e(%rip),%rdi
call   1040 <puts@plt>
lea    0xdb2(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1ff,%ebp
lea    0xd37(%rip),%r14
jmp    12f5 <main+0x185>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
jae    1328 <main+0x1b8>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <ceil@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   $0x7,%bpl
jne    12f0 <main+0x180>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    12f0 <main+0x180>
lea    0xda8(%rip),%rdi
call   1040 <puts@plt>
lea    0xd66(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x2,%r12d
jl     13b1 <main+0x241>
add    $0xffffffff,%r12d
xorpd  %xmm1,%xmm1
lea    0xcc8(%rip),%r14
xor    %ebp,%ebp
jmp    1379 <main+0x209>
nopl   0x0(%rax)
movsd  (%rsp),%xmm0
addsd  0xc93(%rip),%xmm0
add    $0x1,%ebp
cmp    %ebp,%r12d
movapd %xmm0,%xmm1
je     13b1 <main+0x241>
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <ceil@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebp,%eax
not    %eax
test   $0x7,%al
jne    1360 <main+0x1f0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1360 <main+0x1f0>
lea    0xd1f(%rip),%rdi
call   1040 <puts@plt>
lea    0xcf8(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    142e <main+0x2be>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm0
movsd  %xmm0,(%rsp)
add    $0x1,%ebx
lea    0xc38(%rip),%r14
jmp    13f8 <main+0x288>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
jbe    142e <main+0x2be>
lea    -0x2(%rbx),%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <ceil@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
test   $0x7,%bpl
jne    13f0 <main+0x280>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    13f0 <main+0x280>
lea    0xca2(%rip),%rdi
call   1040 <puts@plt>
lea    0xc9a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"usage: mk_scale x y\0A\00"
@.str.1 = [103 x i8] c"/* ! Autogenerated by tools/mk_scale.c */\0A\0A#ifndef SCALE_H\0A#define SCALE_H\0A\0Aunsigned short scalex[]={\0A\00"
@.str.2 = [4 x i8] c"%d,\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [5 x i8] c"};\0A\0A\00"
@.str.5 = [27 x i8] c"unsigned short scaley[]={\0A\00"
@.str.6 = [28 x i8] c"unsigned short scaletx[]={\0A\00"
@.str.7 = [28 x i8] c"unsigned short scalety[]={\0A\00"
@.str.8 = [23 x i8] c"#endif /* scale_h */\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %152
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strtod(i8* %21, i32* null)
%23 = sdiv i32 %22, 512
%24 = sitofp i32 %23 to double
store double %24, double* %7
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @strtod(i8* %27, i32* null)
%29 = sdiv i32 %28, 512
%30 = sitofp i32 %29 to double
store double %30, double* %8
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %11
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
%40 = sub nsw i32 %39, 1
store i32 %40, i32* %12
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @strtod(i8* %43, i32* null)
%45 = sdiv i32 512, %44
%46 = sitofp i32 %45 to double
store double %46, double* %9
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 2
%49 = load i8*, i8** %48
%50 = call i32 @strtod(i8* %49, i32* null)
%51 = sdiv i32 512, %50
%52 = sitofp i32 %51 to double
store double %52, double* %10
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %54
54: ; preds = %72, %18
%55 = load i32, i32* %6
%56 = icmp slt i32 %55, 512
br i1 %56, label %57, label %75
57: ; preds = %54
%58 = load i32, i32* %6
%59 = sitofp i32 %58 to double
%60 = load double, double* %7
%61 = fmul double %59, %60
%62 = fptosi double %61 to i32
%63 = call i64 @ceil(i32 %62)
%64 = trunc i64 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %6
%67 = srem i32 %66, 8
%68 = icmp eq i32 %67, 7
br i1 %68, label %69, label %71
69: ; preds = %57
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %71
71: ; preds = %69, %57
br label %72
72: ; preds = %71
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %54
75: ; preds = %54
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 511, i32* %6
br label %78
78: ; preds = %96, %75
%79 = load i32, i32* %6
%80 = icmp sge i32 %79, 0
br i1 %80, label %81, label %99
81: ; preds = %78
%82 = load i32, i32* %6
%83 = sitofp i32 %82 to double
%84 = load double, double* %8
%85 = fmul double %83, %84
%86 = fptosi double %85 to i32
%87 = call i64 @ceil(i32 %86)
%88 = trunc i64 %87 to i32
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %88)
%90 = load i32, i32* %6
%91 = srem i32 %90, 8
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %81
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %95
95: ; preds = %93, %81
br label %96
96: ; preds = %95
%97 = load i32, i32* %6
%98 = sub nsw i32 %97, 1
store i32 %98, i32* %6
br label %78
99: ; preds = %78
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %6
br label %102
102: ; preds = %121, %99
%103 = load i32, i32* %6
%104 = load i32, i32* %11
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %124
106: ; preds = %102
%107 = load i32, i32* %6
%108 = sitofp i32 %107 to double
%109 = load double, double* %9
%110 = fmul double %108, %109
%111 = fptosi double %110 to i32
%112 = call i64 @ceil(i32 %111)
%113 = trunc i64 %112 to i32
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %113)
%115 = load i32, i32* %6
%116 = srem i32 %115, 8
%117 = icmp eq i32 %116, 7
br i1 %117, label %118, label %120
118: ; preds = %106
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %120
120: ; preds = %118, %106
br label %121
121: ; preds = %120
%122 = load i32, i32* %6
%123 = add nsw i32 %122, 1
store i32 %123, i32* %6
br label %102
124: ; preds = %102
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%127 = load i32, i32* %12
store i32 %127, i32* %6
br label %128
128: ; preds = %146, %124
%129 = load i32, i32* %6
%130 = icmp sge i32 %129, 0
br i1 %130, label %131, label %149
131: ; preds = %128
%132 = load i32, i32* %6
%133 = sitofp i32 %132 to double
%134 = load double, double* %10
%135 = fmul double %133, %134
%136 = fptosi double %135 to i32
%137 = call i64 @ceil(i32 %136)
%138 = trunc i64 %137 to i32
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %138)
%140 = load i32, i32* %6
%141 = srem i32 %140, 8
%142 = icmp eq i32 %141, 0
br i1 %142, label %143, label %145
143: ; preds = %131
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %145
145: ; preds = %143, %131
br label %146
146: ; preds = %145
%147 = load i32, i32* %6
%148 = sub nsw i32 %147, 1
store i32 %148, i32* %6
br label %128
149: ; preds = %128
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %3
br label %152
152: ; preds = %149, %15
%153 = load i32, i32* %3
ret i32 %153
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"usage: mk_scale x y\0A\00"
@.str.2 = [4 x i8] c"%d,\00"
@str = [102 x i8] c"/* ! Autogenerated by tools/mk_scale.c */\0A\0A#ifndef SCALE_H\0A#define SCALE_H\0A\0Aunsigned short scalex[]={\00"
@str.10 = [26 x i8] c"unsigned short scaley[]={\00"
@str.12 = [27 x i8] c"unsigned short scaletx[]={\00"
@str.14 = [27 x i8] c"unsigned short scalety[]={\00"
@str.15 = [4 x i8] c"};\0A\00"
@str.16 = [22 x i8] c"#endif /* scale_h */\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %105
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strtod(i8* nocapture %9, i32* null)
%11 = sdiv i32 %10, 512
%12 = sitofp i32 %11 to double
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @strtod(i8* nocapture %14, i32* null)
%16 = sdiv i32 %15, 512
%17 = load i8*, i8** %8
%18 = tail call i32 @atoi(i8* %17)
%19 = load i8*, i8** %13
%20 = tail call i32 @atoi(i8* %19)
%21 = tail call i32 @strtod(i8* nocapture %17, i32* null)
%22 = sdiv i32 512, %21
%23 = load i8*, i8** %13
%24 = tail call i32 @strtod(i8* nocapture %23, i32* null)
%25 = sdiv i32 512, %24
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %7, %39
%28 = phi i32 [ 0, %7 ], [ %40, %39 ]
%29 = sitofp i32 %28 to double
%30 = fmul double %12, %29
%31 = fptosi double %30 to i32
%32 = tail call i64 @ceil(i32 %31)
%33 = trunc i64 %32 to i32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = and i32 %28, 7
%36 = icmp eq i32 %35, 7
br i1 %36, label %37, label %39
37: ; preds = %27
%38 = tail call i32 @putchar(i32 10)
br label %39
39: ; preds = %27, %37
%40 = add nuw nsw i32 %28, 1
%41 = icmp eq i32 %40, 512
br i1 %41, label %42, label %27
42: ; preds = %39
%43 = sitofp i32 %16 to double
%44 = sitofp i32 %22 to double
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.15, i64 0, i64 0))
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.10, i64 0, i64 0))
br label %47
47: ; preds = %42, %59
%48 = phi i32 [ 511, %42 ], [ %60, %59 ]
%49 = sitofp i32 %48 to double
%50 = fmul double %43, %49
%51 = fptosi double %50 to i32
%52 = tail call i64 @ceil(i32 %51)
%53 = trunc i64 %52 to i32
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = and i32 %48, 7
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %47
%58 = tail call i32 @putchar(i32 10)
br label %59
59: ; preds = %47, %57
%60 = add nsw i32 %48, -1
%61 = icmp eq i32 %48, 0
br i1 %61, label %62, label %47
62: ; preds = %59
%63 = add i32 %18, -1
%64 = sitofp i32 %25 to double
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.15, i64 0, i64 0))
%66 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
%67 = icmp sgt i32 %18, 1
br i1 %67, label %68, label %83
68: ; preds = %62, %80
%69 = phi i32 [ %81, %80 ], [ 0, %62 ]
%70 = sitofp i32 %69 to double
%71 = fmul double %44, %70
%72 = fptosi double %71 to i32
%73 = tail call i64 @ceil(i32 %72)
%74 = trunc i64 %73 to i32
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %74)
%76 = and i32 %69, 7
%77 = icmp eq i32 %76, 7
br i1 %77, label %78, label %80
78: ; preds = %68
%79 = tail call i32 @putchar(i32 10)
br label %80
80: ; preds = %68, %78
%81 = add nuw nsw i32 %69, 1
%82 = icmp eq i32 %81, %63
br i1 %82, label %83, label %68
83: ; preds = %80, %62
%84 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.15, i64 0, i64 0))
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.14, i64 0, i64 0))
%86 = icmp sgt i32 %20, 0
br i1 %86, label %87, label %102
87: ; preds = %83, %100
%88 = phi i32 [ %89, %100 ], [ %20, %83 ]
%89 = add nsw i32 %88, -1
%90 = sitofp i32 %89 to double
%91 = fmul double %64, %90
%92 = fptosi double %91 to i32
%93 = tail call i64 @ceil(i32 %92)
%94 = trunc i64 %93 to i32
%95 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %94)
%96 = and i32 %89, 7
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %87
%99 = tail call i32 @putchar(i32 10)
br label %100
100: ; preds = %87, %98
%101 = icmp ugt i32 %88, 1
br i1 %101, label %87, label %102
102: ; preds = %100, %83
%103 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.15, i64 0, i64 0))
%104 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.16, i64 0, i64 0))
br label %105
105: ; preds = %102, %4
%106 = phi i32 [ 1, %4 ], [ 0, %102 ]
ret i32 %106
}