#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*/ printf(char *, ...);
int main() {
  char *test = "select foo, bar ,baz from mytable ; ";
  char a, b;
  while (*test != '\0') {
    a = *test;
    printf("%c", a);
    b = a++;
    printf("\n");
    printf("%c", b);
    test++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1194 <main+0x84>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
mov    %al,%cl
add    $0x1,%cl
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x12(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112a <main+0x1a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x73,%ebp
mov    $0x1,%ebx
lea    0xedb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
call   1030 <putchar@plt>
movsbl (%rbx,%r14,1),%ebp
add    $0x1,%rbx
cmp    $0x25,%rbx
jne    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"select foo, bar ,baz from mytable ; \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %2
br label %5
5: ; preds = %10, %0
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
store i8 %12, i8* %3
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i8, i8* %3
%17 = add i8 %16, 1
store i8 %17, i8* %3
store i8 %16, i8* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %2
br label %5
24: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"select foo, bar ,baz from mytable ; \00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 115, %0 ], [ %9, %1 ]
%3 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), %0 ], [ %7, %1 ]
%4 = tail call i32 @putchar(i32 %2)
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 @putchar(i32 %2)
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i8* %7, getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 36)
br i1 %10, label %11, label %1
11: ; preds = %1
ret i32 0
}