#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 Read(char *, int);
int Write(char *, int /*<<< orphan*/);
int /*<<< orphan*/ dump(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
void SendSMS() {
  char buffer[1024];
  int ret;
  strcpy(buffer, "AT+CMGS=25\r");
  printf("%s\n", buffer);
  ret = Write(buffer, strlen(buffer));
  sleep(10);
  ret = Read(buffer, 1024);
  dump(buffer, ret);
  strcpy(buffer, "0011000d91688112601001F60008010a00680065006c006c006f\x1a");
  ret = Write(buffer, strlen(buffer));
  sleep(10);
  ret = Read(buffer, 1024);
  dump(buffer, ret);
}


x86 assembly (clang, -O0):
<SendSMS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
lea    -0x400(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x400(%rbp),%rsi
lea    0xe70(%rip),%rdi
call   1060 <printf@plt>
lea    -0x400(%rbp),%rax
mov    %rax,-0x418(%rbp)
lea    -0x400(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x418(%rbp),%rdi
mov    %eax,%esi
call   1070 <Write@plt>
mov    %eax,-0x404(%rbp)
mov    $0xa,%edi
call   1090 <sleep@plt>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
call   1040 <Read@plt>
mov    %eax,-0x404(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x404(%rbp),%esi
call   1080 <dump@plt>
lea    -0x400(%rbp),%rdi
lea    0xe00(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x400(%rbp),%rax
mov    %rax,-0x410(%rbp)
lea    -0x400(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x410(%rbp),%rdi
mov    %eax,%esi
call   1070 <Write@plt>
mov    %eax,-0x404(%rbp)
mov    $0xa,%edi
call   1090 <sleep@plt>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
call   1040 <Read@plt>
mov    %eax,-0x404(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x404(%rbp),%esi
call   1080 <dump@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendSMS>:
push   %rbx
sub    $0x400,%rsp
lea    0xe81(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <Write@plt>
mov    $0xa,%edi
call   1090 <sleep@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <Read@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <dump@plt>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1070 <Write@plt>
mov    $0xa,%edi
call   1090 <sleep@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <Read@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1080 <dump@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"AT+CMGS=25\0D\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [54 x i8] c"0011000d91688112601001F60008010a00680065006c006c006f\1A\00"
define void @SendSMS() {
%1 = alloca [1024 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @Write(i8* %7, i32 %9)
store i32 %10, i32* %2
%11 = call i32 @sleep(i32 10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%13 = call i32 @Read(i8* %12, i32 1024)
store i32 %13, i32* %2
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%15 = load i32, i32* %2
%16 = call i32 @dump(i8* %14, i32 %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = call i32 @Write(i8* %19, i32 %21)
store i32 %22, i32* %2
%23 = call i32 @sleep(i32 10)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%25 = call i32 @Read(i8* %24, i32 1024)
store i32 %25, i32* %2
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%27 = load i32, i32* %2
%28 = call i32 @dump(i8* %26, i32 %27)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"AT+CMGS=25\0D\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [54 x i8] c"0011000d91688112601001F60008010a00680065006c006c006f\1A\00"
define void @SendSMS() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 @Write(i8* %2, i32 %5)
%7 = call i32 @sleep(i32 10)
%8 = call i32 @Read(i8* %2, i32 1024)
%9 = call i32 @dump(i8* %2, i32 %8)
%10 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @strlen(i8* %2)
%12 = call i32 @Write(i8* %2, i32 %11)
%13 = call i32 @sleep(i32 10)
%14 = call i32 @Read(i8* %2, i32 1024)
%15 = call i32 @dump(i8* %2, i32 %14)
ret void
}