#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 *, ...);
int strlen(char *);
void wypisz_linie_alt(char *linia, int nr_linii, int *indeksy,
                      int ilosc_indeksow, char *slowo) {
  int i, j;
  int dlugosc_slowa = strlen(slowo);
  int poczatek_slowa = *indeksy;
  int akt = 0;
  printf("%s", linia);
  for (i = 0; i < ilosc_indeksow; i++) {
    for (j = akt; j < poczatek_slowa; j++)
      printf(" ");
    for (j = poczatek_slowa; j < poczatek_slowa + dlugosc_slowa; j++)
      printf("~");
    akt = poczatek_slowa + dlugosc_slowa;
    indeksy++;
    poczatek_slowa = *indeksy;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<wypisz_linie_alt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1208 <wypisz_linie_alt+0xe8>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11a9 <wypisz_linie_alt+0x89>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1181 <wypisz_linie_alt+0x61>
mov    -0x38(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x38(%rbp),%ecx
add    -0x34(%rbp),%ecx
cmp    %ecx,%eax
jge    11dc <wypisz_linie_alt+0xbc>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11af <wypisz_linie_alt+0x8f>
mov    -0x38(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116f <wypisz_linie_alt+0x4f>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wypisz_linie_alt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %rdx,%r13
mov    %rdi,%r14
mov    %r8,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    0x0(%r13),%ebp
lea    0xea7(%rip),%rdi
xor    %r15d,%r15d
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,0x4(%rsp)
test   %ebx,%ebx
jle    11d4 <wypisz_linie_alt+0xa4>
xor    %ebx,%ebx
jmp    1191 <wypisz_linie_alt+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x4(%r13),%ebp
add    $0x4,%r13
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
je     11d4 <wypisz_linie_alt+0xa4>
cmp    %ebp,%r15d
jge    11b0 <wypisz_linie_alt+0x80>
mov    %ebp,%r14d
sub    %r15d,%r14d
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r14d
jne    11a0 <wypisz_linie_alt+0x70>
lea    (%r12,%rbp,1),%r15d
test   %r12d,%r12d
jle    1180 <wypisz_linie_alt+0x50>
nopl   0x0(%rax)
mov    $0x7e,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    %r15d,%ebp
jl     11c0 <wypisz_linie_alt+0x90>
jmp    1180 <wypisz_linie_alt+0x50>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @wypisz_linie_alt(i8* %0, i32 %1, i32* nocapture %2, i32 %3, i8* %4) {
%6 = tail call i32 @strlen(i8* %4)
%7 = load i32, i32* %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = icmp sgt i32 %3, 0
br i1 %9, label %10, label %35
10: ; preds = %5
%11 = icmp sgt i32 %6, 0
br label %12
12: ; preds = %10, %30
%13 = phi i32 [ %19, %30 ], [ 0, %10 ]
%14 = phi i32 [ %32, %30 ], [ %7, %10 ]
%15 = phi i32* [ %31, %30 ], [ %2, %10 ]
%16 = phi i32 [ %33, %30 ], [ 0, %10 ]
%17 = icmp slt i32 %13, %14
br i1 %17, label %20, label %18
18: ; preds = %20, %12
%19 = add nsw i32 %14, %6
br i1 %11, label %25, label %30
20: ; preds = %12, %20
%21 = phi i32 [ %23, %20 ], [ %13, %12 ]
%22 = tail call i32 @putchar(i32 32)
%23 = add i32 %21, 1
%24 = icmp eq i32 %23, %14
br i1 %24, label %18, label %20
25: ; preds = %18, %25
%26 = phi i32 [ %28, %25 ], [ %14, %18 ]
%27 = tail call i32 @putchar(i32 126)
%28 = add nsw i32 %26, 1
%29 = icmp slt i32 %28, %19
br i1 %29, label %25, label %30
30: ; preds = %25, %18
%31 = getelementptr inbounds i32, i32* %15, i64 1
%32 = load i32, i32* %31
%33 = add nuw nsw i32 %16, 1
%34 = icmp eq i32 %33, %3
br i1 %34, label %35, label %12
35: ; preds = %30, %5
%36 = tail call i32 @putchar(i32 10)
ret void
}