#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 /*<<< orphan*/ escape_dollar_signs(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fix_any_quotes(char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ output_row(char *, char *, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ search_replace_string(char *, char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
void output_delete_stmts(char *table_name, char *field_names, char delimiter) {
  char buffer[4096 + 1];
  while (get_line(buffer, stdin)) {
    if (!*buffer)
      continue;
    search_replace_string(buffer, "\\", "");
    fix_any_quotes(buffer);
    escape_dollar_signs(buffer);
    printf("delete from %s", table_name);
    printf(" where 1 = 1");
    output_row(buffer, field_names, delimiter);
    printf(";\n");
    fflush(stdout);
  }
}


x86 assembly (clang, -O0):
<output_delete_stmts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
lea    -0x1020(%rbp),%rdi
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
call   1040 <get_line@plt>
cmp    $0x0,%rax
je     1240 <output_delete_stmts+0xd0>
cmpb   $0x0,-0x1020(%rbp)
jne    11b9 <output_delete_stmts+0x49>
jmp    1188 <output_delete_stmts+0x18>
lea    -0x1020(%rbp),%rdi
lea    0xe39(%rip),%rsi
lea    0xe52(%rip),%rdx
call   1050 <search_replace_string@plt>
lea    -0x1020(%rbp),%rdi
call   1080 <fix_any_quotes@plt>
lea    -0x1020(%rbp),%rdi
call   1070 <escape_dollar_signs@plt>
mov    -0x8(%rbp),%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1030 <output_row@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
jmp    1188 <output_delete_stmts+0x18>
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_delete_stmts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2e48(%rip),%r12
mov    (%r12),%esi
mov    %rsp,%rdi
call   1050 <get_line@plt>
test   %rax,%rax
je     1250 <output_delete_stmts+0xd0>
mov    %rsp,%rbx
movsbl %bpl,%r13d
mov    0x2e15(%rip),%rbp
jmp    11e1 <output_delete_stmts+0x61>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <get_line@plt>
test   %rax,%rax
je     1250 <output_delete_stmts+0xd0>
cmpb   $0x0,(%rsp)
je     11d0 <output_delete_stmts+0x50>
mov    %rbx,%rdi
lea    0xe0f(%rip),%rsi
lea    0xe25(%rip),%rdx
call   1060 <search_replace_string@plt>
mov    %rbx,%rdi
call   1090 <fix_any_quotes@plt>
mov    %rbx,%rdi
call   1080 <escape_dollar_signs@plt>
lea    0xdee(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1030 <output_row@plt>
lea    0xddd(%rip),%rdi
call   1040 <puts@plt>
mov    0x0(%rbp),%edi
call   10a0 <fflush@plt>
jmp    11d0 <output_delete_stmts+0x50>
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"\\\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [15 x i8] c"delete from %s\00"
@.str.3 = [13 x i8] c" where 1 = 1\00"
@.str.4 = [3 x i8] c";\0A\00"
@stdout = global i32 0
define void @output_delete_stmts(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca [4097 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
br label %8
8: ; preds = %18, %17, %3
%9 = getelementptr inbounds [4097 x i8], [4097 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i64 @get_line(i8* %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %35
13: ; preds = %8
%14 = getelementptr inbounds [4097 x i8], [4097 x i8]* %7, i64 0, i64 0
%15 = load i8, i8* %14
%16 = icmp ne i8 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13
br label %8
18: ; preds = %13
%19 = getelementptr inbounds [4097 x i8], [4097 x i8]* %7, i64 0, i64 0
%20 = call i32 @search_replace_string(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds [4097 x i8], [4097 x i8]* %7, i64 0, i64 0
%22 = call i32 @fix_any_quotes(i8* %21)
%23 = getelementptr inbounds [4097 x i8], [4097 x i8]* %7, i64 0, i64 0
%24 = call i32 @escape_dollar_signs(i8* %23)
%25 = load i8*, i8** %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%28 = getelementptr inbounds [4097 x i8], [4097 x i8]* %7, i64 0, i64 0
%29 = load i8*, i8** %5
%30 = load i8, i8* %6
%31 = call i32 @output_row(i8* %28, i8* %29, i8 signext %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* @stdout
%34 = call i32 @fflush(i32 %33)
br label %8
35: ; preds = %8
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [2 x i8] c"\\\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [15 x i8] c"delete from %s\00"
@.str.3 = [13 x i8] c" where 1 = 1\00"
@stdout = global i32 0
@str = [2 x i8] c";\00"
define void @output_delete_stmts(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca [4097 x i8]
%5 = getelementptr inbounds [4097 x i8], [4097 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i64 @get_line(i8* %5, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %26, label %9
9: ; preds = %3, %22
%10 = load i8, i8* %5
%11 = icmp eq i8 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = call i32 @search_replace_string(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @fix_any_quotes(i8* %5)
%15 = call i32 @escape_dollar_signs(i8* %5)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @output_row(i8* %5, i8* %1, i8 signext %2)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%20 = load i32, i32* @stdout
%21 = call i32 @fflush(i32 %20)
br label %22
22: ; preds = %12, %9
%23 = load i32, i32* @stdin
%24 = call i64 @get_line(i8* %5, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %9
26: ; preds = %22, %3
ret void
}