#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*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
char *at_ftrim(char *buf, int seq) {
  if (buf != NULL)
    sprintf(buf, "AT*FTRIM=%d\r", seq);
  else
    fprintf(stderr, "[%s:%d] Error: Buffer is null!",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/super7ramp/Leonard/refs/heads/master/"
            "src/com/at-commands.c",
            71);
  return buf;
}


x86 assembly (clang, -O0):
<at_ftrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1152 <at_ftrim+0x32>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeb8(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1173 <at_ftrim+0x53>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
lea    0xec3(%rip),%rdx
mov    $0x47,%ecx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_ftrim>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     113c <at_ftrim+0x1c>
mov    %esi,%edx
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
jmp    115d <at_ftrim+0x3d>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
lea    0xed9(%rip),%rdx
mov    $0x47,%ecx
call   1030 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"AT*FTRIM=%d\0D\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c"[%s:%d] Error: Buffer is null!\00"
@.str.2 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/super7ramp/Leonard/refs/heads/master/src/com/at-commands.c\00"
define i8* @at_ftrim(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.2, i64 0, i64 0), i32 71)
br label %14
14: ; preds = %11, %7
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [13 x i8] c"AT*FTRIM=%d\0D\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c"[%s:%d] Error: Buffer is null!\00"
@.str.2 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/super7ramp/Leonard/refs/heads/master/src/com/at-commands.c\00"
define i8* @at_ftrim(i8* returned writeonly %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @sprintf(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %9
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.2, i64 0, i64 0), i32 71)
br label %9
9: ; preds = %6, %4
ret i8* %0
}