#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 */
scalar_t__ islower(char);
char toupper(char);
void c_low2up(register char *buf, register int *size) {
  register int cnt;
  register char *ptr;
  cnt = *size;
  ptr = buf;
  for (; cnt--; ptr++) {
    if (islower(*ptr))
      *ptr = toupper(*ptr);
  }
  return;
}


x86 assembly (clang, -O0):
<c_low2up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     1195 <c_low2up+0x75>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     117f <c_low2up+0x5f>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
jmp    1184 <c_low2up+0x64>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1141 <c_low2up+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_low2up>:
push   %r15
push   %r14
push   %rbx
mov    (%rsi),%r14d
test   %r14,%r14
je     1168 <c_low2up+0x48>
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1149 <c_low2up+0x29>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %ebx,%r14d
je     1168 <c_low2up+0x48>
movsbl (%r15,%rbx,1),%edi
call   1030 <islower@plt>
test   %rax,%rax
je     1140 <c_low2up+0x20>
movsbl (%r15,%rbx,1),%edi
call   1040 <toupper@plt>
mov    %al,(%r15,%rbx,1)
jmp    1140 <c_low2up+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @c_low2up(i8* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2, %15
%6 = phi i32 [ %8, %15 ], [ %3, %2 ]
%7 = phi i8* [ %16, %15 ], [ %0, %2 ]
%8 = add nsw i32 %6, -1
%9 = load i8, i8* %7
%10 = tail call i64 @islower(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %5
%13 = load i8, i8* %7
%14 = tail call signext i8 @toupper(i8 signext %13)
store i8 %14, i8* %7
br label %15
15: ; preds = %5, %12
%16 = getelementptr inbounds i8, i8* %7, i64 1
%17 = icmp eq i32 %8, 0
br i1 %17, label %18, label %5
18: ; preds = %15, %2
ret void
}