#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
main() {
  register int l, j;
  for (j = 0; (l = getchar()) != -1; j++) {
    if (j % 16 == 15)
      printf("%3d\n", l & 0377);
    else
      printf("%3d ", l & 0377);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
je     11a3 <main+0x83>
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0xf,%edx
jne    1179 <main+0x59>
mov    -0x8(%rbp),%esi
and    $0xff,%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1190 <main+0x70>
mov    -0x8(%rbp),%esi
and    $0xff,%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1195 <main+0x75>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
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   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xffffffff,%eax
je     1177 <main+0x47>
lea    0xeb9(%rip),%r14
lea    0xeb7(%rip),%rbx
xor    %ebp,%ebp
mov    %ebp,%ecx
not    %ecx
test   $0xf,%cl
movzbl %al,%esi
mov    %rbx,%rdi
cmove  %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xffffffff,%eax
jne    1150 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%3d\0A\00"
@.str.1 = [5 x i8] c"%3d \00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = icmp eq i32 %1, -1
br i1 %2, label %14, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %12, %3 ], [ %1, %0 ]
%5 = phi i32 [ %11, %3 ], [ 0, %0 ]
%6 = and i32 %5, 15
%7 = icmp eq i32 %6, 15
%8 = and i32 %4, 255
%9 = select i1 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9, i32 %8)
%11 = add nuw nsw i32 %5, 1
%12 = tail call i32 (...) @getchar()
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %3
14: ; preds = %3, %0
%15 = tail call i32 @putchar(i32 10)
ret i32 0
}