#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ isdigit(char);
scalar_t__ isupper(char);
char tolower(char);
void printxdigitlower(FILE *fh_out, int len, char *linein) {
  static int p, pd;
  static char lineout[128] = {};
  pd = 0;
  for (p = 0; p < len; p++) {
    if (isupper(linein[p])) {
      lineout[p] = tolower(linein[p]);
    } else {
      lineout[p] = linein[p];
    }
    if (isdigit(lineout[p])) {
      pd++;
    }
  }
  lineout[p] = 0;
  if (p != pd) {
    fprintf(fh_out, "%s\n", lineout);
  }
  return;
}


x86 assembly (clang, -O0):
<printxdigitlower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,0x2ef7(%rip)
movl   $0x0,0x2ee9(%rip)
mov    0x2ee3(%rip),%eax
cmp    -0xc(%rbp),%eax
jge    1228 <printxdigitlower+0xe8>
mov    -0x18(%rbp),%rax
movslq 0x2ecf(%rip),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     11c0 <printxdigitlower+0x80>
mov    -0x18(%rbp),%rax
movslq 0x2eb1(%rip),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <tolower@plt>
mov    %al,%dl
movslq 0x2e9f(%rip),%rcx
lea    0x2ea8(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    11df <printxdigitlower+0x9f>
mov    -0x18(%rbp),%rax
movslq 0x2e85(%rip),%rcx
mov    (%rax,%rcx,1),%dl
movslq 0x2e7b(%rip),%rcx
lea    0x2e84(%rip),%rax
mov    %dl,(%rax,%rcx,1)
movslq 0x2e6a(%rip),%rcx
lea    0x2e73(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     120f <printxdigitlower+0xcf>
mov    0x2e4e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e45(%rip)
jmp    1214 <printxdigitlower+0xd4>
mov    0x2e36(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e2d(%rip)
jmp    1167 <printxdigitlower+0x27>
movslq 0x2e21(%rip),%rcx
lea    0x2e2a(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
mov    0x2e10(%rip),%eax
cmp    0x2e0e(%rip),%eax
je     1263 <printxdigitlower+0x123>
mov    -0x8(%rbp),%rdi
lea    0xda9(%rip),%rsi
lea    0x2e02(%rip),%rdx
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printxdigitlower>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x2f03(%rip)
movl   $0x0,0x2ef5(%rip)
test   %esi,%esi
jle    1209 <printxdigitlower+0xc9>
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %eax,%eax
lea    0x2eec(%rip),%r15
jmp    1195 <printxdigitlower+0x55>
cs nopw 0x0(%rax,%rax,1)
movslq 0x2ec9(%rip),%rax
add    $0x1,%rax
mov    %eax,0x2ebf(%rip)
cmp    %ebp,%eax
jge    11dc <printxdigitlower+0x9c>
cltq
movsbl (%rbx,%rax,1),%edi
call   1060 <isupper@plt>
mov    %rax,%rcx
movslq 0x2ea6(%rip),%rdx
movzbl (%rbx,%rdx,1),%eax
test   %rcx,%rcx
je     11c2 <printxdigitlower+0x82>
movsbl %al,%edi
call   1050 <tolower@plt>
movslq 0x2e8e(%rip),%rdx
mov    %al,(%rdx,%r15,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1180 <printxdigitlower+0x40>
addl   $0x1,0x2e7a(%rip)
jmp    1180 <printxdigitlower+0x40>
movb   $0x0,(%rax,%r15,1)
cmp    0x2e6d(%rip),%eax
je     1210 <printxdigitlower+0xd0>
lea    0xe10(%rip),%rsi
lea    0x2e69(%rip),%rdx
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
movb   $0x0,0x2e50(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@printxdigitlower.p = internal global i32 0
@printxdigitlower.pd = internal global i32 0
@printxdigitlower.lineout = internal global [128 x i8] zeroinitializer
@.str = [4 x i8] c"%s\0A\00"
define void @printxdigitlower(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* @printxdigitlower.pd
store i32 0, i32* @printxdigitlower.p
br label %7
7: ; preds = %49, %3
%8 = load i32, i32* @printxdigitlower.p
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %52
11: ; preds = %7
%12 = load i8*, i8** %6
%13 = load i32, i32* @printxdigitlower.p
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call i64 @isupper(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %11
%20 = load i8*, i8** %6
%21 = load i32, i32* @printxdigitlower.p
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = call signext i8 @tolower(i8 signext %24)
%26 = load i32, i32* @printxdigitlower.p
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 %27
store i8 %25, i8* %28
br label %38
29: ; preds = %11
%30 = load i8*, i8** %6
%31 = load i32, i32* @printxdigitlower.p
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i32, i32* @printxdigitlower.p
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 %36
store i8 %34, i8* %37
br label %38
38: ; preds = %29, %19
%39 = load i32, i32* @printxdigitlower.p
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = call i64 @isdigit(i8 signext %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %38
%46 = load i32, i32* @printxdigitlower.pd
%47 = add nsw i32 %46, 1
store i32 %47, i32* @printxdigitlower.pd
br label %48
48: ; preds = %45, %38
br label %49
49: ; preds = %48
%50 = load i32, i32* @printxdigitlower.p
%51 = add nsw i32 %50, 1
store i32 %51, i32* @printxdigitlower.p
br label %7
52: ; preds = %7
%53 = load i32, i32* @printxdigitlower.p
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 %54
store i8 0, i8* %55
%56 = load i32, i32* @printxdigitlower.p
%57 = load i32, i32* @printxdigitlower.pd
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %62
59: ; preds = %52
%60 = load i32*, i32** %4
%61 = call i32 @fprintf(i32* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 0))
br label %62
62: ; preds = %59, %52
ret void
}

LLVM IR (-O2):
@printxdigitlower.p = internal unnamed_addr global i32 0
@printxdigitlower.pd = internal unnamed_addr global i32 0
@printxdigitlower.lineout = internal global [128 x i8] zeroinitializer
@.str = [4 x i8] c"%s\0A\00"
define void @printxdigitlower(i32* nocapture %0, i32 %1, i8* nocapture %2) {
store i32 0, i32* @printxdigitlower.pd
store i32 0, i32* @printxdigitlower.p
%4 = icmp sgt i32 %1, 0
br i1 %4, label %6, label %5
5: ; preds = %3
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 0)
br label %41
6: ; preds = %3, %30
%7 = phi i32 [ %32, %30 ], [ 0, %3 ]
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %2, i64 %8
%10 = load i8, i8* %9
%11 = tail call i64 @isupper(i8 signext %10)
%12 = icmp eq i64 %11, 0
%13 = load i32, i32* @printxdigitlower.p
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %2, i64 %14
%16 = load i8, i8* %15
br i1 %12, label %21, label %17
17: ; preds = %6
%18 = tail call signext i8 @tolower(i8 signext %16)
%19 = load i32, i32* @printxdigitlower.p
%20 = sext i32 %19 to i64
br label %21
21: ; preds = %6, %17
%22 = phi i64 [ %20, %17 ], [ %14, %6 ]
%23 = phi i8 [ %18, %17 ], [ %16, %6 ]
%24 = getelementptr inbounds [128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 %22
store i8 %23, i8* %24
%25 = tail call i64 @isdigit(i8 signext %23)
%26 = icmp eq i64 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %21
%28 = load i32, i32* @printxdigitlower.pd
%29 = add nsw i32 %28, 1
store i32 %29, i32* @printxdigitlower.pd
br label %30
30: ; preds = %21, %27
%31 = load i32, i32* @printxdigitlower.p
%32 = add nsw i32 %31, 1
store i32 %32, i32* @printxdigitlower.p
%33 = icmp slt i32 %32, %1
br i1 %33, label %6, label %34
34: ; preds = %30
%35 = load i32, i32* @printxdigitlower.pd
%36 = sext i32 %32 to i64
%37 = getelementptr inbounds [128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 %36
store i8 0, i8* %37
%38 = icmp eq i32 %32, %35
br i1 %38, label %41, label %39
39: ; preds = %34
%40 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([128 x i8], [128 x i8]* @printxdigitlower.lineout, i64 0, i64 0))
br label %41
41: ; preds = %5, %39, %34
ret void
}