#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*/ sqlite3_stmt;
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ insert(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char *,
                          int, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void generate(sqlite3 *db, sqlite3_stmt *stmt) {
  int i = 0;
  for (; i < 10; ++i) {
    char name[16], address[64];
    sprintf(name, "zing-%d", i);
    sprintf(address, "jiansu-wuxi-%d", i);
    insert(db, stmt, name, i + 20, address);
  }
}


x86 assembly (clang, -O0):
<generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1190 <generate+0x70>
lea    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xeb1(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xea6(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    -0x14(%rbp),%ecx
add    $0x14,%ecx
lea    -0x70(%rbp),%r8
call   1030 <insert@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <generate+0x17>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
mov    %rsp,%r13
lea    0xec8(%rip),%rbp
lea    0x10(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
lea    0xea6(%rip),%rsi
mov    %ebx,%edx
call   1040 <sprintf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1040 <sprintf@plt>
lea    0x14(%rbx),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r12,%r8
call   1030 <insert@plt>
add    $0x1,%ebx
cmp    $0xa,%ebx
jne    1150 <generate+0x30>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"zing-%d\00"
@.str.1 = [15 x i8] c"jiansu-wuxi-%d\00"
define void @generate(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [16 x i8]
%7 = alloca [64 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
br label %8
8: ; preds = %25, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %5
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%16 = load i32, i32* %5
%17 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32*, i32** %3
%19 = load i32*, i32** %4
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 20
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%24 = call i32 @insert(i32* %18, i32* %19, i8* %20, i32 %22, i8* %23)
br label %25
25: ; preds = %11
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %8
28: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"zing-%d\00"
@.str.1 = [15 x i8] c"jiansu-wuxi-%d\00"
define void @generate(i32* %0, i32* %1) {
%3 = alloca [16 x i8]
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %2, %7
%8 = phi i32 [ 0, %2 ], [ %13, %7 ]
%9 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%11 = add nuw nsw i32 %8, 20
%12 = call i32 @insert(i32* %0, i32* %1, i8* %5, i32 %11, i8* %6)
%13 = add nuw nsw i32 %8, 1
%14 = icmp eq i32 %13, 10
br i1 %14, label %15, label %7
15: ; preds = %7
ret void
}