#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*/ print_disk_usage(int *);
int /*<<< orphan*/ printf(char *, char *);
void print_write_status(int *disk_usage, int status, char message[],
                        char file[]) {
  switch (status) {
  case -2:
    printf("Erro: arquivo nao encontrado %s\n", file);
    break;
  case -3:
    printf("Erro: disco cheio, %s não escrito\n", file);
    break;
  default:
    printf("Arquivo %s escrito\n", file);
    printf("Message: %s\n", message);
    break;
  }
  print_disk_usage(disk_usage);
}


x86 assembly (clang, -O0):
<print_write_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0xfffffffd,%eax
je     1171 <print_write_status+0x51>
jmp    114b <print_write_status+0x2b>
mov    -0x24(%rbp),%eax
sub    $0xfffffffe,%eax
jne    1186 <print_write_status+0x66>
jmp    115c <print_write_status+0x3c>
mov    -0x20(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11a6 <print_write_status+0x86>
mov    -0x20(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    11a6 <print_write_status+0x86>
mov    -0x20(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print_disk_usage@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_write_status>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
cmp    $0xfffffffd,%esi
je     113d <print_write_status+0x1d>
cmp    $0xfffffffe,%esi
jne    1149 <print_write_status+0x29>
lea    0xec8(%rip),%rdi
mov    %rcx,%rsi
jmp    1165 <print_write_status+0x45>
lea    0xedd(%rip),%rdi
mov    %rcx,%rsi
jmp    1165 <print_write_status+0x45>
mov    %rdx,%r14
lea    0xef2(%rip),%rdi
mov    %rcx,%rsi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <print_disk_usage@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Erro: arquivo nao encontrado %s\0A\00"
@.str.1 = [36 x i8] c"Erro: disco cheio, %s n\C3\A3o escrito\0A\00"
@.str.2 = [20 x i8] c"Arquivo %s escrito\0A\00"
@.str.3 = [13 x i8] c"Message: %s\0A\00"
define void @print_write_status(i32* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %6
switch i32 %9, label %16 [
i32 -2, label %10
i32 -3, label %13
]
10: ; preds = %4
%11 = load i8*, i8** %8
%12 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %21
13: ; preds = %4
%14 = load i8*, i8** %8
%15 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %21
16: ; preds = %4
%17 = load i8*, i8** %8
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %7
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %13, %10
%22 = load i32*, i32** %5
%23 = call i32 @print_disk_usage(i32* %22)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Erro: arquivo nao encontrado %s\0A\00"
@.str.1 = [36 x i8] c"Erro: disco cheio, %s n\C3\A3o escrito\0A\00"
@.str.2 = [20 x i8] c"Arquivo %s escrito\0A\00"
@.str.3 = [13 x i8] c"Message: %s\0A\00"
define void @print_write_status(i32* %0, i32 %1, i8* %2, i8* %3) {
switch i32 %1, label %9 [
i32 -2, label %5
i32 -3, label %7
]
5: ; preds = %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %12
7: ; preds = %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %12
9: ; preds = %4
%10 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %12
12: ; preds = %9, %7, %5
%13 = tail call i32 @print_disk_usage(i32* %0)
ret void
}