#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 my_getline(char *, int);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ sscanf(char *, char *, unsigned char *, unsigned char *);
int main(int argc, char *argv[]) {
  unsigned char a, b;
  int len = 100;
  char line[100];
  while (my_getline(line, 100) > 1) {
    sscanf(line, "%d %d", &a, &b);
    printf("%d\n", a + b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x64,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1050 <my_getline@plt>
cmp    $0x1,%eax
jle    119d <main+0x6d>
lea    -0x80(%rbp),%rdi
lea    0xe8e(%rip),%rsi
lea    -0x11(%rbp),%rdx
lea    -0x12(%rbp),%rcx
call   1040 <sscanf@plt>
movzbl -0x11(%rbp),%eax
movzbl -0x12(%rbp),%ecx
add    %ecx,%eax
lea    0xe76(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1050 <my_getline@plt>
cmp    $0x2,%eax
jl     11b7 <main+0x87>
lea    0xea5(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xf(%rsp),%r15
lea    0xe(%rsp),%r12
lea    0xe95(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <sscanf@plt>
movzbl 0xe(%rsp),%eax
add    0xf(%rsp),%al
movzbl %al,%esi
mov    %r13,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <my_getline@plt>
cmp    $0x1,%eax
jg     1180 <main+0x50>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
%9 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %8
br label %10
10: ; preds = %14, %2
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%12 = call i32 @my_getline(i8* %11, i32 100)
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = add nsw i32 %18, %20
%22 = trunc i32 %21 to i8
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %22)
br label %10
24: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = call i32 @my_getline(i8* %6, i32 100)
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %17
9: ; preds = %2, %9
%10 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%11 = load i8, i8* %3
%12 = load i8, i8* %4
%13 = add i8 %12, %11
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %13)
%15 = call i32 @my_getline(i8* %6, i32 100)
%16 = icmp sgt i32 %15, 1
br i1 %16, label %9, label %17
17: ; preds = %9, %2
ret i32 0
}