#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*/ chmod(char *, int);
int /*<<< orphan*/ logprintf(char *);
int /*<<< orphan*/ qfprintf(char *, char *);
int /*<<< orphan*/ system_logged(char *);
void start_adbd(void) {
  logprintf("0starting adbd");
  qfprintf("/sys/class/usb_composite/adb/enable", "1");
  qfprintf("/sys/class/usb_composite/rndis/enable", "1");
  chmod("/dev/android_adb", 0777);
  system_logged("adbd >/var/adbd.log 2>/var/adbd.err &");
}


x86 assembly (clang, -O0):
<start_adbd>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1060 <logprintf@plt>
lea    0xeb8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1040 <qfprintf@plt>
lea    0xecb(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1040 <qfprintf@plt>
lea    0xede(%rip),%rdi
mov    $0x1ff,%esi
call   1050 <chmod@plt>
lea    0xede(%rip),%rdi
call   1030 <system_logged@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_adbd>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1060 <logprintf@plt>
lea    0xebb(%rip),%rdi
lea    0xed8(%rip),%rbx
mov    %rbx,%rsi
call   1040 <qfprintf@plt>
lea    0xecb(%rip),%rdi
mov    %rbx,%rsi
call   1040 <qfprintf@plt>
lea    0xee2(%rip),%rdi
mov    $0x1ff,%esi
call   1050 <chmod@plt>
lea    0xee2(%rip),%rdi
pop    %rbx
jmp    1030 <system_logged@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"0starting adbd\00"
@.str.1 = [36 x i8] c"/sys/class/usb_composite/adb/enable\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [38 x i8] c"/sys/class/usb_composite/rndis/enable\00"
@.str.4 = [17 x i8] c"/dev/android_adb\00"
@.str.5 = [38 x i8] c"adbd >/var/adbd.log 2>/var/adbd.err &\00"
define void @start_adbd() {
%1 = call i32 @logprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @qfprintf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @qfprintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @chmod(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 511)
%5 = call i32 @system_logged(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"0starting adbd\00"
@.str.1 = [36 x i8] c"/sys/class/usb_composite/adb/enable\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [38 x i8] c"/sys/class/usb_composite/rndis/enable\00"
@.str.4 = [17 x i8] c"/dev/android_adb\00"
@.str.5 = [38 x i8] c"adbd >/var/adbd.log 2>/var/adbd.err &\00"
define void @start_adbd() {
%1 = tail call i32 @logprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @qfprintf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @qfprintf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @chmod(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 511)
%5 = tail call i32 @system_logged(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
ret void
}