#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*/ printf(char *, char);
int i_print(char *pmsg, int size) {
  int i = 1;
  for (i; i <= size; i++) {
    if (*pmsg != '\n') {
      printf("%c", *pmsg);
      pmsg++;
    } else {
      return (0);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<i_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1185 <i_print+0x75>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     1166 <i_print+0x56>
mov    -0x10(%rbp),%rax
lea    0xeb3(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1172 <i_print+0x62>
movl   $0x0,-0x4(%rbp)
jmp    118c <i_print+0x7c>
jmp    1177 <i_print+0x67>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <i_print+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    114d <i_print+0x3d>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%eax
cmp    $0xa,%al
je     114d <i_print+0x3d>
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1130 <i_print+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @i_print(i8* nocapture %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %14, label %4
4: ; preds = %2, %9
%5 = phi i32 [ %12, %9 ], [ 1, %2 ]
%6 = phi i8* [ %11, %9 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 10
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %7)
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = add nuw i32 %5, 1
%13 = icmp eq i32 %5, %1
br i1 %13, label %14, label %4
14: ; preds = %4, %9, %2
ret i32 0
}