#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 int16_t;

/* Variables and functions */
int /*<<< orphan*/ gpio_set_mode(int, char *);
int /*<<< orphan*/ gpio_set_value(int, int);
int shiftIn(int, int);
int retreive_data_SHT11() {
  int16_t value;
  gpio_set_mode(38, "in");
  gpio_set_mode(40, "out");
  value = shiftIn(1, 8);
  value *= 256;
  gpio_set_mode(38, "out");
  gpio_set_value(38, 1);
  gpio_set_value(38, 0);
  gpio_set_value(40, 1);
  gpio_set_value(40, 0);
  gpio_set_mode(38, "in");
  value |= shiftIn(1, 8);
  return value;
}


x86 assembly (clang, -O0):
<retreive_data_SHT11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x26,%edi
lea    0xebc(%rip),%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x28,%edi
lea    0xeae(%rip),%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1040 <shiftIn@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    $0x26,%edi
lea    0xe82(%rip),%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x26,%edi
mov    $0x1,%esi
call   1050 <gpio_set_value@plt>
mov    $0x26,%edi
xor    %esi,%esi
call   1050 <gpio_set_value@plt>
mov    $0x28,%edi
mov    $0x1,%esi
call   1050 <gpio_set_value@plt>
mov    $0x28,%edi
xor    %esi,%esi
call   1050 <gpio_set_value@plt>
mov    $0x26,%edi
lea    0xe38(%rip),%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1040 <shiftIn@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<retreive_data_SHT11>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%r14
mov    $0x26,%edi
mov    %r14,%rsi
call   1030 <gpio_set_mode@plt>
lea    0xeb4(%rip),%rbx
mov    $0x28,%edi
mov    %rbx,%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1040 <shiftIn@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    $0x26,%edi
mov    %rbx,%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x26,%edi
mov    $0x1,%esi
call   1050 <gpio_set_value@plt>
mov    $0x26,%edi
xor    %esi,%esi
call   1050 <gpio_set_value@plt>
mov    $0x28,%edi
mov    $0x1,%esi
call   1050 <gpio_set_value@plt>
mov    $0x28,%edi
xor    %esi,%esi
call   1050 <gpio_set_value@plt>
mov    $0x26,%edi
mov    %r14,%rsi
call   1030 <gpio_set_mode@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1040 <shiftIn@plt>
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"in\00"
@.str.1 = [4 x i8] c"out\00"
define i32 @retreive_data_SHT11() {
%1 = alloca i32
%2 = call i32 @gpio_set_mode(i32 38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @gpio_set_mode(i32 40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @shiftIn(i32 1, i32 8)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, 256
store i32 %6, i32* %1
%7 = call i32 @gpio_set_mode(i32 38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gpio_set_value(i32 38, i32 1)
%9 = call i32 @gpio_set_value(i32 38, i32 0)
%10 = call i32 @gpio_set_value(i32 40, i32 1)
%11 = call i32 @gpio_set_value(i32 40, i32 0)
%12 = call i32 @gpio_set_mode(i32 38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @shiftIn(i32 1, i32 8)
%14 = load i32, i32* %1
%15 = or i32 %14, %13
store i32 %15, i32* %1
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"in\00"
@.str.1 = [4 x i8] c"out\00"
define i32 @retreive_data_SHT11() {
%1 = tail call i32 @gpio_set_mode(i32 38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @gpio_set_mode(i32 40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @shiftIn(i32 1, i32 8)
%4 = shl nsw i32 %3, 8
%5 = tail call i32 @gpio_set_mode(i32 38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @gpio_set_value(i32 38, i32 1)
%7 = tail call i32 @gpio_set_value(i32 38, i32 0)
%8 = tail call i32 @gpio_set_value(i32 40, i32 1)
%9 = tail call i32 @gpio_set_value(i32 40, i32 0)
%10 = tail call i32 @gpio_set_mode(i32 38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @shiftIn(i32 1, i32 8)
%12 = or i32 %11, %4
ret i32 %12
}