#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 char uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ _write(int, char *, int);
int /*<<< orphan*/ oled_fini(int);
int oled_init(int);
void oled_addr_set(int oldaddr, int newaddr) {
  uint8_t buf[] = {'S', 'I', '2', 'C', 'A', newaddr};
  int fd;
  fd = oled_init(oldaddr);
  _write(fd, buf, sizeof(buf));
  oled_fini(fd);
}


x86 assembly (clang, -O0):
<oled_addr_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movb   $0x53,-0xe(%rbp)
movb   $0x49,-0xd(%rbp)
movb   $0x32,-0xc(%rbp)
movb   $0x43,-0xb(%rbp)
movb   $0x41,-0xa(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <oled_init@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0xe(%rbp),%rsi
mov    $0x6,%edx
call   1050 <_write@plt>
mov    -0x14(%rbp),%edi
call   1030 <oled_fini@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oled_addr_set>:
push   %rbx
sub    $0x10,%rsp
movl   $0x43324953,0xa(%rsp)
43
movb   $0x41,0xe(%rsp)
mov    %sil,0xf(%rsp)
call   1040 <oled_init@plt>
mov    %eax,%ebx
lea    0xa(%rsp),%rsi
mov    %eax,%edi
mov    $0x6,%edx
call   1050 <_write@plt>
mov    %ebx,%edi
call   1030 <oled_fini@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @oled_addr_set(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [6 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
store i8 83, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 73, i8* %8
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 50, i8* %9
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8 67, i8* %10
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8 65, i8* %11
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i32, i32* %4
%14 = trunc i32 %13 to i8
store i8 %14, i8* %12
%15 = load i32, i32* %3
%16 = call i32 @oled_init(i32 %15)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%19 = call i32 @_write(i32 %17, i8* %18, i32 6)
%20 = load i32, i32* %6
%21 = call i32 @oled_fini(i32 %20)
ret void
}

LLVM IR (-O2):
define void @oled_addr_set(i32 %0, i32 %1) {
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
store i8 83, i8* %4
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 1
store i8 73, i8* %5
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 2
store i8 50, i8* %6
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 3
store i8 67, i8* %7
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 4
store i8 65, i8* %8
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 5
%10 = trunc i32 %1 to i8
store i8 %10, i8* %9
%11 = tail call i32 @oled_init(i32 %0)
%12 = call i32 @_write(i32 %11, i8* %4, i32 6)
%13 = call i32 @oled_fini(i32 %11)
ret void
}