#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 */
scalar_t__ _write_sysfs(char *, char const *, char *);
int write_sysfs(const char *model_name, const char *sim_str) {
  int ret = 0;
  ret += _write_sysfs("/sys/devices/soc/2080000.qcom,mss/"
                      "dirtysanta_lg_model_name",
                      model_name, "model name");
  ret += _write_sysfs("/sys/devices/soc/2080000.qcom,mss/"
                      "dirtysanta_sim_num",
                      sim_str, "SIM count");
  return ret;
}


x86 assembly (clang, -O0):
<write_sysfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xece(%rip),%rdi
lea    0xf02(%rip),%rdx
call   1030 <_write_sysfs@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xef0(%rip),%rdi
lea    0xf1e(%rip),%rdx
call   1030 <_write_sysfs@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_sysfs>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xedf(%rip),%rdi
lea    0xf13(%rip),%rdx
call   1030 <_write_sysfs@plt>
mov    %rax,%rbx
lea    0xf0f(%rip),%rdi
lea    0xf3d(%rip),%rdx
mov    %r14,%rsi
call   1030 <_write_sysfs@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [59 x i8] c"/sys/devices/soc/2080000.qcom,mss/dirtysanta_lg_model_name\00"
@.str.1 = [11 x i8] c"model name\00"
@.str.2 = [53 x i8] c"/sys/devices/soc/2080000.qcom,mss/dirtysanta_sim_num\00"
@.str.3 = [10 x i8] c"SIM count\00"
define i32 @write_sysfs(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = call i64 @_write_sysfs(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, %7
%11 = trunc i64 %10 to i32
store i32 %11, i32* %5
%12 = load i8*, i8** %4
%13 = call i64 @_write_sysfs(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = add nsw i64 %15, %13
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
@.str = [59 x i8] c"/sys/devices/soc/2080000.qcom,mss/dirtysanta_lg_model_name\00"
@.str.1 = [11 x i8] c"model name\00"
@.str.2 = [53 x i8] c"/sys/devices/soc/2080000.qcom,mss/dirtysanta_sim_num\00"
@.str.3 = [10 x i8] c"SIM count\00"
define i32 @write_sysfs(i8* %0, i8* %1) {
%3 = tail call i64 @_write_sysfs(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i64 @_write_sysfs(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = add i64 %4, %3
%6 = trunc i64 %5 to i32
ret i32 %6
}