#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int pid_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ getpid();
int kill(int, int);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int kill_childs(pid_t *childs_id) {
  int exit_status = EXIT_SUCCESS;
  for (pid_t *iterator = childs_id; *iterator; iterator++) {
    printf("%d will killed next\n", *iterator);
    if (kill(*iterator, 9) == -1) {
      {
        char __tb[101];
        time_t t = time(NULL);
        struct tm *tmp = localtime(&t);
        strftime(__tb, 100, "%d/%m/%Y %H:%M:%S ", tmp);
        printf("%s [pid=%d]", __tb, (int)getpid());
        printf("\x1b[31m");
        printf(" ERROR! ");
        printf("\x1b[0m");
        printf("process with id=%d was not killed correctly", (int)(*iterator));
        printf(" (%s)\n", strerror(errno));
        fflush(stdout);
      };
      exit_status = EXIT_FAILURE;
    } else {
      {
        char __tb[101];
        time_t t = time(NULL);
        struct tm *tmp = localtime(&t);
        strftime(__tb, 100, "%d/%m/%Y %H:%M:%S ", tmp);
        printf("%s [pid=%d] ", __tb, (int)getpid());
        printf("process with id=%d was killed", (int)(*iterator));
        printf("\n");
        fflush(stdout);
      };
    }
  }
  return exit_status;
}


