#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*/ printf(char *, char *);
char *split(char *, int, int);
int main() {
  char s[20] = "1234567890123456789";
  char *aa;
  int i;
  for (i = 0; i < 4; i++) {
    aa = split(s, 4, 4 * i);
    printf("%s\n", aa);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jge    1195 <main+0x75>
lea    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
shl    $0x2,%edx
mov    $0x4,%esi
call   1040 <split@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1155 <main+0x35>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x393837,0x10(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
xor    %edx,%edx
call   1040 <split@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <split@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <split@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0xc,%edx
call   1040 <split@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s = [20 x i8] c"1234567890123456789\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [20 x i8]* %2 to i8*
store i32 0, i32* %4
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* %4
%12 = mul nsw i32 4, %11
%13 = call i8* @split(i8* %10, i32 4, i32 %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [20 x i8] c"1234567890123456789\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i8* @split(i8* %2, i32 4, i32 0)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i8* @split(i8* %2, i32 4, i32 4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i8* @split(i8* %2, i32 4, i32 8)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i8* @split(i8* %2, i32 4, i32 12)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}