#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 mcp9808State {
  int dummy;
};

/* Variables and functions */
struct mcp9808State *mcp9808_initTemperatureSensor(int, int);
int /*<<< orphan*/ mcp9808_startMeasuring(struct mcp9808State *);
double mcp9880_readTemperature(struct mcp9808State *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ sleep(int);
void mcp9808_testMeasurement() {
  struct mcp9808State *state = mcp9808_initTemperatureSensor(1, 0x18);
  mcp9808_startMeasuring(state);
  sleep(1);
  printf("Temperature is : %f C\n", mcp9880_readTemperature(state));
  sleep(1);
  printf("Temperature is : %f C\n", mcp9880_readTemperature(state));
  sleep(1);
  printf("Temperature is : %f C\n", mcp9880_readTemperature(state));
}


x86 assembly (clang, -O0):
<mcp9808_testMeasurement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
mov    $0x18,%esi
call   1030 <mcp9808_initTemperatureSensor@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <mcp9808_startMeasuring@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x8(%rbp),%rdi
call   1050 <mcp9880_readTemperature@plt>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x8(%rbp),%rdi
call   1050 <mcp9880_readTemperature@plt>
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x8(%rbp),%rdi
call   1050 <mcp9880_readTemperature@plt>
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcp9808_testMeasurement>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
mov    $0x18,%esi
call   1030 <mcp9808_initTemperatureSensor@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <mcp9808_startMeasuring@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    %rbx,%rdi
call   1050 <mcp9880_readTemperature@plt>
lea    0xe79(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    %rbx,%rdi
call   1050 <mcp9880_readTemperature@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    %rbx,%rdi
call   1050 <mcp9880_readTemperature@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.mcp9808State = type { i32 }
@.str = [23 x i8] c"Temperature is : %f C\0A\00"
define void @mcp9808_testMeasurement() {
%1 = alloca %struct.mcp9808State*
%2 = call %struct.mcp9808State* @mcp9808_initTemperatureSensor(i32 1, i32 24)
store %struct.mcp9808State* %2, %struct.mcp9808State** %1
%3 = load %struct.mcp9808State*, %struct.mcp9808State** %1
%4 = call i32 @mcp9808_startMeasuring(%struct.mcp9808State* %3)
%5 = call i32 @sleep(i32 1)
%6 = load %struct.mcp9808State*, %struct.mcp9808State** %1
%7 = call double @mcp9880_readTemperature(%struct.mcp9808State* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %7)
%9 = call i32 @sleep(i32 1)
%10 = load %struct.mcp9808State*, %struct.mcp9808State** %1
%11 = call double @mcp9880_readTemperature(%struct.mcp9808State* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %11)
%13 = call i32 @sleep(i32 1)
%14 = load %struct.mcp9808State*, %struct.mcp9808State** %1
%15 = call double @mcp9880_readTemperature(%struct.mcp9808State* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %15)
ret void
}

LLVM IR (-O2):
%struct.mcp9808State = type { i32 }
@.str = [23 x i8] c"Temperature is : %f C\0A\00"
define void @mcp9808_testMeasurement() {
%1 = tail call %struct.mcp9808State* @mcp9808_initTemperatureSensor(i32 1, i32 24)
%2 = tail call i32 @mcp9808_startMeasuring(%struct.mcp9808State* %1)
%3 = tail call i32 @sleep(i32 1)
%4 = tail call double @mcp9880_readTemperature(%struct.mcp9808State* %1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %4)
%6 = tail call i32 @sleep(i32 1)
%7 = tail call double @mcp9880_readTemperature(%struct.mcp9808State* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %7)
%9 = tail call i32 @sleep(i32 1)
%10 = tail call double @mcp9880_readTemperature(%struct.mcp9808State* %1)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %10)
ret void
}