#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  char *tm_hour;
  char *tm_min;
  char *tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int, char *, char *, char *, int,
                           int, int, char *, char *, char *, char *, char *,
                           char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *EnviarDadosVenda(int sessao, char *codigo_ativacao, char *dados_venda) {
  char *cod = "";
  char *mensagem_sefaz = "";
  char *conteudo_cfe = "<CFe>...</CFe>";
  char *chave_consulta = "CFe35000000000000000000590000000000000000000001";
  char *valor_total_cfe = "4.73";
  char *cpf_cnpj_value = "00000000000000";
  char *assinatura_qrcode = "Z5nVOlWc...3RIw==";
  time_t t = time(NULL);
  struct tm tm = *localtime(&t);
  static char resp[512];
  sprintf(resp,
          "%d|06000|0000|"
          "Emitido com sucesso + conte"
          "\xc3\xba"
          "do notas|"
          "%s|%s|%s|"
          "%04d%02d%02d%02d%02d%02d|%s|%s|%s|%s",
          sessao, cod, mensagem_sefaz, conteudo_cfe, tm.tm_year + 1900,
          tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
          chave_consulta, valor_total_cfe, cpf_cnpj_value, assinatura_qrcode);
  return resp;
}


x86 assembly (clang, -O0):
<EnviarDadosVenda>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %edi,-0x2c(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
lea    0xeec(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xee1(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe84(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xe88(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xeab(%rip),%rax
mov    %rax,-0x78(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x7c(%rbp)
lea    -0x7c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rsi
lea    -0xa8(%rbp),%rdi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    -0x2c(%rbp),%edx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0xa8(%rbp),%eax
add    $0x76c,%eax
mov    -0xa4(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0xb4(%rbp)
mov    -0xa0(%rbp),%r13d
mov    -0x98(%rbp),%r12
mov    -0x90(%rbp),%r15
mov    -0x88(%rbp),%r14
mov    -0x60(%rbp),%rbx
mov    -0x68(%rbp),%r11
mov    -0x70(%rbp),%r10
mov    -0x78(%rbp),%rsi
mov    %rsi,-0xb0(%rbp)
lea    0x2e18(%rip),%rdi
lea    0xe26(%rip),%rsi
mov    %eax,(%rsp)
mov    -0xb4(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xb0(%rbp),%rax
mov    %r13d,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r11,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
call   1060 <sprintf@plt>
lea    0x2dc9(%rip),%rax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<EnviarDadosVenda>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x54(%rsp)
lea    0x54(%rsp),%rdi
call   1030 <localtime@plt>
mov    0x4(%rax),%ecx
mov    0x8(%rax),%edx
movups 0x10(%rax),%xmm0
mov    0x20(%rax),%rsi
mov    $0x76c,%edi
add    (%rax),%edi
add    $0x1,%ecx
lea    0xee7(%rip),%rax
mov    %rax,0x48(%rsp)
lea    0xecc(%rip),%rax
mov    %rax,0x40(%rsp)
lea    0xebb(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0xe7f(%rip),%rax
mov    %rax,0x30(%rsp)
mov    %rsi,0x28(%rsp)
movups %xmm0,0x18(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0x8(%rsp)
mov    %edi,(%rsp)
lea    0x2e9f(%rip),%rbx
lea    0xead(%rip),%rsi
lea    0xe93(%rip),%rcx
lea    0xe3a(%rip),%r9
mov    %rbx,%rdi
mov    %ebp,%edx
mov    %rcx,%r8
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i8*, i8*, i8* }
@.str = [1 x i8] zeroinitializer
@.str.1 = [15 x i8] c"<CFe>...</CFe>\00"
@.str.2 = [48 x i8] c"CFe35000000000000000000590000000000000000000001\00"
@.str.3 = [5 x i8] c"4.73\00"
@.str.4 = [15 x i8] c"00000000000000\00"
@.str.5 = [18 x i8] c"Z5nVOlWc...3RIw==\00"
@EnviarDadosVenda.resp = internal global [512 x i8] zeroinitializer
@.str.6 = [98 x i8] c"%d|06000|0000|Emitido com sucesso + conte\C3\BAdo notas|%s|%s|%s|%04d%02d%02d%02d%02d%02d|%s|%s|%s|%s\00"
define i8* @EnviarDadosVenda(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca %struct.tm
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8** %13
%16 = call i32 @time(i32* null)
store i32 %16, i32* %14
%17 = call %struct.tm* @localtime(i32* %14)
%18 = bitcast %struct.tm* %15 to i8*
%19 = bitcast %struct.tm* %17 to i8*
%20 = load i32, i32* %4
%21 = load i8*, i8** %7
%22 = load i8*, i8** %8
%23 = load i8*, i8** %9
%24 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 0
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1900
%27 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
%28 = load i32, i32* %27
%29 = add nsw i32 %28, 1
%30 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 2
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%33 = load i8*, i8** %32
%34 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 4
%35 = load i8*, i8** %34
%36 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 5
%37 = load i8*, i8** %36
%38 = load i8*, i8** %10
%39 = load i8*, i8** %11
%40 = load i8*, i8** %12
%41 = load i8*, i8** %13
%42 = call i32 @sprintf(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @EnviarDadosVenda.resp, i64 0, i64 0), i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.6, i64 0, i64 0), i32 %20, i8* %21, i8* %22, i8* %23, i32 %26, i32 %29, i32 %31, i8* %33, i8* %35, i8* %37, i8* %38, i8* %39, i8* %40, i8* %41)
ret i8* getelementptr inbounds ([512 x i8], [512 x i8]* @EnviarDadosVenda.resp, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i8*, i8*, i8* }
@.str = [1 x i8] zeroinitializer
@.str.1 = [15 x i8] c"<CFe>...</CFe>\00"
@.str.2 = [48 x i8] c"CFe35000000000000000000590000000000000000000001\00"
@.str.3 = [5 x i8] c"4.73\00"
@.str.4 = [15 x i8] c"00000000000000\00"
@.str.5 = [18 x i8] c"Z5nVOlWc...3RIw==\00"
@EnviarDadosVenda.resp = internal global [512 x i8] zeroinitializer
@.str.6 = [98 x i8] c"%d|06000|0000|Emitido com sucesso + conte\C3\BAdo notas|%s|%s|%s|%04d%02d%02d%02d%02d%02d|%s|%s|%s|%s\00"
define i8* @EnviarDadosVenda(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @time(i32* null)
store i32 %6, i32* %4
%7 = call %struct.tm* @localtime(i32* %4)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 1
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 2
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 4
%17 = load i8*, i8** %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 5
%19 = load i8*, i8** %18
%20 = add nsw i32 %9, 1900
%21 = add nsw i32 %11, 1
%22 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([512 x i8], [512 x i8]* @EnviarDadosVenda.resp, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @.str.6, i64 0, i64 0), i32 %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %21, i32 %13, i8* %15, i8* %17, i8* %19, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
ret i8* getelementptr inbounds ([512 x i8], [512 x i8]* @EnviarDadosVenda.resp, i64 0, i64 0)
}