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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int);
void keywritetenda2(FILE *fhout) {
  static size_t ca;
  static int cn;
  static char pskstring[64] = {};
  static const char *word1[] = {"apple", "east", "give",  "lable", "light",
                                "north", "pace", "south", "west"};
  for (ca = 0; ca < (sizeof(word1) / sizeof(char *)); ca++) {
    for (cn = 0; cn < 10000; cn++) {
      snprintf(pskstring, 64, "%s%04d", word1[ca], cn);
      fprintf(fhout, "%s\n", pskstring);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<keywritetenda2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,0x2f69(%rip)
cmpq   $0x9,0x2f61(%rip)
09
jae    11d7 <keywritetenda2+0xb7>
movl   $0x0,0x2f59(%rip)
cmpl   $0x2710,0x2f4f(%rip)
jge    11bb <keywritetenda2+0x9b>
mov    0x2f3a(%rip),%rcx
lea    0x2ed3(%rip),%rax
mov    (%rax,%rcx,8),%rcx
mov    0x2f30(%rip),%r8d
lea    0x2f31(%rip),%rdi
mov    $0x40,%esi
lea    0xea7(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9e(%rip),%rsi
lea    0x2f0e(%rip),%rdx
call   1040 <fprintf@plt>
mov    0x2efb(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ef2(%rip)
jmp    114f <keywritetenda2+0x2f>
jmp    11c0 <keywritetenda2+0xa0>
mov    0x2ed9(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2ece(%rip)
jmp    1137 <keywritetenda2+0x17>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keywritetenda2>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
movq   $0x0,0x2f09(%rip)
xor    %eax,%eax
lea    0xec0(%rip),%r13
lea    0x2f09(%rip),%rbx
lea    0xf08(%rip),%r15
lea    0xf08(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x0,0x2ede(%rip)
xor    %r8d,%r8d
nopl   (%rax)
movslq 0x0(%r13,%rax,4),%rcx
add    %r13,%rcx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %r15,%rdx
call   1030 <snprintf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
mov    0x2eac(%rip),%ecx
lea    0x1(%rcx),%r8d
mov    %r8d,0x2ea1(%rip)
mov    0x2e92(%rip),%rax
cmp    $0x270f,%ecx
jl     1170 <keywritetenda2+0x50>
add    $0x1,%rax
mov    %rax,0x2e7f(%rip)
cmp    $0x9,%rax
jb     1160 <keywritetenda2+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@keywritetenda2.ca = internal global i64 0
@keywritetenda2.cn = internal global i32 0
@keywritetenda2.pskstring = internal global [64 x i8] zeroinitializer
@keywritetenda2.word1 = internal global [9 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0)]
@.str = [6 x i8] c"apple\00"
@.str.1 = [5 x i8] c"east\00"
@.str.2 = [5 x i8] c"give\00"
@.str.3 = [6 x i8] c"lable\00"
@.str.4 = [6 x i8] c"light\00"
@.str.5 = [6 x i8] c"north\00"
@.str.6 = [5 x i8] c"pace\00"
@.str.7 = [6 x i8] c"south\00"
@.str.8 = [5 x i8] c"west\00"
@.str.9 = [7 x i8] c"%s%04d\00"
@.str.10 = [4 x i8] c"%s\0A\00"
define void @keywritetenda2(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
store i64 0, i64* @keywritetenda2.ca
br label %3
3: ; preds = %22, %1
%4 = load i64, i64* @keywritetenda2.ca
%5 = icmp ult i64 %4, 9
br i1 %5, label %6, label %25
6: ; preds = %3
store i32 0, i32* @keywritetenda2.cn
br label %7
7: ; preds = %18, %6
%8 = load i32, i32* @keywritetenda2.cn
%9 = icmp slt i32 %8, 10000
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i64, i64* @keywritetenda2.ca
%12 = getelementptr inbounds [9 x i8*], [9 x i8*]* @keywritetenda2.word1, i64 0, i64 %11
%13 = load i8*, i8** %12
%14 = load i32, i32* @keywritetenda2.cn
%15 = call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @keywritetenda2.pskstring, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %13, i32 %14)
%16 = load i32*, i32** %2
%17 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @keywritetenda2.pskstring, i64 0, i64 0))
br label %18
18: ; preds = %10
%19 = load i32, i32* @keywritetenda2.cn
%20 = add nsw i32 %19, 1
store i32 %20, i32* @keywritetenda2.cn
br label %7
21: ; preds = %7
br label %22
22: ; preds = %21
%23 = load i64, i64* @keywritetenda2.ca
%24 = add i64 %23, 1
store i64 %24, i64* @keywritetenda2.ca
br label %3
25: ; preds = %3
ret void
}

LLVM IR (-O2):
@keywritetenda2.ca = internal unnamed_addr global i64 0
@keywritetenda2.cn = internal unnamed_addr global i32 0
@keywritetenda2.pskstring = internal global [64 x i8] zeroinitializer
@reltable.keywritetenda2 = internal unnamed_addr constant [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.8 to i64), i64 ptrtoint ([9 x i32]* @reltable.keywritetenda2 to i64)) to i32)]
@.str = [6 x i8] c"apple\00"
@.str.1 = [5 x i8] c"east\00"
@.str.2 = [5 x i8] c"give\00"
@.str.3 = [6 x i8] c"lable\00"
@.str.4 = [6 x i8] c"light\00"
@.str.5 = [6 x i8] c"north\00"
@.str.6 = [5 x i8] c"pace\00"
@.str.7 = [6 x i8] c"south\00"
@.str.8 = [5 x i8] c"west\00"
@.str.9 = [7 x i8] c"%s%04d\00"
@.str.10 = [4 x i8] c"%s\0A\00"
define void @keywritetenda2(i32* nocapture %0) {
store i64 0, i64* @keywritetenda2.ca
br label %2
2: ; preds = %1, %15
%3 = phi i64 [ 0, %1 ], [ %16, %15 ]
store i32 0, i32* @keywritetenda2.cn
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ %3, %2 ], [ %14, %4 ]
%6 = phi i32 [ 0, %2 ], [ %12, %4 ]
%7 = shl i64 %5, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.keywritetenda2 to i8*), i64 %7)
%9 = tail call i32 @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @keywritetenda2.pskstring, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* %8, i32 %6)
%10 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([64 x i8], [64 x i8]* @keywritetenda2.pskstring, i64 0, i64 0))
%11 = load i32, i32* @keywritetenda2.cn
%12 = add nsw i32 %11, 1
store i32 %12, i32* @keywritetenda2.cn
%13 = icmp slt i32 %11, 9999
%14 = load i64, i64* @keywritetenda2.ca
br i1 %13, label %4, label %15
15: ; preds = %4
%16 = add i64 %14, 1
store i64 %16, i64* @keywritetenda2.ca
%17 = icmp ult i64 %16, 9
br i1 %17, label %2, label %18
18: ; preds = %15
ret void
}