#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 tm {
  long tm_hour;
  long tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
long int getSeconds(struct tm *tp) {
  long int nInterval = 0;
  nInterval = (tp->tm_hour * ((60L) * 60L));
  nInterval += (tp->tm_min * (60L));
  nInterval += (tp->tm_sec * (1));
  printf("%ld", nInterval);
  return nInterval;
}


x86 assembly (clang, -O0):
<getSeconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xe10,(%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3c,0x8(%rax),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
shl    $0x0,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSeconds>:
push   %rbx
imul   $0xe10,(%rdi),%rax
imul   $0x3c,0x8(%rdi),%rcx
add    %rax,%rcx
movslq 0x10(%rdi),%rbx
add    %rcx,%rbx
lea    0xed2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i32 }
@.str = [4 x i8] c"%ld\00"
define i64 @getSeconds(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i64
store %struct.tm* %0, %struct.tm** %2
store i64 0, i64* %3
%4 = load %struct.tm*, %struct.tm** %2
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = mul nsw i64 %6, 3600
store i64 %7, i64* %3
%8 = load %struct.tm*, %struct.tm** %2
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = mul nsw i64 %10, 60
%12 = load i64, i64* %3
%13 = add nsw i64 %12, %11
store i64 %13, i64* %3
%14 = load %struct.tm*, %struct.tm** %2
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 2
%16 = load i32, i32* %15
%17 = mul nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = load i64, i64* %3
%20 = add nsw i64 %19, %18
store i64 %20, i64* %3
%21 = load i64, i64* %3
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %21)
%23 = load i64, i64* %3
ret i64 %23
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i32 }
@.str = [4 x i8] c"%ld\00"
define i64 @getSeconds(%struct.tm* nocapture %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = mul nsw i64 %3, 3600
%5 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = mul nsw i64 %6, 60
%8 = add nsw i64 %7, %4
%9 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 2
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = add nsw i64 %8, %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %12)
ret i64 %12
}