#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
int wpspinchecksum(int);
void writewpsall(FILE *fhout) {
  static int c, cs;
  for (c = 0; c < 10000000; c++) {
    cs = wpspinchecksum(c);
    fprintf(fhout, "%07d%d\n", c, cs);
  }
  return;
}


x86 assembly (clang, -O0):
<writewpsall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,0x2efe(%rip)
cmpl   $0x989680,0x2ef4(%rip)
jge    1187 <writewpsall+0x67>
mov    0x2ee8(%rip),%edi
call   1040 <wpspinchecksum@plt>
mov    %eax,0x2ee1(%rip)
mov    -0x8(%rbp),%rdi
mov    0x2ed3(%rip),%edx
mov    0x2ed1(%rip),%ecx
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ebb(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eb2(%rip)
jmp    1136 <writewpsall+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writewpsall>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,0x2f03(%rip)
xor    %edi,%edi
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
call   1040 <wpspinchecksum@plt>
mov    0x2ee9(%rip),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%ecx
call   1030 <fprintf@plt>
mov    0x2ed6(%rip),%eax
lea    0x1(%rax),%edi
mov    %edi,0x2ecd(%rip)
cmp    $0x98967f,%eax
jl     1140 <writewpsall+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@writewpsall.c = internal global i32 0
@writewpsall.cs = internal global i32 0
@.str = [8 x i8] c"%07d%d\0A\00"
define void @writewpsall(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
store i32 0, i32* @writewpsall.c
br label %3
3: ; preds = %13, %1
%4 = load i32, i32* @writewpsall.c
%5 = icmp slt i32 %4, 10000000
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* @writewpsall.c
%8 = call i32 @wpspinchecksum(i32 %7)
store i32 %8, i32* @writewpsall.cs
%9 = load i32*, i32** %2
%10 = load i32, i32* @writewpsall.c
%11 = load i32, i32* @writewpsall.cs
%12 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11)
br label %13
13: ; preds = %6
%14 = load i32, i32* @writewpsall.c
%15 = add nsw i32 %14, 1
store i32 %15, i32* @writewpsall.c
br label %3
16: ; preds = %3
ret void
}

LLVM IR (-O2):
@writewpsall.c = internal unnamed_addr global i32 0
@.str = [8 x i8] c"%07d%d\0A\00"
define void @writewpsall(i32* nocapture %0) {
store i32 0, i32* @writewpsall.c
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = tail call i32 @wpspinchecksum(i32 %3)
%5 = load i32, i32* @writewpsall.c
%6 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %4)
%7 = load i32, i32* @writewpsall.c
%8 = add nsw i32 %7, 1
store i32 %8, i32* @writewpsall.c
%9 = icmp slt i32 %7, 9999999
br i1 %9, label %2, label %10
10: ; preds = %2
ret void
}