#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*/ STDOUT_FILENO;
int /*<<< orphan*/ write(int /*<<< orphan*/, char const *, long long);
void print_all(const char *str, long long size, long long round,
               long long rem) {
  long long i;
  i = 0;
  while (i < round) {
    write(STDOUT_FILENO, str, size);
    i++;
  }
  if (rem > 0) {
    write(STDOUT_FILENO, str, rem);
  }
}


x86 assembly (clang, -O0):
<print_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1165 <print_all+0x55>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <write@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1130 <print_all+0x20>
cmpq   $0x0,-0x20(%rbp)
jle    1186 <print_all+0x76>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_all>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdi,%r15
test   %rdx,%rdx
jle    1155 <print_all+0x45>
mov    %rdx,%rbx
mov    %rsi,%r12
mov    0x2ebf(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <write@plt>
add    $0xffffffffffffffff,%rbx
jne    1140 <print_all+0x30>
test   %r14,%r14
jle    1177 <print_all+0x67>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <write@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
define void @print_all(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
store i64 0, i64* %9
br label %10
10: ; preds = %14, %4
%11 = load i64, i64* %9
%12 = load i64, i64* %7
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* @STDOUT_FILENO
%16 = load i8*, i8** %5
%17 = load i64, i64* %6
%18 = call i32 @write(i32 %15, i8* %16, i64 %17)
%19 = load i64, i64* %9
%20 = add nsw i64 %19, 1
store i64 %20, i64* %9
br label %10
21: ; preds = %10
%22 = load i64, i64* %8
%23 = icmp sgt i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* @STDOUT_FILENO
%26 = load i8*, i8** %5
%27 = load i64, i64* %8
%28 = call i32 @write(i32 %25, i8* %26, i64 %27)
br label %29
29: ; preds = %24, %21
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
define void @print_all(i8* nocapture %0, i64 %1, i64 %2, i64 %3) {
%5 = icmp sgt i64 %2, 0
br i1 %5, label %6, label %12
6: ; preds = %4, %6
%7 = phi i64 [ %10, %6 ], [ 0, %4 ]
%8 = load i32, i32* @STDOUT_FILENO
%9 = tail call i32 @write(i32 %8, i8* %0, i64 %1)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %2
br i1 %11, label %12, label %6
12: ; preds = %6, %4
%13 = icmp sgt i64 %3, 0
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = load i32, i32* @STDOUT_FILENO
%16 = tail call i32 @write(i32 %15, i8* %0, i64 %3)
br label %17
17: ; preds = %14, %12
ret void
}