#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 */
struct id3 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ id3_check_tag(char *);
scalar_t__ id3_extract_info(char *, struct id3 *);
int /*<<< orphan*/ id3_normalize_info(struct id3 *);
scalar_t__ id3_read_tag(char const *, char *);
int id3_read(const char *path, struct id3 *id3) {
  char tmp[128];
  assert(path != NULL);
  assert(id3 != NULL);
  if (id3_read_tag(path, tmp) < 0)
    return (-1);
  if (id3_check_tag(tmp) < 0)
    return (-1);
  if (id3_extract_info(tmp, id3) < 0)
    return (-1);
  id3_normalize_info(id3);
  return (0);
}


x86 assembly (clang, -O0):
<id3_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1050 <id3_read_tag@plt>
cmp    $0x0,%rax
jge    11ad <id3_read+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1205 <id3_read+0xb5>
lea    -0xa0(%rbp),%rdi
call   1070 <id3_check_tag@plt>
cmp    $0x0,%rax
jge    11cf <id3_read+0x7f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1205 <id3_read+0xb5>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <id3_extract_info@plt>
cmp    $0x0,%rax
jge    11f5 <id3_read+0xa5>
movl   $0xffffffff,-0x4(%rbp)
jmp    1205 <id3_read+0xb5>
mov    -0x18(%rbp),%rdi
call   1030 <id3_normalize_info@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id3_read>:
push   %rbp
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %rdi,%rbp
xor    %edi,%edi
test   %rbp,%rbp
setne  %dil
call   1060 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1060 <assert@plt>
mov    %rsp,%rsi
mov    %rbp,%rdi
call   1050 <id3_read_tag@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
js     11b7 <id3_read+0x67>
mov    %rsp,%rdi
call   1070 <id3_check_tag@plt>
test   %rax,%rax
js     11b7 <id3_read+0x67>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <id3_extract_info@plt>
test   %rax,%rax
js     11b7 <id3_read+0x67>
mov    %rbx,%rdi
call   1030 <id3_normalize_info@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.id3 = type { i32 }
define i32 @id3_read(i8* %0, %struct.id3* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.id3*
%6 = alloca [128 x i8]
store i8* %0, i8** %4
store %struct.id3* %1, %struct.id3** %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load %struct.id3*, %struct.id3** %5
%12 = icmp ne %struct.id3* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i8*, i8** %4
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%17 = call i64 @id3_read_tag(i8* %15, i8* %16)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %2
store i32 -1, i32* %3
br label %34
20: ; preds = %2
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%22 = call i64 @id3_check_tag(i8* %21)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 -1, i32* %3
br label %34
25: ; preds = %20
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%27 = load %struct.id3*, %struct.id3** %5
%28 = call i64 @id3_extract_info(i8* %26, %struct.id3* %27)
%29 = icmp slt i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 -1, i32* %3
br label %34
31: ; preds = %25
%32 = load %struct.id3*, %struct.id3** %5
%33 = call i32 @id3_normalize_info(%struct.id3* %32)
store i32 0, i32* %3
br label %34
34: ; preds = %31, %30, %24, %19
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.id3 = type { i32 }
define i32 @id3_read(i8* %0, %struct.id3* %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = icmp ne i8* %0, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp ne %struct.id3* %1, null
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = call i64 @id3_read_tag(i8* %0, i8* %4)
%12 = icmp slt i64 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %2
%14 = call i64 @id3_check_tag(i8* %4)
%15 = icmp slt i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = call i64 @id3_extract_info(i8* %4, %struct.id3* %1)
%18 = icmp slt i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 @id3_normalize_info(%struct.id3* %1)
br label %21
21: ; preds = %16, %13, %2, %19
%22 = phi i32 [ 0, %19 ], [ -1, %2 ], [ -1, %13 ], [ -1, %16 ]
ret i32 %22
}