#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
  int tm_mon;
  int tm_year;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
void nbsec2date(time_t n, int *pj, int *pm, int *pa) {
  struct tm *t = gmtime(&n);
  if (NULL == t) {
    puts("nbsec2date : erreur de conversion");
    return;
  }
  *pj = t->tm_mday;
  *pm = t->tm_mon + 1;
  *pa = t->tm_year + 1900;
}


x86 assembly (clang, -O0):
<nbsec2date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <gmtime@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%rax
jne    1161 <nbsec2date+0x41>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
jmp    1190 <nbsec2date+0x70>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x76c,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbsec2date>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <gmtime@plt>
test   %rax,%rax
je     115f <nbsec2date+0x3f>
mov    (%rax),%ecx
mov    %ecx,(%rbx)
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%r15)
mov    $0x76c,%ecx
add    0x8(%rax),%ecx
mov    %ecx,(%r14)
jmp    116b <nbsec2date+0x4b>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [34 x i8] c"nbsec2date : erreur de conversion\00"
define void @nbsec2date(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca %struct.tm*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = call %struct.tm* @gmtime(i32* %5)
store %struct.tm* %10, %struct.tm** %9
%11 = load %struct.tm*, %struct.tm** %9
%12 = icmp eq %struct.tm* null, %11
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %30
15: ; preds = %4
%16 = load %struct.tm*, %struct.tm** %9
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load %struct.tm*, %struct.tm** %9
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
%24 = load i32*, i32** %7
store i32 %23, i32* %24
%25 = load %struct.tm*, %struct.tm** %9
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 2
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1900
%29 = load i32*, i32** %8
store i32 %28, i32* %29
br label %30
30: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [34 x i8] c"nbsec2date : erreur de conversion\00"
define void @nbsec2date(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i32
store i32 %0, i32* %5
%6 = call %struct.tm* @gmtime(i32* %5)
%7 = icmp eq %struct.tm* %6, null
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %19
10: ; preds = %4
%11 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%12 = load i32, i32* %11
store i32 %12, i32* %1
%13 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
%16 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1900
store i32 %18, i32* %3
br label %19
19: ; preds = %10, %8
ret void
}