#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*/ elog(char *);
int sprintf(char *, char *, ...);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
void sig_wait(int p) {
  wait(NULL);
  do {
    char format_msg[1024] = {0};
    int i = sprintf(format_msg, "[%s %s:%d]:", "08:25:37",
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/sundyCoder/STMP_POP3/"
                    "refs/heads/master/smtpserver/smtp_ser.c",
                    50);
    sprintf(format_msg + i, "catch %d\n", p);
    elog(format_msg);
  } while (0);
  return;
}


x86 assembly (clang, -O0):
<sig_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <wait@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1030 <memset@plt>
lea    -0x410(%rbp),%rdi
lea    0xe88(%rip),%rsi
lea    0xe8d(%rip),%rdx
lea    0xe8f(%rip),%rcx
mov    $0x32,%r8d
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
movslq -0x414(%rbp),%rax
add    %rax,%rdi
mov    -0x4(%rbp),%edx
lea    0xef8(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <elog@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_wait>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebp
xor    %edi,%edi
call   1060 <wait@plt>
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xe95(%rip),%rsi
lea    0xe9a(%rip),%rdx
lea    0xe9c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x32,%r8d
xor    %eax,%eax
call   1050 <sprintf@plt>
cltq
lea    (%rsp,%rax,1),%rdi
lea    0xf16(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <elog@plt>
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"[%s %s:%d]:\00"
@.str.1 = [9 x i8] c"08:25:37\00"
@.str.2 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/sundyCoder/STMP_POP3/refs/heads/master/smtpserver/smtp_ser.c\00"
@.str.3 = [10 x i8] c"catch %d\0A\00"
define void @sig_wait(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @wait(i32* null)
br label %6
6: ; preds = %1
%7 = bitcast [1024 x i8]* %3 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.2, i64 0, i64 0), i32 50)
store i32 %9, i32* %4
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i32, i32* %2
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%17 = call i32 @elog(i8* %16)
br label %18
18: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"[%s %s:%d]:\00"
@.str.1 = [9 x i8] c"08:25:37\00"
@.str.2 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/sundyCoder/STMP_POP3/refs/heads/master/smtpserver/smtp_ser.c\00"
@.str.3 = [10 x i8] c"catch %d\0A\00"
define void @sig_wait(i32 %0) {
%2 = alloca [1024 x i8]
%3 = tail call i32 @wait(i32* null)
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.2, i64 0, i64 0), i32 50)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %6
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %0)
%9 = call i32 @elog(i8* %4)
ret void
}