#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int strlen(char *);
int codeCarac(FILE *fichierCode, char carac, char code[][14]) {
  static int compteur = 0;
  static char octetCourant = 0;
  int i, fini = 0;
  if (carac == EOF) {
    fini = 1;
    carac = 0;
  }
  for (i = 0; i < strlen(code[(int)carac]); i++) {
    octetCourant = octetCourant << 1;
    compteur++;
    if (code[(int)carac][i] == '1')
      octetCourant++;
    if (compteur == 8) {
      fputc(octetCourant, fichierCode);
      compteur = 0;
    }
  }
  if (fini && compteur)
    fputc(octetCourant << (8 - compteur), fichierCode);
  return fini;
}


x86 assembly (clang, -O0):
<codeCarac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movsbl -0x9(%rbp),%eax
mov    0x2ea0(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    115e <codeCarac+0x3e>
movl   $0x1,-0x20(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
movsbl -0x9(%rbp),%eax
cltq
imul   $0xe,%rax,%rax
add    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    121a <codeCarac+0xfa>
movsbl 0x2ea3(%rip),%eax
shl    $0x1,%eax
mov    %al,0x2e9a(%rip)
mov    0x2e90(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e87(%rip)
mov    -0x18(%rbp),%rax
movsbl -0x9(%rbp),%ecx
movslq %ecx,%rcx
imul   $0xe,%rcx,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    11de <codeCarac+0xbe>
mov    0x2e62(%rip),%al
add    $0x1,%al
mov    %al,0x2e5a(%rip)
cmpl   $0x8,0x2e4f(%rip)
jne    1207 <codeCarac+0xe7>
mov    0x2e47(%rip),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
movl   $0x0,0x2e2d(%rip)
jmp    120c <codeCarac+0xec>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1165 <codeCarac+0x45>
cmpl   $0x0,-0x20(%rbp)
je     1251 <codeCarac+0x131>
cmpl   $0x0,0x2e09(%rip)
je     1251 <codeCarac+0x131>
movsbl 0x2e00(%rip),%eax
mov    $0x8,%ecx
sub    0x2df1(%rip),%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <fputc@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<codeCarac>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
mov    0x2eb3(%rip),%rax
mov    (%rax),%r15b
xor    %eax,%eax
cmp    %r14b,%r15b
cmovne %esi,%eax
cltq
mov    %rax,%rbp
shl    $0x4,%rbp
sub    %rax,%rbp
sub    %rax,%rbp
add    %rdx,%rbp
mov    %rbp,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11cc <codeCarac+0xac>
xor    %ebx,%ebx
jmp    1183 <codeCarac+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %rbp,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11cc <codeCarac+0xac>
movzbl 0x2eae(%rip),%eax
add    %al,%al
mov    %al,0x2ea6(%rip)
mov    0x2e9c(%rip),%ecx
add    $0x1,%ecx
mov    %ecx,0x2e93(%rip)
cmpb   $0x31,0x0(%rbp,%rbx,1)
jne    11b0 <codeCarac+0x90>
or     $0x1,%al
mov    %al,0x2e88(%rip)
cmp    $0x8,%ecx
jne    1170 <codeCarac+0x50>
movsbl %al,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
movl   $0x0,0x2e6a(%rip)
jmp    1170 <codeCarac+0x50>
cmp    %r14b,%r15b
jne    11f3 <codeCarac+0xd3>
mov    0x2e5d(%rip),%eax
test   %eax,%eax
je     11f3 <codeCarac+0xd3>
movzbl 0x2e56(%rip),%edx
mov    $0x8,%cl
sub    %al,%cl
shl    %cl,%edx
movsbl %dl,%edi
mov    %r12,%rsi
call   1040 <fputc@plt>
xor    %eax,%eax
cmp    %r14b,%r15b
sete   %al
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@codeCarac.compteur = internal global i32 0
@codeCarac.octetCourant = internal global i8 0
@EOF = global i8 0
define i32 @codeCarac(i32* %0, i8 signext %1, [14 x i8]* %2) {
%4 = alloca i32*
%5 = alloca i8
%6 = alloca [14 x i8]*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i8 %1, i8* %5
store [14 x i8]* %2, [14 x i8]** %6
store i32 0, i32* %8
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = load i8, i8* @EOF
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %10, %12
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 1, i32* %8
store i8 0, i8* %5
br label %15
15: ; preds = %14, %3
store i32 0, i32* %7
br label %16
16: ; preds = %55, %15
%17 = load i32, i32* %7
%18 = load [14 x i8]*, [14 x i8]** %6
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [14 x i8], [14 x i8]* %18, i64 %21
%23 = getelementptr inbounds [14 x i8], [14 x i8]* %22, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = icmp slt i32 %17, %24
br i1 %25, label %26, label %58
26: ; preds = %16
%27 = load i8, i8* @codeCarac.octetCourant
%28 = sext i8 %27 to i32
%29 = shl i32 %28, 1
%30 = trunc i32 %29 to i8
store i8 %30, i8* @codeCarac.octetCourant
%31 = load i32, i32* @codeCarac.compteur
%32 = add nsw i32 %31, 1
store i32 %32, i32* @codeCarac.compteur
%33 = load [14 x i8]*, [14 x i8]** %6
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [14 x i8], [14 x i8]* %33, i64 %36
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [14 x i8], [14 x i8]* %37, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 49
br i1 %43, label %44, label %47
44: ; preds = %26
%45 = load i8, i8* @codeCarac.octetCourant
%46 = add i8 %45, 1
store i8 %46, i8* @codeCarac.octetCourant
br label %47
47: ; preds = %44, %26
%48 = load i32, i32* @codeCarac.compteur
%49 = icmp eq i32 %48, 8
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = load i8, i8* @codeCarac.octetCourant
%52 = load i32*, i32** %4
%53 = call i32 @fputc(i8 signext %51, i32* %52)
store i32 0, i32* @codeCarac.compteur
br label %54
54: ; preds = %50, %47
br label %55
55: ; preds = %54
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %16
58: ; preds = %16
%59 = load i32, i32* %8
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %73
61: ; preds = %58
%62 = load i32, i32* @codeCarac.compteur
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %73
64: ; preds = %61
%65 = load i8, i8* @codeCarac.octetCourant
%66 = sext i8 %65 to i32
%67 = load i32, i32* @codeCarac.compteur
%68 = sub nsw i32 8, %67
%69 = shl i32 %66, %68
%70 = trunc i32 %69 to i8
%71 = load i32*, i32** %4
%72 = call i32 @fputc(i8 signext %70, i32* %71)
br label %73
73: ; preds = %64, %61, %58
%74 = load i32, i32* %8
ret i32 %74
}

LLVM IR (-O2):
@codeCarac.compteur = internal unnamed_addr global i32 0
@codeCarac.octetCourant = internal unnamed_addr global i8 0
@EOF = global i8 0
define i32 @codeCarac(i32* nocapture %0, i8 signext %1, [14 x i8]* %2) {
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %4, %1
%6 = select i1 %5, i8 0, i8 %1
%7 = sext i8 %6 to i64
%8 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 %7, i64 0
%9 = tail call i32 @strlen(i8* %8)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %32
11: ; preds = %3, %27
%12 = phi i64 [ %28, %27 ], [ 0, %3 ]
%13 = load i8, i8* @codeCarac.octetCourant
%14 = shl i8 %13, 1
store i8 %14, i8* @codeCarac.octetCourant
%15 = load i32, i32* @codeCarac.compteur
%16 = add nsw i32 %15, 1
store i32 %16, i32* @codeCarac.compteur
%17 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 %7, i64 %12
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 49
br i1 %19, label %20, label %22
20: ; preds = %11
%21 = or i8 %14, 1
store i8 %21, i8* @codeCarac.octetCourant
br label %22
22: ; preds = %20, %11
%23 = phi i8 [ %21, %20 ], [ %14, %11 ]
%24 = icmp eq i32 %16, 8
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @fputc(i8 signext %23, i32* %0)
store i32 0, i32* @codeCarac.compteur
br label %27
27: ; preds = %22, %25
%28 = add nuw nsw i64 %12, 1
%29 = tail call i32 @strlen(i8* %8)
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %11, label %32
32: ; preds = %27, %3
%33 = load i32, i32* @codeCarac.compteur
%34 = icmp ne i32 %33, 0
%35 = select i1 %5, i1 %34, i1 false
br i1 %35, label %36, label %43
36: ; preds = %32
%37 = load i8, i8* @codeCarac.octetCourant
%38 = zext i8 %37 to i32
%39 = sub nsw i32 8, %33
%40 = shl i32 %38, %39
%41 = trunc i32 %40 to i8
%42 = tail call i32 @fputc(i8 signext %41, i32* %0)
br label %43
43: ; preds = %36, %32
%44 = zext i1 %5 to i32
ret i32 %44
}