#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*/ printf(char *, int, char *);
int print_error(int err_code) {
  char *err_msg;
  switch (err_code) {
  case 0x00010001:
  case 0x00010002:
  case 0x00010003:
  case 0x00010004:
    err_msg = "Echec de la connexion à la base LDAP";
    break;
  case 0x00010005:
    err_msg = "Echec de la recherche";
    break;
  case 0x00010006:
    err_msg = "Impossible de trouver l'utilisateur";
    break;
  case 0x00020001:
    err_msg = "Impossible de se connecter à DBUS";
    break;
  default:
    err_msg = "Exception non attendue";
  }
  printf("Erreur %i : %s\n", err_code, err_msg);
  return err_code;
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0xfffeffff,%eax
sub    $0x4,%eax
jb     116d <print_error+0x5d>
jmp    1134 <print_error+0x24>
mov    -0x14(%rbp),%eax
sub    $0x10005,%eax
je     117d <print_error+0x6d>
jmp    1147 <print_error+0x37>
mov    -0x14(%rbp),%eax
sub    $0x10006,%eax
je     118d <print_error+0x7d>
jmp    115a <print_error+0x4a>
mov    -0x14(%rbp),%eax
sub    $0x20001,%eax
je     119d <print_error+0x8d>
jmp    11ad <print_error+0x9d>
lea    0xe8c(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11b8 <print_error+0xa8>
lea    0xea2(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11b8 <print_error+0xa8>
lea    0xea8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11b8 <print_error+0xa8>
lea    0xebc(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11b8 <print_error+0xa8>
lea    0xecf(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error>:
push   %rbx
mov    %edi,%ebx
cmp    $0x10004,%edi
jg     112f <print_error+0x1f>
lea    -0x10001(%rbx),%eax
cmp    $0x4,%eax
jae    1159 <print_error+0x49>
lea    0xed3(%rip),%rdx
jmp    1169 <print_error+0x59>
cmp    $0x20001,%ebx
je     1150 <print_error+0x40>
cmp    $0x10006,%ebx
je     1162 <print_error+0x52>
cmp    $0x10005,%ebx
jne    1159 <print_error+0x49>
lea    0xed8(%rip),%rdx
jmp    1169 <print_error+0x59>
lea    0xf09(%rip),%rdx
jmp    1169 <print_error+0x59>
lea    0xf23(%rip),%rdx
jmp    1169 <print_error+0x59>
lea    0xed3(%rip),%rdx
lea    0xf2a(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Echec de la connexion \C3\A0 la base LDAP\00"
@.str.1 = [22 x i8] c"Echec de la recherche\00"
@.str.2 = [36 x i8] c"Impossible de trouver l'utilisateur\00"
@.str.3 = [35 x i8] c"Impossible de se connecter \C3\A0 DBUS\00"
@.str.4 = [23 x i8] c"Exception non attendue\00"
@.str.5 = [16 x i8] c"Erreur %i : %s\0A\00"
define i32 @print_error(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %9 [
i32 65537, label %5
i32 65538, label %5
i32 65539, label %5
i32 65540, label %5
i32 65541, label %6
i32 65542, label %7
i32 131073, label %8
]
5: ; preds = %1, %1, %1, %1
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8** %3
br label %10
6: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %10
7: ; preds = %1
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %10
8: ; preds = %1
store i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %11, i8* %12)
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [38 x i8] c"Echec de la connexion \C3\A0 la base LDAP\00"
@.str.1 = [22 x i8] c"Echec de la recherche\00"
@.str.2 = [36 x i8] c"Impossible de trouver l'utilisateur\00"
@.str.3 = [35 x i8] c"Impossible de se connecter \C3\A0 DBUS\00"
@.str.4 = [23 x i8] c"Exception non attendue\00"
@.str.5 = [16 x i8] c"Erreur %i : %s\0A\00"
define i32 @print_error(i32 returned %0) {
switch i32 %0, label %5 [
i32 65537, label %6
i32 65538, label %6
i32 65539, label %6
i32 65540, label %6
i32 65541, label %2
i32 65542, label %3
i32 131073, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %1, %1, %1, %5, %4, %3, %2
%7 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %1 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %0, i8* %7)
ret i32 %0
}