#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*/ printf(char *, int, char const *);
void printInfo(const char *name, double *seconds, int period) {
  int n;
  n = *seconds / period;
  if (n > 0) {
    printf("%d %s, ", n, name);
  }
  *seconds -= period * n;
}


x86 assembly (clang, -O0):
<printInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    1158 <printInfo+0x48>
mov    -0x18(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printInfo>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
movsd  (%rsi),%xmm0
cvtsi2sd %edx,%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%ebp
test   %ebp,%ebp
jle    1147 <printInfo+0x37>
mov    %rdi,%rdx
lea    0xec4(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
movsd  (%rbx),%xmm0
imul   %r14d,%ebp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d %s, \00"
define void @printInfo(i8* %0, double* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store double* %1, double** %5
store i32 %2, i32* %6
%8 = load double*, double** %5
%9 = load double, double* %8
%10 = load i32, i32* %6
%11 = sitofp i32 %10 to double
%12 = fdiv double %9, %11
%13 = fptosi double %12 to i32
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load i32, i32* %7
%18 = load i8*, i8** %4
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %17, i8* %18)
br label %20
20: ; preds = %16, %3
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = mul nsw i32 %21, %22
%24 = sitofp i32 %23 to double
%25 = load double*, double** %5
%26 = load double, double* %25
%27 = fsub double %26, %24
store double %27, double* %25
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d %s, \00"
define void @printInfo(i8* %0, double* nocapture %1, i32 %2) {
%4 = load double, double* %1
%5 = sitofp i32 %2 to double
%6 = fdiv double %4, %5
%7 = fptosi double %6 to i32
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %0)
%11 = load double, double* %1
br label %12
12: ; preds = %9, %3
%13 = phi double [ %11, %9 ], [ %4, %3 ]
%14 = mul nsw i32 %7, %2
%15 = sitofp i32 %14 to double
%16 = fsub double %13, %15
store double %16, double* %1
ret void
}