#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*/ applyColor(int, int, int);
int atoi(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    printf("Wrong number of arguments.\n");
    return -1;
  }
  int i;
  for (i = 1; i < 4; i++) {
    if (atoi(argv[i]) < 0 || atoi(argv[i]) > 255) {
      printf("Color value(s) not in range 0-255.\n");
      return -1;
    }
  }
  int red = atoi(argv[1]);
  int green = atoi(argv[2]);
  int blue = atoi(argv[3]);
  applyColor(red, green, blue);
  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   $0x4,-0x8(%rbp)
jge    1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121f <main+0xef>
movl   $0x1,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    11da <main+0xaa>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
jl     11af <main+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
cmp    $0xff,%eax
jle    11c7 <main+0x97>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121f <main+0xef>
jmp    11cc <main+0x9c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <applyColor@plt>
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   %rbx
push   %rax
cmp    $0x4,%edi
jge    1145 <main+0x15>
lea    0xee0(%rip),%rdi
jmp    1185 <main+0x55>
mov    %rsi,%rbx
mov    0x8(%rsi),%r15
mov    %r15,%rdi
call   1050 <atoi@plt>
cmp    $0xff,%eax
ja     117e <main+0x4e>
mov    0x10(%rbx),%r14
mov    %r14,%rdi
call   1050 <atoi@plt>
cmp    $0xff,%eax
ja     117e <main+0x4e>
mov    0x18(%rbx),%rdi
call   1050 <atoi@plt>
cmp    $0xff,%eax
jbe    119a <main+0x6a>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    %r15,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %ebx,%edx
call   1040 <applyColor@plt>
xor    %eax,%eax
jmp    118f <main+0x5f>

LLVM IR (-O0):
@.str = [28 x i8] c"Wrong number of arguments.\0A\00"
@.str.1 = [36 x i8] c"Color value(s) not in range 0-255.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %57
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %37, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %40
18: ; preds = %15
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
%25 = icmp slt i32 %24, 0
br i1 %25, label %34, label %26
26: ; preds = %18
%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 = icmp sgt i32 %32, 255
br i1 %33, label %34, label %36
34: ; preds = %26, %18
%35 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %57
36: ; preds = %26
br label %37
37: ; preds = %36
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %15
40: ; preds = %15
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %7
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = call i32 @atoi(i8* %47)
store i32 %48, i32* %8
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 3
%51 = load i8*, i8** %50
%52 = call i32 @atoi(i8* %51)
store i32 %52, i32* %9
%53 = load i32, i32* %7
%54 = load i32, i32* %8
%55 = load i32, i32* %9
%56 = call i32 @applyColor(i32 %53, i32 %54, i32 %55)
store i32 0, i32* %3
br label %57
57: ; preds = %40, %34, %12
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
@str = [35 x i8] c"Color value(s) not in range 0-255.\00"
@str.2 = [27 x i8] c"Wrong number of arguments.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 4
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp ugt i32 %7, 255
br i1 %8, label %25, label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.2, i64 0, i64 0))
br label %27
11: ; preds = %4
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp ugt i32 %14, 255
br i1 %15, label %25, label %16
16: ; preds = %11
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = icmp ugt i32 %19, 255
br i1 %20, label %25, label %21
21: ; preds = %16
%22 = tail call i32 @atoi(i8* %6)
%23 = tail call i32 @atoi(i8* %13)
%24 = tail call i32 @applyColor(i32 %22, i32 %23, i32 %19)
br label %27
25: ; preds = %16, %11, %4
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %25, %21, %9
%28 = phi i32 [ -1, %9 ], [ -1, %25 ], [ 0, %21 ]
ret i32 %28
}