#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 getopt(int, char **, char *);
char *optarg;
int optind;
int /*<<< orphan*/ printUsage();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int ch = 0;
  while ((ch = getopt(argc, argv, ":a:b::c:d")) != -1) {
    switch (ch) {
    case 'a':
      printf("%d %s\n", optind, optarg);
      break;
    case 'b':
      printf("%d %s\n", optind, optarg);
      break;
    case 'c':
      printf("%d %s\n", optind, optarg);
      break;
    case ':':
      printf("absence argument option!\n");
      break;
    case '?':
      printf("invalid argument!\n");
      printUsage();
      break;
    }
  }
  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)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf4d(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1234 <main+0x104>
mov    -0x14(%rbp),%eax
add    $0xffffffc6,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x29,%eax
ja     122f <main+0xff>
mov    -0x20(%rbp),%rax
lea    0xe74(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
mov    0x2e53(%rip),%rax
mov    (%rax),%rdx
lea    0xf03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0xff>
mov    0x2e1e(%rip),%rax
mov    (%rax),%esi
mov    0x2e2d(%rip),%rax
mov    (%rax),%rdx
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0xff>
mov    0x2df8(%rip),%rax
mov    (%rax),%esi
mov    0x2e07(%rip),%rax
mov    (%rax),%rdx
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0xff>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0xff>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <printUsage@plt>
jmp    114d <main+0x1d>
xor    %eax,%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,%rbx
mov    %edi,%ebp
lea    0xf51(%rip),%r14
lea    0xea2(%rip),%r15
mov    0x2e93(%rip),%r12
lea    0xf46(%rip),%r13
jmp    1190 <main+0x50>
lea    0xf44(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <printUsage@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1060 <getopt@plt>
lea    -0x3a(%rax),%ecx
cmp    $0x29,%ecx
ja     11d5 <main+0x95>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    0x2e2b(%rip),%rax
mov    (%rax),%esi
mov    (%r12),%rdx
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <main+0x50>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
jmp    1190 <main+0x50>
cmp    $0xffffffff,%eax
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c":a:b::c:d\00"
@.str.1 = [7 x i8] c"%d %s\0A\00"
@optind = global i32 0
@optarg = global i8* null
@.str.2 = [26 x i8] c"absence argument option!\0A\00"
@.str.3 = [19 x i8] c"invalid argument!\0A\00"
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
store i32 0, i32* %6
br label %7
7: ; preds = %31, %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %32
12: ; preds = %7
%13 = load i32, i32* %6
switch i32 %13, label %31 [
i32 97, label %14
i32 98, label %18
i32 99, label %22
i32 58, label %26
i32 63, label %28
]
14: ; preds = %12
%15 = load i32, i32* @optind
%16 = load i8*, i8** @optarg
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %16)
br label %31
18: ; preds = %12
%19 = load i32, i32* @optind
%20 = load i8*, i8** @optarg
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %20)
br label %31
22: ; preds = %12
%23 = load i32, i32* @optind
%24 = load i8*, i8** @optarg
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %23, i8* %24)
br label %31
26: ; preds = %12
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %31
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 (...) @printUsage()
br label %31
31: ; preds = %12, %28, %26, %22, %18, %14
br label %7
32: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c":a:b::c:d\00"
@.str.1 = [7 x i8] c"%d %s\0A\00"
@optind = global i32 0
@optarg = global i8* null
@str = [18 x i8] c"invalid argument!\00"
@str.4 = [25 x i8] c"absence argument option!\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %5, %2
%4 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %5 [
i32 -1, label %23
i32 97, label %6
i32 98, label %10
i32 99, label %14
i32 58, label %18
i32 63, label %20
]
5: ; preds = %3, %20, %18, %14, %10, %6
br label %3
6: ; preds = %3
%7 = load i32, i32* @optind
%8 = load i8*, i8** @optarg
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %7, i8* %8)
br label %5
10: ; preds = %3
%11 = load i32, i32* @optind
%12 = load i8*, i8** @optarg
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %12)
br label %5
14: ; preds = %3
%15 = load i32, i32* @optind
%16 = load i8*, i8** @optarg
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %16)
br label %5
18: ; preds = %3
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
br label %5
20: ; preds = %3
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%22 = tail call i32 (...) @printUsage()
br label %5
23: ; preds = %3
ret i32 0
}