#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 EXIT_SUCCESS;
int /*<<< orphan*/ assert(char *);
char *malloc(size_t);
size_t strtoull(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  size_t nbytes, step;
  if (argc > 1) {
    nbytes = strtoull(argv[1], NULL, 0);
  } else {
    nbytes = 0x10;
  }
  if (argc > 2) {
    step = strtoull(argv[2], NULL, 0);
  } else {
    step = 1;
  }
  char *base = malloc(nbytes);
  assert(base);
  char *i = base;
  while (i < base + nbytes) {
    *i = 13;
    i += step;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <strtoull@plt>
mov    %rax,-0x18(%rbp)
jmp    1174 <main+0x44>
movq   $0x10,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    119a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <strtoull@plt>
mov    %rax,-0x20(%rbp)
jmp    11a2 <main+0x72>
movq   $0x1,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jae    11ed <main+0xbd>
mov    -0x30(%rbp),%rax
movb   $0xd,(%rax)
mov    -0x20(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    11c0 <main+0x90>
mov    0x2dec(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
mov    $0x10,%r15d
cmp    $0x2,%edi
jl     1172 <main+0x42>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <strtoull@plt>
mov    %rax,%r15
cmp    $0x2,%ebp
je     1172 <main+0x42>
mov    0x10(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <strtoull@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <assert@plt>
test   %r15,%r15
jle    119b <main+0x6b>
add    %rbx,%r15
nopl   (%rax)
movb   $0xd,(%rbx)
add    %r14,%rbx
cmp    %r15,%rbx
jb     1190 <main+0x60>
mov    0x2e3e(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strtoull(i8* %15, i32* null, i32 0)
store i64 %16, i64* %6
br label %18
17: ; preds = %2
store i64 16, i64* %6
br label %18
18: ; preds = %17, %12
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 2
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i64 @strtoull(i8* %24, i32* null, i32 0)
store i64 %25, i64* %7
br label %27
26: ; preds = %18
store i64 1, i64* %7
br label %27
27: ; preds = %26, %21
%28 = load i64, i64* %6
%29 = call i8* @malloc(i64 %28)
store i8* %29, i8** %8
%30 = load i8*, i8** %8
%31 = call i32 @assert(i8* %30)
%32 = load i8*, i8** %8
store i8* %32, i8** %9
br label %33
33: ; preds = %39, %27
%34 = load i8*, i8** %9
%35 = load i8*, i8** %8
%36 = load i64, i64* %6
%37 = getelementptr inbounds i8, i8* %35, i64 %36
%38 = icmp ult i8* %34, %37
br i1 %38, label %39, label %44
39: ; preds = %33
%40 = load i8*, i8** %9
store i8 13, i8* %40
%41 = load i64, i64* %7
%42 = load i8*, i8** %9
%43 = getelementptr inbounds i8, i8* %42, i64 %41
store i8* %43, i8** %9
br label %33
44: ; preds = %33
%45 = load i32, i32* @EXIT_SUCCESS
ret i32 %45
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strtoull(i8* nocapture %6, i32* null, i32 0)
%8 = icmp eq i32 %0, 2
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i64 @strtoull(i8* nocapture %11, i32* null, i32 0)
br label %13
13: ; preds = %2, %4, %9
%14 = phi i64 [ %7, %9 ], [ %7, %4 ], [ 16, %2 ]
%15 = phi i64 [ %12, %9 ], [ 1, %4 ], [ 1, %2 ]
%16 = tail call i8* @malloc(i64 %14)
%17 = tail call i32 @assert(i8* %16)
%18 = getelementptr inbounds i8, i8* %16, i64 %14
%19 = icmp sgt i64 %14, 0
br i1 %19, label %20, label %24
20: ; preds = %13, %20
%21 = phi i8* [ %22, %20 ], [ %16, %13 ]
store i8 13, i8* %21
%22 = getelementptr inbounds i8, i8* %21, i64 %15
%23 = icmp ult i8* %22, %18
br i1 %23, label %20, label %24
24: ; preds = %20, %13
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}