#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 getchar();
int /*<<< orphan*/ imprimer_ligne(char *, int);
int main() {
  int c, i = 0;
  char ligne[16];
  while ((c = getchar()) != EOF) {
    ligne[i++] = c;
    if (i == 16) {
      imprimer_ligne(ligne, i);
      i = 0;
    }
  }
  if (i != 0)
    imprimer_ligne(ligne, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1187 <main+0x67>
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %cl,-0x20(%rbp,%rax,1)
cmpl   $0x10,-0xc(%rbp)
jne    1182 <main+0x62>
lea    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <imprimer_ligne@plt>
movl   $0x0,-0xc(%rbp)
jmp    1136 <main+0x16>
cmpl   $0x0,-0xc(%rbp)
je     119d <main+0x7d>
lea    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <imprimer_ligne@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb2(%rip),%rbx
cmp    (%rbx),%eax
je     1188 <main+0x68>
mov    %rsp,%r14
xor    %ebp,%ebp
jmp    115b <main+0x3b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     117a <main+0x5a>
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,(%rsp,%rcx,1)
cmp    $0x10,%ebp
jne    1150 <main+0x30>
mov    %r14,%rdi
mov    $0x10,%esi
call   1030 <imprimer_ligne@plt>
xor    %ebp,%ebp
jmp    1150 <main+0x30>
test   %ebp,%ebp
je     1188 <main+0x68>
mov    %rsp,%rdi
mov    %ebp,%esi
call   1030 <imprimer_ligne@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [16 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %22, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i32, i32* %2
%11 = trunc i32 %10 to i8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 %14
store i8 %11, i8* %15
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 16
br i1 %17, label %18, label %22
18: ; preds = %9
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @imprimer_ligne(i8* %19, i32 %20)
store i32 0, i32* %3
br label %22
22: ; preds = %18, %9
br label %5
23: ; preds = %5
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%28 = load i32, i32* %3
%29 = call i32 @imprimer_ligne(i8* %27, i32 %28)
br label %30
30: ; preds = %26, %23
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %25, label %6
6: ; preds = %0, %16
%7 = phi i32 [ %18, %16 ], [ %3, %0 ]
%8 = phi i32 [ %17, %16 ], [ 0, %0 ]
%9 = trunc i32 %7 to i8
%10 = add nsw i32 %8, 1
%11 = sext i32 %8 to i64
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 %11
store i8 %9, i8* %12
%13 = icmp eq i32 %10, 16
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = call i32 @imprimer_ligne(i8* %2, i32 16)
br label %16
16: ; preds = %14, %6
%17 = phi i32 [ 0, %14 ], [ %10, %6 ]
%18 = call i32 (...) @getchar()
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %6
21: ; preds = %16
%22 = icmp eq i32 %17, 0
br i1 %22, label %25, label %23
23: ; preds = %21
%24 = call i32 @imprimer_ligne(i8* %2, i32 %17)
br label %25
25: ; preds = %0, %23, %21
ret i32 0
}