#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 sysinfo {
  long const uptime;
  int /*<<< orphan*/ procs;
};

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, long const, long const,
                            long const, long const, int /*<<< orphan*/);
int /*<<< orphan*/ strncat(char *, char *, size_t);
int /*<<< orphan*/ sysinfo(struct sysinfo *);
int numprocessos(char *b, size_t s) {
  const long minuto = 60;
  const long hora = minuto * 60;
  const long dia = hora * 24;
  struct sysinfo si;
  sysinfo(&si);
  char buffer[500];
  buffer[0] = '\x0';
  snprintf(buffer, 500,
           "<b>UpTime:</b> %ld days, %ld:%02ld:%02ld hours<br> <b>Number of "
           "Processes:</b> <br>%d Processes",
           si.uptime / dia, (si.uptime % dia) / hora,
           (si.uptime % hora) / minuto, si.uptime % minuto, si.procs);
  strncat(b, buffer, s);
  return 1;
}


x86 assembly (clang, -O0):
<numprocessos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x3c,-0x18(%rbp)
movq   $0xe10,-0x20(%rbp)
movq   $0x15180,-0x28(%rbp)
lea    -0x38(%rbp),%rdi
call   1050 <sysinfo@plt>
movb   $0x0,-0x230(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
mov    $0x15180,%esi
cqto
idiv   %rsi
mov    %rdx,%rax
mov    $0xe10,%esi
cqto
idiv   %rsi
mov    %rax,%r8
mov    -0x38(%rbp),%rax
mov    $0xe10,%esi
cqto
idiv   %rsi
mov    %rdx,%rax
mov    $0x3c,%esi
cqto
idiv   %rsi
mov    %rax,%r9
mov    -0x38(%rbp),%rax
mov    $0x3c,%esi
cqto
idiv   %rsi
mov    %rdx,%r10
mov    -0x30(%rbp),%eax
mov    $0x1f4,%esi
lea    0xe21(%rip),%rdx
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x230(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <strncat@plt>
mov    $0x1,%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numprocessos>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsp,%rdi
call   1050 <sysinfo@plt>
movb   $0x0,0x10(%rsp)
mov    (%rsp),%rbx
movabs $0x1845c8a0ce512957,%rcx
c8 45 18
mov    %rbx,%rax
imul   %rcx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0xd,%rdx
add    %rdx,%rcx
imul   $0x15180,%rcx,%rax
mov    %rbx,%rdx
sub    %rax,%rdx
movslq %edx,%rax
imul   $0xffffffff91a2b3c5,%rax,%rdx
shr    $0x20,%rdx
add    %edx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0xb,%eax
add    %edx,%eax
movslq %eax,%r8
movabs $0x48d159e26af37c05,%rdx
59 d1 48
mov    %rbx,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xa,%rdx
add    %eax,%edx
imul   $0xe10,%edx,%eax
mov    %ebx,%edx
sub    %eax,%edx
movswl %dx,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %edx,%eax
movzwl %ax,%eax
movswl %ax,%esi
shr    $0xf,%eax
sar    $0x5,%esi
add    %eax,%esi
movabs $0x8888888888888889,%rdx
88 88 88
mov    %rbx,%rax
imul   %rdx
movswq %si,%r9
add    %rbx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x5,%rdx
add    %rax,%rdx
imul   $0x3c,%rdx,%rax
sub    %rax,%rbx
mov    0x8(%rsp),%eax
lea    0xde9(%rip),%rdx
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0x1f4,%esi
push   %rax
push   %rbx
call   1030 <snprintf@plt>
add    $0x10,%rsp
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1040 <strncat@plt>
mov    $0x1,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sysinfo = type { i64, i32 }
@.str = [96 x i8] c"<b>UpTime:</b> %ld days, %ld:%02ld:%02ld hours<br> <b>Number of Processes:</b> <br>%d Processes\00"
define i32 @numprocessos(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca %struct.sysinfo
%9 = alloca [500 x i8]
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 60, i64* %5
store i64 3600, i64* %6
store i64 86400, i64* %7
%10 = call i32 @sysinfo(%struct.sysinfo* %8)
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %9, i64 0, i64 0
store i8 0, i8* %11
%12 = getelementptr inbounds [500 x i8], [500 x i8]* %9, i64 0, i64 0
%13 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %8, i32 0, i32 0
%14 = load i64, i64* %13
%15 = sdiv i64 %14, 86400
%16 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %8, i32 0, i32 0
%17 = load i64, i64* %16
%18 = srem i64 %17, 86400
%19 = sdiv i64 %18, 3600
%20 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %8, i32 0, i32 0
%21 = load i64, i64* %20
%22 = srem i64 %21, 3600
%23 = sdiv i64 %22, 60
%24 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %8, i32 0, i32 0
%25 = load i64, i64* %24
%26 = srem i64 %25, 60
%27 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %8, i32 0, i32 1
%28 = load i32, i32* %27
%29 = call i32 @snprintf(i8* %12, i32 500, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i64 %15, i64 %19, i64 %23, i64 %26, i32 %28)
%30 = load i8*, i8** %3
%31 = getelementptr inbounds [500 x i8], [500 x i8]* %9, i64 0, i64 0
%32 = load i64, i64* %4
%33 = call i32 @strncat(i8* %30, i8* %31, i64 %32)
ret i32 1
}

LLVM IR (-O2):
%struct.sysinfo = type { i64, i32 }
@.str = [96 x i8] c"<b>UpTime:</b> %ld days, %ld:%02ld:%02ld hours<br> <b>Number of Processes:</b> <br>%d Processes\00"
define i32 @numprocessos(i8* %0, i64 %1) {
%3 = alloca %struct.sysinfo
%4 = alloca [500 x i8]
%5 = bitcast %struct.sysinfo* %3 to i8*
%6 = call i32 @sysinfo(%struct.sysinfo* %3)
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
store i8 0, i8* %7
%8 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %3, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sdiv i64 %9, 86400
%11 = srem i64 %9, 86400
%12 = trunc i64 %11 to i32
%13 = sdiv i32 %12, 3600
%14 = sext i32 %13 to i64
%15 = srem i64 %9, 3600
%16 = trunc i64 %15 to i16
%17 = sdiv i16 %16, 60
%18 = sext i16 %17 to i64
%19 = srem i64 %9, 60
%20 = getelementptr inbounds %struct.sysinfo, %struct.sysinfo* %3, i64 0, i32 1
%21 = load i32, i32* %20
%22 = call i32 @snprintf(i8* %7, i32 500, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i64 %10, i64 %14, i64 %18, i64 %19, i32 %21)
%23 = call i32 @strncat(i8* %0, i8* %7, i64 %1)
ret i32 1
}