#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int output_c(FILE *c, unsigned char *s, unsigned int n) {
  static unsigned int j = 0;
  while (n-- > 0) {
    if (j++ % 20 == 0)
      fprintf(c, "\n");
    fprintf(c, " %u,", *s++);
  }
  return 0;
}


x86 assembly (clang, -O0):
<output_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jbe    1195 <output_c+0x85>
mov    0x2eef(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ee4(%rip)
mov    $0x14,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    116c <output_c+0x5c>
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%edx
lea    0xe79(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1123 <output_c+0x13>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_c>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
je     1199 <output_c+0x79>
mov    %rsi,%r14
mov    %rdi,%r13
mov    %edx,%r12d
lea    0xec3(%rip),%r15
xor    %ebx,%ebx
jmp    116b <output_c+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%edx
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
je     1199 <output_c+0x79>
mov    0x2ec3(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2eba(%rip)
imul   $0xcccccccd,%eax,%eax
ror    $0x2,%eax
cmp    $0xccccccc,%eax
ja     1150 <output_c+0x30>
mov    $0xa,%edi
mov    %r13,%rsi
call   1030 <fputc@plt>
jmp    1150 <output_c+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@output_c.j = internal global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c" %u,\00"
define i32 @output_c(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %19, %3
%8 = load i32, i32* %6
%9 = add i32 %8, -1
store i32 %9, i32* %6
%10 = icmp ugt i32 %8, 0
br i1 %10, label %11, label %26
11: ; preds = %7
%12 = load i32, i32* @output_c.j
%13 = add i32 %12, 1
store i32 %13, i32* @output_c.j
%14 = urem i32 %12, 20
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32*, i32** %4
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %16, %11
%20 = load i32*, i32** %4
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %5
%23 = load i8, i8* %21
%24 = zext i8 %23 to i32
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %7
26: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@output_c.j = internal unnamed_addr global i32 0
@.str.1 = [5 x i8] c" %u,\00"
define i32 @output_c(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %21, label %5
5: ; preds = %3, %15
%6 = phi i32 [ %8, %15 ], [ %2, %3 ]
%7 = phi i8* [ %16, %15 ], [ %1, %3 ]
%8 = add i32 %6, -1
%9 = load i32, i32* @output_c.j
%10 = add i32 %9, 1
store i32 %10, i32* @output_c.j
%11 = urem i32 %9, 20
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = tail call i32 @fputc(i32 10, i32* %0)
br label %15
15: ; preds = %13, %5
%16 = getelementptr inbounds i8, i8* %7, i64 1
%17 = load i8, i8* %7
%18 = zext i8 %17 to i32
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = icmp eq i32 %8, 0
br i1 %20, label %21, label %5
21: ; preds = %15, %3
ret i32 0
}