#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 */
void my_fun(char *p) {
  if (p == NULL)
    return;
  for (; *p != '\0'; p++)
    if (*p >= 'A' && *p <= 'Z')
      *p = *p - 'A' + 'a';
}


x86 assembly (clang, -O0):
<my_fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1118 <my_fun+0x18>
jmp    1178 <my_fun+0x78>
jmp    111d <my_fun+0x1d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1178 <my_fun+0x78>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1162 <my_fun+0x62>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     1162 <my_fun+0x62>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1167 <my_fun+0x67>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111d <my_fun+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_fun>:
test   %rdi,%rdi
je     113a <my_fun+0x3a>
mov    (%rdi),%al
test   %al,%al
je     113a <my_fun+0x3a>
add    $0x1,%rdi
jmp    112b <my_fun+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     113a <my_fun+0x3a>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1120 <my_fun+0x20>
add    $0x20,%al
mov    %al,-0x1(%rdi)
jmp    1120 <my_fun+0x20>
ret

LLVM IR (-O0):
define void @my_fun(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %34
6: ; preds = %1
br label %7
7: ; preds = %31, %6
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 65
br i1 %16, label %17, label %30
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sle i32 %20, 90
br i1 %21, label %22, label %30
22: ; preds = %17
%23 = load i8*, i8** %2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 65
%27 = add nsw i32 %26, 97
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %2
store i8 %28, i8* %29
br label %30
30: ; preds = %22, %17, %12
br label %31
31: ; preds = %30
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %2
br label %7
34: ; preds = %5, %7
ret void
}

LLVM IR (-O2):
define void @my_fun(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3, %13
%7 = phi i8 [ %15, %13 ], [ %4, %3 ]
%8 = phi i8* [ %14, %13 ], [ %0, %3 ]
%9 = add i8 %7, -65
%10 = icmp ult i8 %9, 26
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = add nuw nsw i8 %7, 32
store i8 %12, i8* %8
br label %13
13: ; preds = %6, %11
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %13, %3, %1
ret void
}