#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, char const *, char const *);
int /*<<< orphan*/ stderr;
char *at_config(char *buf, int seq, const char *name, const char *value) {
  if (buf != NULL)
    sprintf(buf, "AT*CONFIG=%d,\"%s\",\"%s\"\r", seq, name, value);
  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",
            89);
  return buf;
}


x86 assembly (clang, -O0):
<at_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1162 <at_config+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xea8(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1183 <at_config+0x63>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
lea    0xebe(%rip),%rdx
mov    $0x59,%ecx
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_config>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1142 <at_config+0x22>
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %esi,%edx
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
jmp    1163 <at_config+0x43>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
lea    0xede(%rip),%rdx
mov    $0x59,%ecx
call   1030 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"AT*CONFIG=%d,\22%s\22,\22%s\22\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_config(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = load i8*, i8** %7
%15 = load i8*, i8** %8
%16 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %13, i8* %14, i8* %15)
br label %20
17: ; preds = %4
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, 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 89)
br label %20
20: ; preds = %17, %11
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
@.str = [24 x i8] c"AT*CONFIG=%d,\22%s\22,\22%s\22\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_config(i8* returned writeonly %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @sprintf(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2, i8* %3)
br label %11
8: ; preds = %4
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, 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 89)
br label %11
11: ; preds = %8, %6
ret i8* %0
}