#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*/ alcatel_attach();
int /*<<< orphan*/ alcatel_begin_transfer(unsigned char);
int /*<<< orphan*/ alcatel_close_session(unsigned char);
int /*<<< orphan*/ alcatel_commit(unsigned char);
int alcatel_create_obj_list_item(unsigned char, unsigned char, char *);
int /*<<< orphan*/ alcatel_detach();
scalar_t__ alcatel_select_type(unsigned char);
int /*<<< orphan*/ alcatel_start_session();
int /*<<< orphan*/ message(int, char *);
int /*<<< orphan*/ printf(char *, int);
void create_alc_cat(unsigned char sync, unsigned char type, unsigned char cat,
                    char *name) {
  alcatel_attach();
  alcatel_start_session();
  if (alcatel_select_type(type)) {
    alcatel_begin_transfer(sync);
    printf("Category created with number %d\n",
           alcatel_create_obj_list_item(type, cat, name));
    alcatel_commit(type);
  } else {
    message(5, "Can not open sync session!");
  }
  alcatel_close_session(type);
  alcatel_detach();
}


x86 assembly (clang, -O0):
<create_alc_cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %rcx,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <alcatel_attach@plt>
mov    $0x0,%al
call   1050 <alcatel_start_session@plt>
movzbl -0x2(%rbp),%edi
call   1090 <alcatel_select_type@plt>
cmp    $0x0,%rax
je     1219 <create_alc_cat+0x79>
movzbl -0x1(%rbp),%edi
call   10b0 <alcatel_begin_transfer@plt>
mov    -0x2(%rbp),%cl
mov    -0x3(%rbp),%al
mov    -0x10(%rbp),%rdx
movzbl %cl,%edi
movzbl %al,%esi
call   1070 <alcatel_create_obj_list_item@plt>
mov    %eax,%esi
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
movzbl -0x2(%rbp),%edi
call   1080 <alcatel_commit@plt>
jmp    122a <create_alc_cat+0x8a>
mov    $0x5,%edi
lea    0xdfc(%rip),%rsi
call   1030 <message@plt>
movzbl -0x2(%rbp),%edi
call   10a0 <alcatel_close_session@plt>
mov    $0x0,%al
call   1060 <alcatel_detach@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_alc_cat>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   10c0 <alcatel_attach@plt>
xor    %eax,%eax
call   1050 <alcatel_start_session@plt>
mov    %ebx,%edi
call   1090 <alcatel_select_type@plt>
movzbl %bl,%ebx
test   %rax,%rax
je     11fc <create_alc_cat+0x5c>
movzbl %bpl,%edi
call   10b0 <alcatel_begin_transfer@plt>
movzbl %r15b,%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   1070 <alcatel_create_obj_list_item@plt>
lea    0xe14(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1080 <alcatel_commit@plt>
jmp    120d <create_alc_cat+0x6d>
lea    0xe1e(%rip),%rsi
mov    $0x5,%edi
call   1030 <message@plt>
mov    %ebx,%edi
call   10a0 <alcatel_close_session@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <alcatel_detach@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Category created with number %d\0A\00"
@.str.1 = [27 x i8] c"Can not open sync session!\00"
define void @create_alc_cat(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8*
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8* %3, i8** %8
%9 = call i32 (...) @alcatel_attach()
%10 = call i32 (...) @alcatel_start_session()
%11 = load i8, i8* %6
%12 = call i64 @alcatel_select_type(i8 zeroext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %4
%15 = load i8, i8* %5
%16 = call i32 @alcatel_begin_transfer(i8 zeroext %15)
%17 = load i8, i8* %6
%18 = load i8, i8* %7
%19 = load i8*, i8** %8
%20 = call i32 @alcatel_create_obj_list_item(i8 zeroext %17, i8 zeroext %18, i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i8, i8* %6
%23 = call i32 @alcatel_commit(i8 zeroext %22)
br label %26
24: ; preds = %4
%25 = call i32 @message(i32 5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %14
%27 = load i8, i8* %6
%28 = call i32 @alcatel_close_session(i8 zeroext %27)
%29 = call i32 (...) @alcatel_detach()
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Category created with number %d\0A\00"
@.str.1 = [27 x i8] c"Can not open sync session!\00"
define void @create_alc_cat(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* %3) {
%5 = tail call i32 (...) @alcatel_attach()
%6 = tail call i32 (...) @alcatel_start_session()
%7 = tail call i64 @alcatel_select_type(i8 zeroext %1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = tail call i32 @alcatel_begin_transfer(i8 zeroext %0)
%11 = tail call i32 @alcatel_create_obj_list_item(i8 zeroext %1, i8 zeroext %2, i8* %3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 @alcatel_commit(i8 zeroext %1)
br label %16
14: ; preds = %4
%15 = tail call i32 @message(i32 5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %9
%17 = tail call i32 @alcatel_close_session(i8 zeroext %1)
%18 = tail call i32 (...) @alcatel_detach()
ret void
}