#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 *, ...);
void imprimer_ligne(char ligne[], int lg) {
  int j;
  for (j = 0; j < 16; j++) {
    if (j < lg)
      printf("%02x ", (unsigned char)ligne[j]);
    else
      printf("   ");
  }
  for (j = 0; j < lg; j++) {
    char c = ligne[j];
    printf("%c", (' ' <= c && c <= '~') ? c : '.');
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<imprimer_ligne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    117c <imprimer_ligne+0x6c>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115b <imprimer_ligne+0x4b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1169 <imprimer_ligne+0x59>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116e <imprimer_ligne+0x5e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <imprimer_ligne+0x16>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f3 <imprimer_ligne+0xe3>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jg     11c7 <imprimer_ligne+0xb7>
movsbl -0x11(%rbp),%eax
cmp    $0x7e,%eax
jg     11c7 <imprimer_ligne+0xb7>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11d4 <imprimer_ligne+0xc4>
mov    $0x2e,%eax
mov    %eax,-0x18(%rbp)
jmp    11d4 <imprimer_ligne+0xc4>
mov    -0x18(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <imprimer_ligne+0x73>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimer_ligne>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r13
movslq %esi,%rbp
lea    0xec5(%rip),%r15
lea    0xec4(%rip),%r12
xor    %ebx,%ebx
jmp    1164 <imprimer_ligne+0x44>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     117b <imprimer_ligne+0x5b>
cmp    %rbp,%rbx
jge    1150 <imprimer_ligne+0x30>
movzbl 0x0(%r13,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    115a <imprimer_ligne+0x3a>
test   %r14d,%r14d
jle    11b1 <imprimer_ligne+0x91>
mov    %r14d,%ebx
xor    %ebp,%ebp
mov    $0x2e,%r14d
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%r13,%rbp,1),%eax
lea    -0x20(%rax),%ecx
cmp    $0x5f,%cl
cmovae %r14d,%eax
movzbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1190 <imprimer_ligne+0x70>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%02x \00"
@.str.1 = [4 x i8] c" \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @imprimer_ligne(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 16
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %24
22: ; preds = %10
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
store i32 0, i32* %5
br label %29
29: ; preds = %53, %28
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %56
33: ; preds = %29
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
store i8 %38, i8* %6
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
%41 = icmp sle i32 32, %40
br i1 %41, label %42, label %49
42: ; preds = %33
%43 = load i8, i8* %6
%44 = sext i8 %43 to i32
%45 = icmp sle i32 %44, 126
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = load i8, i8* %6
%48 = sext i8 %47 to i32
br label %50
49: ; preds = %42, %33
br label %50
50: ; preds = %49, %46
%51 = phi i32 [ %48, %46 ], [ 46, %49 ]
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %50
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %29
56: ; preds = %29
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%02x \00"
@.str.1 = [4 x i8] c" \00"
define void @imprimer_ligne(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %8
4: ; preds = %18
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %32
6: ; preds = %4
%7 = zext i32 %1 to i64
br label %21
8: ; preds = %2, %18
%9 = phi i64 [ 0, %2 ], [ %19, %18 ]
%10 = icmp slt i64 %9, %3
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %0, i64 %9
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %18
16: ; preds = %8
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %11, %16
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, 16
br i1 %20, label %4, label %8
21: ; preds = %6, %21
%22 = phi i64 [ 0, %6 ], [ %30, %21 ]
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = add i8 %24, -32
%26 = icmp ult i8 %25, 95
%27 = select i1 %26, i8 %24, i8 46
%28 = zext i8 %27 to i32
%29 = tail call i32 @putchar(i32 %28)
%30 = add nuw nsw i64 %22, 1
%31 = icmp eq i64 %30, %7
br i1 %31, label %32, label %21
32: ; preds = %21, %4
%33 = tail call i32 @putchar(i32 10)
ret void
}