#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 const *, unsigned long);
int /*<<< orphan*/ version();
do_ping(const char *host_to_ping) {
  unsigned long seq = 0;
  unsigned long dl;
  unsigned long count;
  version();
  printf("PING %s: 56 data bytes, MAX %lu packets will be sent\n", host_to_ping,
         100);
  for (count = 0; count <= 100; count++) {
    printf("64 bytes from %s: icmp_seq=%lu ttl=255 time=0.718 ms\n",
           host_to_ping, seq);
    seq++;
    for (dl = 0; dl < 300000; dl++)
      ;
  }
}


x86 assembly (clang, -O0):
<do_ping>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <version@plt>
mov    -0x10(%rbp),%rsi
lea    0xeba(%rip),%rdi
mov    $0x64,%edx
call   1030 <printf@plt>
movq   $0x0,-0x28(%rbp)
cmpq   $0x64,-0x28(%rbp)
ja     11c5 <do_ping+0xa5>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x493e0,-0x20(%rbp)
jae    11af <do_ping+0x8f>
jmp    119e <do_ping+0x7e>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    118b <do_ping+0x6b>
jmp    11b4 <do_ping+0x94>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1158 <do_ping+0x38>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_ping>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <version@plt>
lea    0xec8(%rip),%rdi
mov    $0x64,%edx
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0xeea(%rip),%r15
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1150 <do_ping+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [54 x i8] c"PING %s: 56 data bytes, MAX %lu packets will be sent\0A\00"
@.str.1 = [54 x i8] c"64 bytes from %s: icmp_seq=%lu ttl=255 time=0.718 ms\0A\00"
define i32 @do_ping(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* %4
%7 = call i32 (...) @version()
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %8, i64 100)
store i64 0, i64* %6
br label %10
10: ; preds = %27, %1
%11 = load i64, i64* %6
%12 = icmp ule i64 %11, 100
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = load i64, i64* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8* %14, i64 %15)
%17 = load i64, i64* %4
%18 = add i64 %17, 1
store i64 %18, i64* %4
store i64 0, i64* %5
br label %19
19: ; preds = %23, %13
%20 = load i64, i64* %5
%21 = icmp ult i64 %20, 300000
br i1 %21, label %22, label %26
22: ; preds = %19
br label %23
23: ; preds = %22
%24 = load i64, i64* %5
%25 = add i64 %24, 1
store i64 %25, i64* %5
br label %19
26: ; preds = %19
br label %27
27: ; preds = %26
%28 = load i64, i64* %6
%29 = add i64 %28, 1
store i64 %29, i64* %6
br label %10
30: ; preds = %10
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [54 x i8] c"PING %s: 56 data bytes, MAX %lu packets will be sent\0A\00"
@.str.1 = [54 x i8] c"64 bytes from %s: icmp_seq=%lu ttl=255 time=0.718 ms\0A\00"
define i32 @do_ping(i8* %0) {
%2 = tail call i32 (...) @version()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i8* %0, i64 100)
br label %4
4: ; preds = %1, %4
%5 = phi i64 [ 0, %1 ], [ %7, %4 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8* %0, i64 %5)
%7 = add nuw nsw i64 %5, 1
%8 = icmp eq i64 %7, 101
br i1 %8, label %9, label %4
9: ; preds = %4
ret i32 undef
}