#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 *);
int /*<<< orphan*/ memcpy(char **, char *, int);
void printdigitsweep(FILE *fh_out, int slen, int len, char *linein) {
  static int l;
  static char lineout[128] = {};
  if (len >= slen) {
    for (l = 0; l <= len - slen; l++) {
      memcpy(&lineout, &linein[l], slen);
      lineout[slen] = 0;
      fprintf(fh_out, "%s\n", lineout);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<printdigitsweep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11bc <printdigitsweep+0x9c>
movl   $0x0,0x2ef4(%rip)
mov    0x2eee(%rip),%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     11b7 <printdigitsweep+0x97>
mov    -0x18(%rbp),%rsi
movslq 0x2ed5(%rip),%rax
add    %rax,%rsi
mov    -0xc(%rbp),%edx
lea    0x2ed8(%rip),%rdi
call   1040 <memcpy@plt>
movslq -0xc(%rbp),%rcx
lea    0x2ec8(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
lea    0xe69(%rip),%rsi
lea    0x2eb2(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e97(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e8e(%rip)
jmp    114c <printdigitsweep+0x2c>
jmp    11bc <printdigitsweep+0x9c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printdigitsweep>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
sub    %esi,%ebp
jl     119c <printdigitsweep+0x7c>
movl   $0x0,0x2f05(%rip)
js     119c <printdigitsweep+0x7c>
mov    %rcx,%r14
mov    %esi,%r12d
mov    %rdi,%r15
movslq %esi,%r13
xor    %eax,%eax
lea    0x2efe(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %eax,%rsi
add    %r14,%rsi
mov    %rbx,%rdi
mov    %r12d,%edx
call   1040 <memcpy@plt>
movb   $0x0,0x0(%r13,%rbx,1)
mov    %r15,%rdi
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    0x2eb1(%rip),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0x2ea8(%rip)
cmp    %ebp,%ecx
jl     1160 <printdigitsweep+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@printdigitsweep.l = internal global i32 0
@printdigitsweep.lineout = internal global [128 x i8] zeroinitializer
@.str = [4 x i8] c"%s\0A\00"
define void @printdigitsweep(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp sge i32 %9, %10
br i1 %11, label %12, label %35
12: ; preds = %4
store i32 0, i32* @printdigitsweep.l
br label %13
13: ; preds = %31, %12
%14 = load i32, i32* @printdigitsweep.l
%15 = load i32, i32* %7
%16 = load i32, i32* %6
%17 = sub nsw i32 %15, %16
%18 = icmp sle i32 %14, %17
br i1 %18, label %19, label %34
19: ; preds = %13
%20 = load i8*, i8** %8
%21 = load i32, i32* @printdigitsweep.l
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i32, i32* %6
%25 = call i32 @memcpy(i8** bitcast ([128 x i8]* @printdigitsweep.lineout to i8**), i8* %23, i32 %24)
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [128 x i8], [128 x i8]* @printdigitsweep.lineout, i64 0, i64 %27
store i8 0, i8* %28
%29 = load i32*, i32** %5
%30 = call i32 @fprintf(i32* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([128 x i8], [128 x i8]* @printdigitsweep.lineout, i64 0, i64 0))
br label %31
31: ; preds = %19
%32 = load i32, i32* @printdigitsweep.l
%33 = add nsw i32 %32, 1
store i32 %33, i32* @printdigitsweep.l
br label %13
34: ; preds = %13
br label %35
35: ; preds = %34, %4
ret void
}

LLVM IR (-O2):
@printdigitsweep.l = internal unnamed_addr global i32 0
@printdigitsweep.lineout = internal global [128 x i8] zeroinitializer
@.str = [4 x i8] c"%s\0A\00"
define void @printdigitsweep(i32* nocapture %0, i32 %1, i32 %2, i8* %3) {
%5 = icmp slt i32 %2, %1
br i1 %5, label %21, label %6
6: ; preds = %4
%7 = sub nsw i32 %2, %1
store i32 0, i32* @printdigitsweep.l
%8 = icmp slt i32 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %6
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds [128 x i8], [128 x i8]* @printdigitsweep.lineout, i64 0, i64 %10
br label %12
12: ; preds = %9, %12
%13 = phi i32 [ 0, %9 ], [ %19, %12 ]
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %3, i64 %14
%16 = tail call i32 @memcpy(i8** bitcast ([128 x i8]* @printdigitsweep.lineout to i8**), i8* %15, i32 %1)
store i8 0, i8* %11
%17 = 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]* @printdigitsweep.lineout, i64 0, i64 0))
%18 = load i32, i32* @printdigitsweep.l
%19 = add nsw i32 %18, 1
store i32 %19, i32* @printdigitsweep.l
%20 = icmp slt i32 %18, %7
br i1 %20, label %12, label %21
21: ; preds = %12, %6, %4
ret void
}