#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 */
char *expandSeconds(char *, int);
int /*<<< orphan*/ free(char *);
scalar_t__ lrand48();
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ srand48(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  srand48(time(NULL));
  size_t i = 0;
  while (i <= 149999) {
    char *s = malloc(1);
    s = expandSeconds(s, (int)lrand48());
    printf("%s\n", s);
    free(s);
    i++;
  }
  return (0);
}


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)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1090 <srand48@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0x249ef,-0x18(%rbp)
ja     1202 <main+0x92>
mov    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1080 <lrand48@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1060 <expandSeconds@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    119e <main+0x2e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1090 <srand48@plt>
mov    $0x249f0,%ebx
lea    0xe71(%rip),%r14
nop
mov    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1080 <lrand48@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1060 <expandSeconds@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0xffffffffffffffff,%rbx
jne    1190 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @time(i32* null)
%9 = call i32 @srand48(i32 %8)
store i64 0, i64* %6
br label %10
10: ; preds = %13, %2
%11 = load i64, i64* %6
%12 = icmp ule i64 %11, 149999
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = call i8* @malloc(i32 1)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = call i64 (...) @lrand48()
%17 = trunc i64 %16 to i32
%18 = call i8* @expandSeconds(i8* %15, i32 %17)
store i8* %18, i8** %7
%19 = load i8*, i8** %7
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %7
%22 = call i32 @free(i8* %21)
%23 = load i64, i64* %6
%24 = add i64 %23, 1
store i64 %24, i64* %6
br label %10
25: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand48(i32 %3)
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %13, %5 ]
%7 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%8 = tail call i64 (...) @lrand48()
%9 = trunc i64 %8 to i32
%10 = tail call i8* @expandSeconds(i8* %7, i32 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @free(i8* %10)
%13 = add nuw nsw i64 %6, 1
%14 = icmp eq i64 %13, 150000
br i1 %14, label %15, label %5
15: ; preds = %5
ret i32 0
}