#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 */
char toupper(char);
char *supper(char *s) {
  static char su[80];
  int i;
  for (i = 0; s[i]; i++)
    su[i] = toupper(s[i]);
  su[i] = '\0';
  return su;
}


x86 assembly (clang, -O0):
<supper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1164 <supper+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
movslq -0xc(%rbp),%rcx
lea    0x2eed(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <supper+0x13>
movslq -0xc(%rbp),%rcx
lea    0x2ed1(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2ec6(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<supper>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     114e <supper+0x3e>
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0x2f19(%rip),%r15
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,(%rbx,%r15,1)
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <supper+0x20>
mov    %ebx,%ecx
jmp    1150 <supper+0x40>
xor    %ecx,%ecx
lea    0x2ee9(%rip),%rax
movb   $0x0,(%rcx,%rax,1)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@supper.su = internal global [80 x i8] zeroinitializer
define i8* @supper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = tail call signext i8 @toupper(i8 signext %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* @supper.su, i64 0, i64 %5
store i8 %7, i8* %8
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %1
%16 = phi i64 [ 0, %1 ], [ %14, %13 ]
%17 = getelementptr inbounds [80 x i8], [80 x i8]* @supper.su, i64 0, i64 %16
store i8 0, i8* %17
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @supper.su, i64 0, i64 0)
}