#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ const member_1;
};

/* Variables and functions */
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ printf(char *);
#define required_argument 128
int main(int argc, char *argv[]) {
  int val, option_index = 0;
  static struct option long_options[] = {{"display", required_argument, 0, 'd'},
                                         {"update", required_argument, 0, 'u'},
                                         {"force", required_argument, 0, 'f'},
                                         {0}};
  val = getopt_long(argc, argv, "d:u:f:", long_options, &option_index);
  if (val == -1)
    return val;
  switch (val) {
  case 'd':
    printf("Opcion d\n");
    break;
  case 'u':
    printf("Opcion u\n");
    break;
  case 'f':
    printf("Opcion f\n");
    break;
  default:
    printf("Debe usar el parametro -d/-display, -f/-force"
           "o -u/-update\n");
    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,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeca(%rip),%rdx
lea    0x2eee(%rip),%rcx
lea    -0x18(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1173 <main+0x53>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <main+0xcf>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x64,%eax
je     11a9 <main+0x89>
jmp    1187 <main+0x67>
mov    -0x1c(%rbp),%eax
sub    $0x66,%eax
je     11cb <main+0xab>
jmp    1198 <main+0x78>
mov    -0x1c(%rbp),%eax
sub    $0x75,%eax
je     11ba <main+0x9a>
jmp    11dc <main+0xbc>
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xc8>
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xc8>
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xc8>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xede(%rip),%rdx
lea    0x2f09(%rip),%rcx
lea    0x4(%rsp),%r8
call   1040 <getopt_long@plt>
cmp    $0x65,%eax
jg     1159 <main+0x39>
cmp    $0xffffffff,%eax
je     1183 <main+0x63>
cmp    $0x64,%eax
jne    116c <main+0x4c>
lea    0xed0(%rip),%rdi
jmp    117c <main+0x5c>
cmp    $0x66,%eax
je     1175 <main+0x55>
cmp    $0x75,%eax
jne    116c <main+0x4c>
lea    0xeb4(%rip),%rdi
jmp    117c <main+0x5c>
lea    0xebd(%rip),%rdi
jmp    117c <main+0x5c>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 100 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32 0, i32 117 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option zeroinitializer]
@.str = [8 x i8] c"display\00"
@.str.1 = [7 x i8] c"update\00"
@.str.2 = [6 x i8] c"force\00"
@.str.3 = [7 x i8] c"d:u:f:\00"
@.str.4 = [10 x i8] c"Opcion d\0A\00"
@.str.5 = [10 x i8] c"Opcion u\0A\00"
@.str.6 = [10 x i8] c"Opcion f\0A\00"
@.str.7 = [59 x i8] c"Debe usar el parametro -d/-display, -f/-forceo -u/-update\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @getopt_long(i32 %8, i8** %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %struct.option* getelementptr inbounds ([4 x %struct.option], [4 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %7)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %6
store i32 %14, i32* %3
br label %26
15: ; preds = %2
%16 = load i32, i32* %6
switch i32 %16, label %23 [
i32 100, label %17
i32 117, label %19
i32 102, label %21
]
17: ; preds = %15
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %25
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %25
21: ; preds = %15
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %25
23: ; preds = %15
%24 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0))
br label %25
25: ; preds = %23, %21, %19, %17
store i32 0, i32* %3
br label %26
26: ; preds = %25, %13
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@main.long_options = internal global [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 100 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32 0, i32 117 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option zeroinitializer]
@.str = [8 x i8] c"display\00"
@.str.1 = [7 x i8] c"update\00"
@.str.2 = [6 x i8] c"force\00"
@.str.3 = [7 x i8] c"d:u:f:\00"
@str = [9 x i8] c"Opcion f\00"
@str.8 = [9 x i8] c"Opcion u\00"
@str.9 = [9 x i8] c"Opcion d\00"
@str.10 = [58 x i8] c"Debe usar el parametro -d/-display, -f/-forceo -u/-update\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %struct.option* getelementptr inbounds ([4 x %struct.option], [4 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %3)
switch i32 %5, label %8 [
i32 -1, label %12
i32 100, label %9
i32 117, label %6
i32 102, label %7
]
6: ; preds = %2
br label %9
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %8, %7, %6
%10 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.8, i64 0, i64 0), %6 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0), %7 ], [ getelementptr inbounds ([58 x i8], [58 x i8]* @str.10, i64 0, i64 0), %8 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0), %2 ]
%11 = call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %2
%13 = phi i32 [ %5, %2 ], [ 0, %9 ]
ret i32 %13
}