int send_serial(struct client *cli) {
  if (!send_data_int(cli, gen_serial(cli))) {
    internal_logit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/"
                   "heads/lyrics/server.c",
                   1205, __FUNCTION__, "Error when sending serial");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<send_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <gen_serial@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    $0x0,%al
call   1030 <send_data_int@plt>
cmp    $0x0,%eax
jne    1192 <send_serial+0x62>
lea    0xe94(%rip),%rdi
mov    $0x4b5,%esi
lea    0xf10(%rip),%rdx
lea    0xf15(%rip),%rcx
mov    $0x0,%al
call   1050 <internal_logit@plt>
movl   $0x0,-0x4(%rbp)
jmp    1199 <send_serial+0x69>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_serial>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <gen_serial@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <send_data_int@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1154 <send_serial+0x24>
pop    %rbx
ret
lea    0xea5(%rip),%rdi
lea    0xf26(%rip),%rdx
lea    0xf2b(%rip),%rcx
mov    $0x4b5,%esi
xor    %eax,%eax
call   1050 <internal_logit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.client = type opaque
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/server.c\00"
@__FUNCTION__.send_serial = [12 x i8] c"send_serial\00"
@.str.1 = [26 x i8] c"Error when sending serial\00"
define i32 @send_serial(%struct.client* %0) {
%2 = alloca i32
%3 = alloca %struct.client*
store %struct.client* %0, %struct.client** %3
%4 = load %struct.client*, %struct.client** %3
%5 = load %struct.client*, %struct.client** %3
%6 = call i32 (%struct.client*, ...) bitcast (i32 (...)* @gen_serial to i32 (%struct.client*, ...)*)(%struct.client* %5)
%7 = call i32 (%struct.client*, i32, ...) bitcast (i32 (...)* @send_data_int to i32 (%struct.client*, i32, ...)*)(%struct.client* %4, i32 %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @internal_logit to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 1205, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__FUNCTION__.send_serial, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %12
11: ; preds = %1
store i32 1, i32* %2
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.client = type opaque
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/server.c\00"
@__FUNCTION__.send_serial = [12 x i8] c"send_serial\00"
@.str.1 = [26 x i8] c"Error when sending serial\00"
define i32 @send_serial(%struct.client* %0) {
%2 = tail call i32 (%struct.client*, ...) bitcast (i32 (...)* @gen_serial to i32 (%struct.client*, ...)*)(%struct.client* %0)
%3 = tail call i32 (%struct.client*, i32, ...) bitcast (i32 (...)* @send_data_int to i32 (%struct.client*, i32, ...)*)(%struct.client* %0, i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @internal_logit to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 1205, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__FUNCTION__.send_serial, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ 0, %5 ], [ 1, %1 ]
ret i32 %8
}