#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*/ FILE;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *);
int main() {
  char readbuf[60];
  FILE *fp = fopen("./MsgMap.conf", "r");
  char msg[10];
  char handle[60 - 10];
  while (fgets(readbuf, 60, fp)) {
    sscanf(readbuf, "%s %s", msg, handle);
    printf("msg: %s  handle: %s\n", msg, handle);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    $0x3c,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11bc <main+0x7c>
lea    -0x40(%rbp),%rdi
lea    -0x52(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    0xe75(%rip),%rsi
call   1050 <sscanf@plt>
lea    -0x52(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    1169 <main+0x29>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xea8(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
lea    0x10(%rsp),%rdi
mov    $0x3c,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     11d4 <main+0x94>
lea    0xe8b(%rip),%r14
lea    0x10(%rsp),%r12
lea    0x6(%rsp),%r13
lea    0x50(%rsp),%rbx
lea    0xe7b(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1050 <sscanf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x3c,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
jne    11a0 <main+0x60>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"./MsgMap.conf\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%s %s\00"
@.str.3 = [21 x i8] c"msg: %s handle: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [60 x i8]
%3 = alloca i32*
%4 = alloca [10 x i8]
%5 = alloca [50 x i8]
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %3
br label %7
7: ; preds = %12, %0
%8 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%9 = load i32*, i32** %3
%10 = call i64 @fgets(i8* %8, i32 60, i32* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%16 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15)
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%19 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %17, i8* %18)
br label %7
20: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"./MsgMap.conf\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [6 x i8] c"%s %s\00"
@.str.3 = [21 x i8] c"msg: %s handle: %s\0A\00"
define i32 @main() {
%1 = alloca [60 x i8]
%2 = alloca [10 x i8]
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [60 x i8], [60 x i8]* %1, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = call i64 @fgets(i8* %4, i32 60, i32* %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %0, %10
%11 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %7)
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8* %7)
%13 = call i64 @fgets(i8* %4, i32 60, i32* %5)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %10
15: ; preds = %10, %0
ret i32 0
}