#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*/ str2upper(char *);
int strlen(char *);
void name2upper(char *s) {
  int i, l;
  l = strlen(s);
  for (i = 0; i < l; i++) {
    if (s[i] == '.')
      break;
  }
  if (i > 8 || l - i > 4)
    return;
  str2upper(s);
}


x86 assembly (clang, -O0):
<name2upper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1178 <name2upper+0x58>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    1165 <name2upper+0x45>
jmp    1178 <name2upper+0x58>
jmp    116a <name2upper+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <name2upper+0x1f>
cmpl   $0x8,-0xc(%rbp)
jg     1191 <name2upper+0x71>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x4,%eax
jle    1196 <name2upper+0x76>
jmp    119f <name2upper+0x7f>
mov    -0x8(%rbp),%rdi
call   1030 <str2upper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name2upper>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ecx
test   %eax,%eax
jle    1158 <name2upper+0x38>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x2e,(%rbx,%rax,1)
je     1151 <name2upper+0x31>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1140 <name2upper+0x20>
mov    %ecx,%eax
cmp    $0x8,%eax
jbe    115f <name2upper+0x3f>
jmp    116f <name2upper+0x4f>
xor    %eax,%eax
cmp    $0x8,%eax
ja     116f <name2upper+0x4f>
sub    %eax,%ecx
cmp    $0x4,%ecx
jg     116f <name2upper+0x4f>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <str2upper@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @name2upper(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
store i32 0, i32* %3
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%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 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 46
br i1 %18, label %19, label %20
19: ; preds = %11
br label %24
20: ; preds = %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %7
24: ; preds = %19, %7
%25 = load i32, i32* %3
%26 = icmp sgt i32 %25, 8
br i1 %26, label %32, label %27
27: ; preds = %24
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = sub nsw i32 %28, %29
%31 = icmp sgt i32 %30, 4
br i1 %31, label %32, label %33
32: ; preds = %27, %24
br label %36
33: ; preds = %27
%34 = load i8*, i8** %2
%35 = call i32 @str2upper(i8* %34)
br label %36
36: ; preds = %33, %32
ret void
}

LLVM IR (-O2):
define void @name2upper(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 46
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %16, label %6
14: ; preds = %6
%15 = trunc i64 %7 to i32
br label %16
16: ; preds = %11, %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ], [ %2, %11 ]
%18 = icmp ugt i32 %17, 8
%19 = sub nsw i32 %2, %17
%20 = icmp sgt i32 %19, 4
%21 = select i1 %18, i1 true, i1 %20
br i1 %21, label %24, label %22
22: ; preds = %16
%23 = tail call i32 @str2upper(i8* %0)
br label %24
24: ; preds = %16, %22
ret void
}