#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*/ SIGTERM;
int atoi(char *);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i;
  if (argc < 2) {
    printf("Usage: %s pid...\n", argv[0]);
    return 1;
  }
  for (i = 1; i < argc; i++) {
    printf("Sending SIGTERM to %d\n", atoi(argv[i]));
    kill(atoi(argv[i]), SIGTERM);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1171 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11db <main+0xab>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d4 <main+0xa4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <main+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
cmp    $0x2,%edi
jge    115c <main+0x2c>
mov    (%r12),%rsi
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
jmp    11b2 <main+0x82>
mov    %edi,%r15d
mov    $0x1,%ebx
lea    0xea7(%rip),%r14
mov    0x2e76(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r12,%rbx,8),%rdi
call   1050 <atoi@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r12,%rbx,8),%rdi
call   1050 <atoi@plt>
mov    0x0(%r13),%esi
mov    %eax,%edi
call   1040 <kill@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x50>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s pid...\0A\00"
@.str.1 = [23 x i8] c"Sending SIGTERM to %d\0A\00"
@SIGTERM = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 1, i32* %3
br label %39
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %35, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %38
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i8**, i8*** %5
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
%33 = load i32, i32* @SIGTERM
%34 = call i32 @kill(i32 %32, i32 %33)
br label %35
35: ; preds = %19
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %15
38: ; preds = %15
store i32 0, i32* %3
br label %39
39: ; preds = %38, %9
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s pid...\0A\00"
@.str.1 = [23 x i8] c"Sending SIGTERM to %d\0A\00"
@SIGTERM = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %21
9: ; preds = %4, %9
%10 = phi i64 [ 1, %4 ], [ %19, %9 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i8*, i8** %11
%16 = tail call i32 @atoi(i8* %15)
%17 = load i32, i32* @SIGTERM
%18 = tail call i32 @kill(i32 %16, i32 %17)
%19 = add nuw nsw i64 %10, 1
%20 = icmp eq i64 %19, %5
br i1 %20, label %21, label %9
21: ; preds = %9, %6
%22 = phi i32 [ 1, %6 ], [ 0, %9 ]
ret i32 %22
}