#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 EOF;
int getc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  int c;
  printf("[");
  if ((c = getc(stdin)) != EOF) {
    printf("%di8", c);
    while ((c = getc(stdin)) != EOF) {
      printf(", %di8", c);
    }
  }
  printf("]\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <getc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%eax
je     11a9 <main+0x89>
mov    -0x8(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1040 <getc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%eax
je     11a4 <main+0x84>
mov    -0x8(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116e <main+0x4e>
jmp    11a9 <main+0x89>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x5b,%edi
call   1030 <putchar@plt>
mov    0x2e92(%rip),%r14
mov    (%r14),%edi
call   1060 <getc@plt>
mov    0x2e7b(%rip),%r15
cmp    (%r15),%eax
je     11a9 <main+0x69>
lea    0xe91(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14),%edi
call   1060 <getc@plt>
cmp    (%r15),%eax
je     11a9 <main+0x69>
lea    0xe72(%rip),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r14),%edi
call   1060 <getc@plt>
cmp    (%r15),%eax
jne    1190 <main+0x50>
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"[\00"
@stdin = global i32 0
@EOF = global i32 0
@.str.1 = [5 x i8] c"%di8\00"
@.str.2 = [7 x i8] c", %di8\00"
@.str.3 = [3 x i8] c"]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @getc(i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %20
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %16, %8
%12 = load i32, i32* @stdin
%13 = call i32 @getc(i32 %12)
store i32 %13, i32* %2
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %11
19: ; preds = %11
br label %20
20: ; preds = %19, %0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
@.str.1 = [5 x i8] c"%di8\00"
@.str.2 = [7 x i8] c", %di8\00"
@str = [2 x i8] c"]\00"
define i32 @main() {
%1 = tail call i32 @putchar(i32 91)
%2 = load i32, i32* @stdin
%3 = tail call i32 @getc(i32 %2)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %19, label %6
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%8 = load i32, i32* @stdin
%9 = tail call i32 @getc(i32 %8)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %19, label %12
12: ; preds = %6, %12
%13 = phi i32 [ %16, %12 ], [ %9, %6 ]
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = load i32, i32* @stdin
%16 = tail call i32 @getc(i32 %15)
%17 = load i32, i32* @EOF
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %12
19: ; preds = %12, %6, %0
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}