#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*/ fprintf(int /*<<< orphan*/, char *);
int getsubopt(char **, char **, char **);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
void sous_options(char *str_sous_opt, int *taille_log, int *max_cli,
                  char **chemin_html) {
  int sousopt = 0;
  int valeur_log = 0;
  int valeur_max_cli = 0;
  char *valeur = NULL;
  char *tokens[] = {"log", "path", "maxcli", NULL};
  while ((sousopt = getsubopt(&str_sous_opt, tokens, &valeur)) != -1) {
    switch (sousopt) {
    case 0:
      if (valeur == NULL) {
        fprintf(stderr, "taille du fichier log attendue\n");
        break;
      }
      if (sscanf(valeur, "%d", &valeur_log) != 1) {
        fprintf(stderr, "taille du fichier log invalide\n");
        break;
      }
      *taille_log = valeur_log;
      break;
    case 1:
      if (valeur == NULL) {
        fprintf(stderr, "chemin des fichiers html attendu\n");
        break;
      }
      *chemin_html = valeur;
      break;
    case 2:
      if (valeur == NULL) {
        fprintf(stderr, "nombre maximum de clients attendu\n");
        break;
      }
      if (sscanf(valeur, "%d", &valeur_max_cli) != 1) {
        fprintf(stderr, "nombre maximum de clients invalide\n");
        break;
      }
      *max_cli = valeur_max_cli;
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<sous_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
mov    0x2c84(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x2c81(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0x2c7e(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c7b(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x60(%rbp),%rsi
lea    -0x8(%rbp),%rdi
lea    -0x38(%rbp),%rdx
call   1030 <getsubopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     12f6 <sous_options+0x1c6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x64(%rbp)
test   %eax,%eax
je     11e3 <sous_options+0xb3>
jmp    11c1 <sous_options+0x91>
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
je     124d <sous_options+0x11d>
jmp    11d2 <sous_options+0xa2>
mov    -0x64(%rbp),%eax
sub    $0x2,%eax
je     1282 <sous_options+0x152>
jmp    12ec <sous_options+0x1bc>
cmpq   $0x0,-0x38(%rbp)
jne    1208 <sous_options+0xd8>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
lea    0xe12(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12f1 <sous_options+0x1c1>
mov    -0x38(%rbp),%rdi
lea    0xe1d(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     123f <sous_options+0x10f>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
lea    0xdfe(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12f1 <sous_options+0x1c1>
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    12f1 <sous_options+0x1c1>
cmpq   $0x0,-0x38(%rbp)
jne    1272 <sous_options+0x142>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
lea    0xdeb(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12f1 <sous_options+0x1c1>
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    12f1 <sous_options+0x1c1>
cmpq   $0x0,-0x38(%rbp)
jne    12a7 <sous_options+0x177>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12f1 <sous_options+0x1c1>
mov    -0x38(%rbp),%rdi
lea    0xd7e(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     12de <sous_options+0x1ae>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12f1 <sous_options+0x1c1>
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    12f1 <sous_options+0x1c1>
jmp    12f1 <sous_options+0x1c1>
jmp    1191 <sous_options+0x61>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sous_options>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rcx,0x20(%rsp)
mov    %rdx,0x18(%rsp)
mov    %rsi,0x10(%rsp)
mov    %rdi,0x28(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movaps 0x2c8f(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c73(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
lea    0x28(%rsp),%r13
lea    0x30(%rsp),%rbx
lea    0x8(%rsp),%rbp
lea    0xe68(%rip),%r15
mov    0x2e39(%rip),%r12
lea    0xe9a(%rip),%r14
jmp    11c0 <sous_options+0x90>
mov    (%r12),%edi
lea    0xed2(%rip),%rsi
call   1040 <fprintf@plt>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1030 <getsubopt@plt>
add    $0x1,%eax
cmp    $0x3,%eax
ja     11c0 <sous_options+0x90>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     125d <sous_options+0x12d>
mov    %r14,%rsi
lea    0x4(%rsp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1287 <sous_options+0x157>
mov    0x4(%rsp),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11c0 <sous_options+0x90>
nopl   0x0(%rax)
mov    0x8(%rsp),%rax
test   %rax,%rax
je     1272 <sous_options+0x142>
mov    0x20(%rsp),%rcx
mov    %rax,(%rcx)
jmp    11c0 <sous_options+0x90>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     11a8 <sous_options+0x78>
mov    %r14,%rsi
mov    %rsp,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    129c <sous_options+0x16c>
mov    (%rsp),%eax
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11c0 <sous_options+0x90>
mov    (%r12),%edi
lea    0xdb8(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11c0 <sous_options+0x90>
mov    (%r12),%edi
lea    0xde6(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11c0 <sous_options+0x90>
mov    (%r12),%edi
lea    0xdb1(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11c0 <sous_options+0x90>
mov    (%r12),%edi
lea    0xe01(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11c0 <sous_options+0x90>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"log\00"
@.str.1 = [5 x i8] c"path\00"
@.str.2 = [7 x i8] c"maxcli\00"
@__const.sous_options.tokens = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* null]
@stderr = global i32 0
@.str.3 = [32 x i8] c"taille du fichier log attendue\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [32 x i8] c"taille du fichier log invalide\0A\00"
@.str.6 = [34 x i8] c"chemin des fichiers html attendu\0A\00"
@.str.7 = [35 x i8] c"nombre maximum de clients attendu\0A\00"
@.str.8 = [36 x i8] c"nombre maximum de clients invalide\0A\00"
define void @sous_options(i8* %0, i32* %1, i32* %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [4 x i8*]
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i8** %3, i8*** %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i8* null, i8** %12
%14 = bitcast [4 x i8*]* %13 to i8*
br label %15
15: ; preds = %63, %4
%16 = getelementptr inbounds [4 x i8*], [4 x i8*]* %13, i64 0, i64 0
%17 = call i32 @getsubopt(i8** %5, i8** %16, i8** %12)
store i32 %17, i32* %9
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %64
19: ; preds = %15
%20 = load i32, i32* %9
switch i32 %20, label %62 [
i32 0, label %21
i32 1, label %37
i32 2, label %46
]
21: ; preds = %19
%22 = load i8*, i8** %12
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %63
27: ; preds = %21
%28 = load i8*, i8** %12
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %10)
%30 = icmp ne i32 %29, 1
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %63
34: ; preds = %27
%35 = load i32, i32* %10
%36 = load i32*, i32** %6
store i32 %35, i32* %36
br label %63
37: ; preds = %19
%38 = load i8*, i8** %12
%39 = icmp eq i8* %38, null
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %63
43: ; preds = %37
%44 = load i8*, i8** %12
%45 = load i8**, i8*** %8
store i8* %44, i8** %45
br label %63
46: ; preds = %19
%47 = load i8*, i8** %12
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %63
52: ; preds = %46
%53 = load i8*, i8** %12
%54 = call i32 @sscanf(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %11)
%55 = icmp ne i32 %54, 1
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
br label %63
59: ; preds = %52
%60 = load i32, i32* %11
%61 = load i32*, i32** %7
store i32 %60, i32* %61
br label %63
62: ; preds = %19
br label %63
63: ; preds = %62, %59, %56, %49, %43, %40, %34, %31, %24
br label %15
64: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"log\00"
@.str.1 = [5 x i8] c"path\00"
@.str.2 = [7 x i8] c"maxcli\00"
@__const.sous_options.tokens = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* null]
@stderr = global i32 0
@.str.3 = [32 x i8] c"taille du fichier log attendue\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [32 x i8] c"taille du fichier log invalide\0A\00"
@.str.6 = [34 x i8] c"chemin des fichiers html attendu\0A\00"
@.str.7 = [35 x i8] c"nombre maximum de clients attendu\0A\00"
@.str.8 = [36 x i8] c"nombre maximum de clients invalide\0A\00"
define void @sous_options(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i8** nocapture writeonly %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [4 x i8*]
store i8* %0, i8** %5
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%12 = bitcast i8** %8 to i8*
store i8* null, i8** %8
%13 = bitcast [4 x i8*]* %9 to i8*
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 0
br label %15
15: ; preds = %17, %4
%16 = call i32 @getsubopt(i8** %5, i8** %14, i8** %8)
switch i32 %16, label %17 [
i32 -1, label %53
i32 0, label %18
i32 1, label %32
i32 2, label %39
]
17: ; preds = %15, %51, %48, %42, %38, %35, %30, %27, %21
br label %15
18: ; preds = %15
%19 = load i8*, i8** %8
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %17
24: ; preds = %18
%25 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%26 = icmp eq i32 %25, 1
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %17
30: ; preds = %24
%31 = load i32, i32* %6
store i32 %31, i32* %1
br label %17
32: ; preds = %15
%33 = load i8*, i8** %8
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %17
38: ; preds = %32
store i8* %33, i8** %3
br label %17
39: ; preds = %15
%40 = load i8*, i8** %8
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %17
45: ; preds = %39
%46 = call i32 @sscanf(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%47 = icmp eq i32 %46, 1
br i1 %47, label %51, label %48
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
br label %17
51: ; preds = %45
%52 = load i32, i32* %7
store i32 %52, i32* %2
br label %17
53: ; preds = %15
ret void
}