x86 assembly (clang, -O0):
<kill_childs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     1373 <kill_childs+0x1f3>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    $0x9,%esi
call   1060 <kill@plt>
cmp    $0xffffffff,%eax
jne    12c0 <kill_childs+0x140>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x84(%rbp)
lea    -0x84(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x90(%rbp),%rcx
mov    $0x64,%esi
lea    0xdff(%rip),%rdx
call   1090 <strftime@plt>
lea    -0x80(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x118(%rbp),%rsi
mov    %eax,%edx
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d57(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    %rax,%rsi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    135d <kill_childs+0x1dd>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x104(%rbp)
lea    -0x104(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x110(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x110(%rbp),%rcx
mov    $0x64,%esi
lea    0xd19(%rip),%rdx
call   1090 <strftime@plt>
lea    -0x100(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x120(%rbp),%rsi
mov    %eax,%edx
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd31(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1362 <kill_childs+0x1e2>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    11a3 <kill_childs+0x23>
mov    -0xc(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_childs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    0x2e23(%rip),%rax
mov    (%rax),%ebp
mov    (%rdi),%esi
test   %esi,%esi
je     1311 <kill_childs+0x181>
mov    %rdi,%rbx
lea    0xc(%rsp),%r15
lea    0xe55(%rip),%r12
lea    0x10(%rsp),%r13
mov    0x2e04(%rip),%r14
jmp    123f <kill_childs+0xaf>
xchg   %ax,%ax
call   1080 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r15,%rdi
call   1040 <localtime@plt>
mov    %r13,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
mov    %rax,%rcx
call   10a0 <strftime@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xe79(%rip),%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%esi
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r14),%edi
call   1090 <fflush@plt>
mov    0x4(%rbx),%esi
add    $0x4,%rbx
test   %esi,%esi
je     1311 <kill_childs+0x181>
lea    0xdba(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%edi
mov    $0x9,%esi
call   1070 <kill@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
jne    11d0 <kill_childs+0x40>
call   1080 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r15,%rdi
call   1040 <localtime@plt>
mov    %r13,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
mov    %rax,%rcx
call   10a0 <strftime@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xd92(%rip),%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd83(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd7e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%esi
lea    0xd73(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd83(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%r14),%edi
call   1090 <fflush@plt>
mov    0x2cce(%rip),%rax
mov    (%rax),%ebp
jmp    1230 <kill_childs+0xa0>
mov    %ebp,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@EXIT_SUCCESS = global i32 0
@.str = [21 x i8] c"%d will killed next\0A\00"
@.str.1 = [19 x i8] c"%d/%m/%Y %H:%M:%S \00"
@.str.2 = [12 x i8] c"%s [pid=%d]\00"
@.str.3 = [6 x i8] c"\1B[31m\00"
@.str.4 = [9 x i8] c" ERROR! \00"
@.str.5 = [5 x i8] c"\1B[0m\00"
@.str.6 = [44 x i8] c"process with id=%d was not killed correctly\00"
@.str.7 = [7 x i8] c" (%s)\0A\00"
@errno = global i32 0
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
@.str.8 = [13 x i8] c"%s [pid=%d] \00"
@.str.9 = [30 x i8] c"process with id=%d was killed\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @kill_childs(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [101 x i8]
%6 = alloca i32
%7 = alloca %struct.tm*
%8 = alloca [101 x i8]
%9 = alloca i32
%10 = alloca %struct.tm*
store i32* %0, i32** %2
%11 = load i32, i32* @EXIT_SUCCESS
store i32 %11, i32* %3
%12 = load i32*, i32** %2
store i32* %12, i32** %4
br label %13
13: ; preds = %64, %1
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %67
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = call i32 @kill(i32 %22, i32 9)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %47
25: ; preds = %17
%26 = call i32 @time(i32* null)
store i32 %26, i32* %6
%27 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %27, %struct.tm** %7
%28 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%29 = load %struct.tm*, %struct.tm** %7
%30 = call i32 @strftime(i8* %28, i32 100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %29)
%31 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%32 = call i64 (...) @getpid()
%33 = trunc i64 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %31, i32 %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32*, i32** %4
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %39)
%41 = load i32, i32* @errno
%42 = call i8* @strerror(i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %42)
%44 = load i32, i32* @stdout
%45 = call i32 @fflush(i32 %44)
%46 = load i32, i32* @EXIT_FAILURE
store i32 %46, i32* %3
br label %63
47: ; preds = %17
%48 = call i32 @time(i32* null)
store i32 %48, i32* %9
%49 = call %struct.tm* @localtime(i32* %9)
store %struct.tm* %49, %struct.tm** %10
%50 = getelementptr inbounds [101 x i8], [101 x i8]* %8, i64 0, i64 0
%51 = load %struct.tm*, %struct.tm** %10
%52 = call i32 @strftime(i8* %50, i32 100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %51)
%53 = getelementptr inbounds [101 x i8], [101 x i8]* %8, i64 0, i64 0
%54 = call i64 (...) @getpid()
%55 = trunc i64 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %53, i32 %55)
%57 = load i32*, i32** %4
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%61 = load i32, i32* @stdout
%62 = call i32 @fflush(i32 %61)
br label %63
63: ; preds = %47, %25
br label %64
64: ; preds = %63
%65 = load i32*, i32** %4
%66 = getelementptr inbounds i32, i32* %65, i32 1
store i32* %66, i32** %4
br label %13
67: ; preds = %13
%68 = load i32, i32* %3
ret i32 %68
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@EXIT_SUCCESS = global i32 0
@.str = [21 x i8] c"%d will killed next\0A\00"
@.str.1 = [19 x i8] c"%d/%m/%Y %H:%M:%S \00"
@.str.2 = [12 x i8] c"%s [pid=%d]\00"
@.str.3 = [6 x i8] c"\1B[31m\00"
@.str.4 = [9 x i8] c" ERROR! \00"
@.str.5 = [5 x i8] c"\1B[0m\00"
@.str.6 = [44 x i8] c"process with id=%d was not killed correctly\00"
@.str.7 = [7 x i8] c" (%s)\0A\00"
@errno = global i32 0
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
@.str.8 = [13 x i8] c"%s [pid=%d] \00"
@.str.9 = [30 x i8] c"process with id=%d was killed\00"
define i32 @kill_childs(i32* nocapture %0) {
%2 = alloca [101 x i8]
%3 = alloca i32
%4 = alloca [101 x i8]
%5 = alloca i32
%6 = load i32, i32* @EXIT_SUCCESS
%7 = load i32, i32* %0
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%11 = bitcast i32* %5 to i8*
%12 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%13 = bitcast i32* %3 to i8*
br label %16
14: ; preds = %54, %1
%15 = phi i32 [ %6, %1 ], [ %55, %54 ]
ret i32 %15
16: ; preds = %9, %54
%17 = phi i32 [ %7, %9 ], [ %57, %54 ]
%18 = phi i32 [ %6, %9 ], [ %55, %54 ]
%19 = phi i32* [ %0, %9 ], [ %56, %54 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %17)
%21 = load i32, i32* %19
%22 = call i32 @kill(i32 %21, i32 9)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %42
24: ; preds = %16
%25 = call i32 @time(i32* null)
store i32 %25, i32* %3
%26 = call %struct.tm* @localtime(i32* %3)
%27 = call i32 @strftime(i8* %12, i32 100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %26)
%28 = call i64 (...) @getpid()
%29 = trunc i64 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %12, i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* %19
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i32 %34)
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %37)
%39 = load i32, i32* @stdout
%40 = call i32 @fflush(i32 %39)
%41 = load i32, i32* @EXIT_FAILURE
br label %54
42: ; preds = %16
%43 = call i32 @time(i32* null)
store i32 %43, i32* %5
%44 = call %struct.tm* @localtime(i32* %5)
%45 = call i32 @strftime(i8* %10, i32 100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %44)
%46 = call i64 (...) @getpid()
%47 = trunc i64 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %10, i32 %47)
%49 = load i32, i32* %19
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %49)
%51 = call i32 @putchar(i32 10)
%52 = load i32, i32* @stdout
%53 = call i32 @fflush(i32 %52)
br label %54
54: ; preds = %24, %42
%55 = phi i32 [ %41, %24 ], [ %18, %42 ]
%56 = getelementptr inbounds i32, i32* %19, i64 1
%57 = load i32, i32* %56
%58 = icmp eq i32 %57, 0
br i1 %58, label %14, label %16
}