#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 S_ADD(char *, int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char a[100] = {'2', 0}, b[100] = {'1', 0};
  int as = 1, bs = 1, i = 2, q = 0;
  printf("%s", a);
  printf(", %s", b);
  while (i < 100) {
    if (q == 0) {
      as = S_ADD(a, as, b, bs);
      printf(", %s", a);
      q = 1;
    } else {
      bs = S_ADD(b, bs, a, as);
      printf(", %s", b);
      q = 0;
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movb   $0x32,-0x70(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movb   $0x31,-0xe0(%rbp)
movl   $0x1,-0xe4(%rbp)
movl   $0x1,-0xe8(%rbp)
movl   $0x2,-0xec(%rbp)
movl   $0x0,-0xf0(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x64,-0xec(%rbp)
jge    1269 <main+0x139>
cmpl   $0x0,-0xf0(%rbp)
jne    1216 <main+0xe6>
lea    -0x70(%rbp),%rdi
mov    -0xe4(%rbp),%esi
lea    -0xe0(%rbp),%rdx
mov    -0xe8(%rbp),%ecx
call   1030 <S_ADD@plt>
mov    %eax,-0xe4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xdfe(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0xf0(%rbp)
jmp    1255 <main+0x125>
lea    -0xe0(%rbp),%rdi
mov    -0xe8(%rbp),%esi
lea    -0x70(%rbp),%rdx
mov    -0xe4(%rbp),%ecx
call   1030 <S_ADD@plt>
mov    %eax,-0xe8(%rbp)
lea    -0xe0(%rbp),%rsi
lea    0xdba(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xf0(%rbp)
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    11bb <main+0x8b>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xd0(%rsp)
movb   $0x32,0x70(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movb   $0x31,(%rsp)
lea    0xe61(%rip),%rdi
lea    0x70(%rsp),%r15
mov    %r15,%rsi
call   1040 <printf@plt>
lea    0xe4b(%rip),%rdi
mov    %rsp,%r12
mov    %r12,%rsi
call   1040 <printf@plt>
mov    $0x1,%r13d
xor    %r14d,%r14d
mov    $0x62,%ebp
mov    $0x1,%ebx
jmp    120a <main+0xea>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1030 <S_ADD@plt>
mov    %eax,%r13d
xor    %r14d,%r14d
mov    %r12,%rsi
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
je     122c <main+0x10c>
test   %r14d,%r14d
jne    11e0 <main+0xc0>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r13d,%ecx
call   1030 <S_ADD@plt>
mov    %eax,%ebx
mov    $0x1,%r14d
mov    %r15,%rsi
jmp    11f9 <main+0xd9>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c", %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [100 x i8]* %2 to i8*
%9 = bitcast i8* %8 to <{ i8, [99 x i8] }>*
%10 = getelementptr inbounds <{ i8, [99 x i8] }>, <{ i8, [99 x i8] }>* %9, i32 0, i32 0
store i8 50, i8* %10
%11 = bitcast [100 x i8]* %3 to i8*
%12 = bitcast i8* %11 to <{ i8, [99 x i8] }>*
%13 = getelementptr inbounds <{ i8, [99 x i8] }>, <{ i8, [99 x i8] }>* %12, i32 0, i32 0
store i8 49, i8* %13
store i32 1, i32* %4
store i32 1, i32* %5
store i32 2, i32* %6
store i32 0, i32* %7
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %40, %0
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 100
br i1 %20, label %21, label %43
21: ; preds = %18
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %32
24: ; preds = %21
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%26 = load i32, i32* %4
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%28 = load i32, i32* %5
%29 = call i32 @S_ADD(i8* %25, i32 %26, i8* %27, i32 %28)
store i32 %29, i32* %4
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %30)
store i32 1, i32* %7
br label %40
32: ; preds = %21
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%34 = load i32, i32* %5
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%36 = load i32, i32* %4
%37 = call i32 @S_ADD(i8* %33, i32 %34, i8* %35, i32 %36)
store i32 %37, i32* %5
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%39 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %38)
store i32 0, i32* %7
br label %40
40: ; preds = %32, %24
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %18
43: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c", %s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 50, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8 49, i8* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %7
7: ; preds = %0, %17
%8 = phi i32 [ 0, %0 ], [ %21, %17 ]
%9 = phi i32 [ 2, %0 ], [ %23, %17 ]
%10 = phi i32 [ 1, %0 ], [ %20, %17 ]
%11 = phi i32 [ 1, %0 ], [ %19, %17 ]
%12 = icmp eq i32 %8, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 @S_ADD(i8* %3, i32 %11, i8* %4, i32 %10)
br label %17
15: ; preds = %7
%16 = call i32 @S_ADD(i8* %4, i32 %10, i8* %3, i32 %11)
br label %17
17: ; preds = %15, %13
%18 = phi i8* [ %4, %15 ], [ %3, %13 ]
%19 = phi i32 [ %11, %15 ], [ %14, %13 ]
%20 = phi i32 [ %16, %15 ], [ %10, %13 ]
%21 = phi i32 [ 0, %15 ], [ 1, %13 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%23 = add nuw nsw i32 %9, 1
%24 = icmp eq i32 %23, 100
br i1 %24, label %25, label %7
25: ; preds = %17
ret i32 0
}