#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*/ puts(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int main() {
  int a = 97;
  char b[3];
  snprintf(b, 3, "%c", a);
  puts(b);
  int c[5];
  c[0] = 97;
  c[1] = 98;
  c[2] = 99;
  c[3] = 100;
  c[4] = 101;
  char d[5][3];
  int i;
  for (i = 0; i < 5; i++) {
    snprintf(d[i], 3, "%c", c[i]);
  }
  for (i = 0; i < 5; i++) {
    puts(d[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x61,-0x8(%rbp)
lea    -0xb(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x3,%esi
lea    0xeb7(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0xb(%rbp),%rdi
call   1030 <puts@plt>
movl   $0x61,-0x20(%rbp)
movl   $0x62,-0x1c(%rbp)
movl   $0x63,-0x18(%rbp)
movl   $0x64,-0x14(%rbp)
movl   $0x65,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    11c1 <main+0xa1>
movslq -0x34(%rbp),%rax
lea    -0x2f(%rbp),%rdi
imul   $0x3,%rax,%rax
add    %rax,%rdi
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
mov    $0x3,%esi
lea    0xe52(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1181 <main+0x61>
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    11f4 <main+0xd4>
movslq -0x34(%rbp),%rax
lea    -0x2f(%rbp),%rdi
imul   $0x3,%rax,%rax
add    %rax,%rdi
call   1030 <puts@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c8 <main+0xa8>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rbx
lea    0x15(%rsp),%r14
mov    %r14,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x61,%ecx
call   1040 <snprintf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0x6(%rsp),%r14
mov    %r14,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x61,%ecx
call   1040 <snprintf@plt>
lea    0x9(%rsp),%r15
mov    %r15,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x62,%ecx
call   1040 <snprintf@plt>
lea    0xc(%rsp),%r12
mov    %r12,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x63,%ecx
call   1040 <snprintf@plt>
lea    0xf(%rsp),%r13
mov    %r13,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x64,%ecx
call   1040 <snprintf@plt>
lea    0x12(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
mov    $0x65,%ecx
call   1040 <snprintf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca [5 x [3 x i8]]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 97)
%5 = call i32 @puts(i8* %3)
%6 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %2, i64 0, i64 0, i64 0
%7 = call i32 @snprintf(i8* %6, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 97)
%8 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %2, i64 0, i64 1, i64 0
%9 = call i32 @snprintf(i8* %8, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 98)
%10 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %2, i64 0, i64 2, i64 0
%11 = call i32 @snprintf(i8* %10, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 99)
%12 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %2, i64 0, i64 3, i64 0
%13 = call i32 @snprintf(i8* %12, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 100)
%14 = getelementptr inbounds [5 x [3 x i8]], [5 x [3 x i8]]* %2, i64 0, i64 4, i64 0
%15 = call i32 @snprintf(i8* %14, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 101)
%16 = call i32 @puts(i8* %6)
%17 = call i32 @puts(i8* %8)
%18 = call i32 @puts(i8* %10)
%19 = call i32 @puts(i8* %12)
%20 = call i32 @puts(i8* %14)
ret i32 0
}