#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 INT_MAX;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
int main() {
  int i = 0;
  while (i < INT_MAX) {
    char buffer[100] = "";
    sprintf(buffer, "pathping xxx.xxx.xxx.xxx > %d.txt\n", i++);
    printf(buffer);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
jge    1191 <main+0x61>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe82(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    0x2eb7(%rip),%r15
cmpl   $0x0,(%r15)
jle    1195 <main+0x75>
xor    %edx,%edx
lea    0xec0(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0x1(%rdx),%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %ebp,%edx
cmp    (%r15),%ebp
jl     1150 <main+0x30>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
@.str = [35 x i8] c"pathping xxx.xxx.xxx.xxx > %d.txt\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = load i32, i32* @INT_MAX
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = bitcast [100 x i8]* %3 to i8*
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
%13 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %11)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%15 = call i32 @printf(i8* %14)
br label %4
16: ; preds = %4
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@INT_MAX = global i32 0
@.str = [35 x i8] c"pathping xxx.xxx.xxx.xxx > %d.txt\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = load i32, i32* @INT_MAX
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %8, %6 ]
%8 = add nuw nsw i32 %7, 1
%9 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %7)
%10 = call i32 @printf(i8* %5)
%11 = load i32, i32* @INT_MAX
%12 = icmp slt i32 %8, %11
br i1 %12, label %6, label %13
13: ; preds = %6, %0
ret i32 0
}