#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*/ minmea_scan(char const *, char *, char *);
bool minmea_talker_id(char talker[3], const char *sentence) {
  char type[6];
  if (!minmea_scan(sentence, "t", type))
    return false;
  talker[0] = type[0];
  talker[1] = type[1];
  talker[2] = '\0';
  return true;
}


x86 assembly (clang, -O0):
<minmea_talker_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1e(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <minmea_scan@plt>
cmp    $0x0,%eax
jne    1149 <minmea_talker_id+0x39>
movl   $0x0,-0x4(%rbp)
jmp    116b <minmea_talker_id+0x5b>
mov    -0x1e(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x1d(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x2(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minmea_talker_id>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0xede(%rip),%rsi
lea    0xa(%rsp),%rdx
mov    %rax,%rdi
call   1030 <minmea_scan@plt>
test   %eax,%eax
je     114b <minmea_talker_id+0x3b>
mov    0xa(%rsp),%al
mov    %al,(%rbx)
mov    0xb(%rsp),%al
mov    %al,0x1(%rbx)
movb   $0x0,0x2(%rbx)
mov    $0x1,%eax
jmp    114d <minmea_talker_id+0x3d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"t\00"
define i32 @minmea_talker_id(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [6 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%9 = call i32 @minmea_scan(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %2
store i32 0, i32* %3
br label %23
12: ; preds = %2
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%14 = load i8, i8* %13
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 0
store i8 %14, i8* %16
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 1
%18 = load i8, i8* %17
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8 %18, i8* %20
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 0, i8* %22
store i32 1, i32* %3
br label %23
23: ; preds = %12, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [2 x i8] c"t\00"
define i32 @minmea_talker_id(i8* nocapture writeonly %0, i8* %1) {
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%5 = call i32 @minmea_scan(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = load i8, i8* %4
store i8 %8, i8* %0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 1
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %10, i8* %11
%12 = getelementptr inbounds i8, i8* %0, i64 2
store i8 0, i8* %12
br label %13
13: ; preds = %2, %7
%14 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %14
}