#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*/ show_help(char *);
int sscanf(char *, char *, int *);
int parse_arguments(int argc, char **argv, int *r, int *g, int *b) {
  if (argc != 4) {
    show_help("wrong number of arguments");
    return 0;
  }
  if (sscanf(argv[1], "%d", r) != 1) {
    show_help("red brightness error");
    return 0;
  }
  if (sscanf(argv[2], "%d", g) != 1) {
    show_help("green brightness error");
    return 0;
  }
  if (sscanf(argv[3], "%d", b) != 1) {
    show_help("blue brightness error");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<parse_arguments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     115d <parse_arguments+0x3d>
lea    0xeb4(%rip),%rdi
call   1030 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    120f <parse_arguments+0xef>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeaa(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1196 <parse_arguments+0x76>
lea    0xe98(%rip),%rdi
call   1030 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    120f <parse_arguments+0xef>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe71(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     11cf <parse_arguments+0xaf>
lea    0xe74(%rip),%rdi
call   1030 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    120f <parse_arguments+0xef>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe38(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1208 <parse_arguments+0xe8>
lea    0xe52(%rip),%rdi
call   1030 <show_help@plt>
movl   $0x0,-0x4(%rbp)
jmp    120f <parse_arguments+0xef>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_arguments>:
push   %r15
push   %r14
push   %rbx
cmp    $0x4,%edi
jne    1188 <parse_arguments+0x68>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xedc(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1191 <parse_arguments+0x71>
mov    0x10(%rbx),%rdi
lea    0xec7(%rip),%rsi
mov    %r15,%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    119a <parse_arguments+0x7a>
mov    0x18(%rbx),%rdi
lea    0xeaf(%rip),%rsi
mov    %r14,%rdx
call   1040 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     11a8 <parse_arguments+0x88>
lea    0xec3(%rip),%rdi
jmp    11a1 <parse_arguments+0x81>
lea    0xe71(%rip),%rdi
jmp    11a1 <parse_arguments+0x81>
lea    0xe85(%rip),%rdi
jmp    11a1 <parse_arguments+0x81>
lea    0xe91(%rip),%rdi
call   1030 <show_help@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"wrong number of arguments\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"red brightness error\00"
@.str.3 = [23 x i8] c"green brightness error\00"
@.str.4 = [22 x i8] c"blue brightness error\00"
define i32 @parse_arguments(i32 %0, i8** %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %16
14: ; preds = %5
%15 = call i32 @show_help(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %44
16: ; preds = %5
%17 = load i8**, i8*** %8
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = load i32*, i32** %9
%21 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = icmp ne i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %16
%24 = call i32 @show_help(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %44
25: ; preds = %16
%26 = load i8**, i8*** %8
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = load i32*, i32** %10
%30 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %29)
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 @show_help(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %44
34: ; preds = %25
%35 = load i8**, i8*** %8
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = load i32*, i32** %11
%39 = call i32 @sscanf(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %38)
%40 = icmp ne i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %34
%42 = call i32 @show_help(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %6
br label %44
43: ; preds = %34
store i32 1, i32* %6
br label %44
44: ; preds = %43, %41, %32, %23, %14
%45 = load i32, i32* %6
ret i32 %45
}

LLVM IR (-O2):
@.str = [26 x i8] c"wrong number of arguments\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"red brightness error\00"
@.str.3 = [23 x i8] c"green brightness error\00"
@.str.4 = [22 x i8] c"blue brightness error\00"
define i32 @parse_arguments(i32 %0, i8** nocapture %1, i32* %2, i32* %3, i32* %4) {
%6 = icmp eq i32 %0, 4
br i1 %6, label %7, label %22
7: ; preds = %5
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%21 = icmp eq i32 %20, 1
br i1 %21, label %25, label %22
22: ; preds = %17, %12, %7, %5
%23 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), %5 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %12 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), %17 ]
%24 = tail call i32 @show_help(i8* %23)
br label %25
25: ; preds = %22, %17
%26 = phi i32 [ 1, %17 ], [ 0, %22 ]
ret i32 %26
}